Class HttpRequestHandlingMessagingGateway
- All Implemented Interfaces:
- Aware,- BeanFactoryAware,- BeanNameAware,- DisposableBean,- InitializingBean,- ApplicationContextAware,- Lifecycle,- Phased,- SmartLifecycle,- ComponentSourceAware,- ExpressionCapable,- OrderlyShutdownCapable,- IntegrationPattern,- NamedComponent,- IntegrationInboundManagement,- IntegrationManagement,- ManageableLifecycle,- ManageableSmartLifecycle,- TrackableComponent,- HttpRequestHandler
web.xml where the servlet and bean both have the
 same name. If the BaseHttpInboundEndpoint.isExpectReply() property is set to true, a response can generated from a reply Message.
 Otherwise, the gateway will play the role of a unidirectional Channel Adapter with a simple status-based response
 (e.g. 200 OK).
 
 The default supported request methods are GET and POST, but the list of values can be configured with the
 RequestMapping.getMethods() property.
 The payload generated from a GET request (or HEAD or OPTIONS if supported) will
 be a MultiValueMap containing the parameter values.
 For a request containing a body (e.g. a POST), the type of the payload is determined
 by the BaseHttpInboundEndpoint.setRequestPayloadTypeClass(Class) request payload type}.
 
 If the HTTP request is a multipart and a "multipartResolver" bean has been defined in the context, then it will be
 converted by the
 MultipartAwareFormHttpMessageConverter as long as the default
 message converters have not
 been overwritten (although providing a customized instance of the Multipart-aware converter is also an option).
 
 By default a number of HttpMessageConverters are already configured. The list can be overridden by calling
 the HttpRequestHandlingEndpointSupport.setMessageConverters(List) method.
- Since:
- 2.0
- Author:
- Mark Fisher, Oleg Zhurakousky, Artem Bilan, Gary Russell
- 
Nested Class SummaryNested classes/interfaces inherited from class org.springframework.integration.gateway.MessagingGatewaySupportMessagingGatewaySupport.ConvertingMessagingTemplateNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFields inherited from class org.springframework.integration.http.inbound.BaseHttpInboundEndpointactiveCount, JAXB_PRESENT, NON_READABLE_BODY_HTTP_METHODS, ROME_TOOLS_PRESENTFields inherited from class org.springframework.integration.gateway.MessagingGatewaySupportmessagingTemplateFields inherited from class org.springframework.integration.endpoint.AbstractEndpointlifecycleCondition, lifecycleLockFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagementMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.context.SmartLifecycleDEFAULT_PHASE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfinal voidhandleRequest(HttpServletRequest servletRequest, HttpServletResponse servletResponse) Handles the HTTP request by generating a Message and sending it to the request channel.voidsetConvertExceptions(boolean convertExceptions) Flag to determine if conversion and writing out of message handling exceptions should be attempted (default false, in which case they will simply be re-thrown).Methods inherited from class org.springframework.integration.http.inbound.HttpRequestHandlingEndpointSupportdoHandleRequest, extractRequestBody, getMessageConverters, onInit, prepareRequest, prepareRequestEntity, setMergeWithDefaultConverters, setMessageConverters, setMultipartResolver, setStatusCodeIfNeeded, setupResponseAndConvertReplyMethods inherited from class org.springframework.integration.http.inbound.BaseHttpInboundEndpointafterShutdown, beforeShutdown, createEvaluationContext, evaluateHttpStatus, getComponentType, getCrossOrigin, getExtractReplyPayload, getHeaderExpressions, getHeaderMapper, getIntegrationPatternType, getPayloadExpression, getRequestMapping, getRequestPayloadType, getStatusCodeExpression, getValidator, isExpectReply, isReadable, resolveHttpStatusFromHeaders, setCrossOrigin, setExtractReplyPayload, setHeaderExpressions, setHeaderMapper, setPayloadExpression, setRequestMapping, setRequestPayloadType, setRequestPayloadTypeClass, setStatusCodeExpression, setStatusCodeExpressionString, setValidator, validateMethods inherited from class org.springframework.integration.gateway.MessagingGatewaySupportbuildErrorMessage, buildSendTimer, destroy, doStart, doStop, getErrorChannel, getErrorMessageAttributes, getErrorMessageStrategy, getManagedName, getManagedType, getOverrides, getReplyChannel, getRequestChannel, isLoggingEnabled, isObserved, receive, receive, receiveMessage, receiveMessage, registerMetricsCaptor, registerObservationRegistry, registerReplyMessageCorrelatorIfNecessary, send, sendAndReceive, sendAndReceiveMessage, sendAndReceiveMessageReactive, sendTimer, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setErrorOnTimeout, setLoggingEnabled, setManagedName, setManagedType, setObservationConvention, setReceiverObservationConvention, setReplyChannel, setReplyChannelName, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestChannelName, setRequestMapper, setRequestTimeout, setShouldTrackMethods inherited from class org.springframework.integration.endpoint.AbstractEndpointdoStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementgetThisAsMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Constructor Details- 
HttpRequestHandlingMessagingGatewaypublic HttpRequestHandlingMessagingGateway()
- 
HttpRequestHandlingMessagingGatewaypublic HttpRequestHandlingMessagingGateway(boolean expectReply) 
 
- 
- 
Method Details- 
setConvertExceptionspublic void setConvertExceptions(boolean convertExceptions) Flag to determine if conversion and writing out of message handling exceptions should be attempted (default false, in which case they will simply be re-thrown). If the flag is true and no message converter can convert the exception a new exception will be thrown.- Parameters:
- convertExceptions- the flag to set
 
- 
handleRequestpublic final void handleRequest(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws IOException Handles the HTTP request by generating a Message and sending it to the request channel. If this gateway's 'expectReply' property is true, it will also generate a response from the reply Message once received. That response will be written by theHttpMessageConverters.- Specified by:
- handleRequestin interface- HttpRequestHandler
- Throws:
- IOException
 
 
-