|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.gateway.MessagingGatewaySupport
org.springframework.integration.http.inbound.HttpRequestHandlingMessagingGateway
public class HttpRequestHandlingMessagingGateway
Inbound Messaging Gateway that handles HTTP Requests. May be configured as a bean in the Application Context and
delegated to from a simple HttpRequestHandlerServlet in web.xml
where the servlet and bean both have the
same name. If the expectReply
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).
supportedMethods
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 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 HttpMessageConverter
s are already configured. The list can be overridden by calling
the setMessageConverters(List)
method.
Field Summary |
---|
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport |
---|
logger |
Constructor Summary | |
---|---|
HttpRequestHandlingMessagingGateway()
|
|
HttpRequestHandlingMessagingGateway(boolean expectReply)
|
Method Summary | |
---|---|
protected java.lang.Object |
doHandleRequest(javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse)
Handles the HTTP request by generating a Message and sending it to the request channel. |
java.lang.String |
getComponentType()
|
protected java.util.List<org.springframework.http.converter.HttpMessageConverter<?>> |
getMessageConverters()
|
void |
handleRequest(javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse)
Handles the HTTP request by generating a Message and sending it to the request channel. |
protected boolean |
isExpectReply()
|
protected void |
onInit()
Locates the MultipartResolver bean based on the default name defined by the
DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME constant if available. |
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). |
void |
setExtractReplyPayload(boolean extractReplyPayload)
Specify whether only the reply Message's payload should be passed in the response. |
void |
setHeaderExpressions(java.util.Map<java.lang.String,org.springframework.expression.Expression> headerExpressions)
Specifies a Map of SpEL expressions to evaluate in order to generate the Message headers. |
void |
setHeaderMapper(org.springframework.integration.mapping.HeaderMapper<org.springframework.http.HttpHeaders> headerMapper)
Set the HeaderMapper to use when mapping between HTTP headers and MessageHeaders. |
void |
setMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters)
Set the message body converters to use. |
void |
setMultipartResolver(org.springframework.web.multipart.MultipartResolver multipartResolver)
Specify the MultipartResolver to use when checking requests. |
void |
setPath(java.lang.String path)
Set the path template for which this endpoint expects requests. |
void |
setPayloadExpression(org.springframework.expression.Expression payloadExpression)
Specifies a SpEL expression to evaluate in order to generate the Message payload. |
void |
setRequestPayloadType(java.lang.Class<?> requestPayloadType)
Specify the type of payload to be generated when the inbound HTTP request content is read by the HttpMessageConverter s. |
void |
setSupportedMethodNames(java.lang.String... supportedMethods)
Specify the supported request method names for this gateway. |
void |
setSupportedMethods(org.springframework.http.HttpMethod... supportedMethods)
Specify the supported request methods for this gateway. |
Methods inherited from class org.springframework.integration.gateway.MessagingGatewaySupport |
---|
doStart, doStop, receive, send, sendAndReceive, sendAndReceiveMessage, setErrorChannel, setReplyChannel, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestMapper, setRequestTimeout, setShouldTrack |
Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint |
---|
getPhase, isAutoStartup, isRunning, setAutoStartup, setPhase, setTaskScheduler, start, stop, stop |
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
---|
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.springframework.integration.context.NamedComponent |
---|
getComponentName |
Constructor Detail |
---|
public HttpRequestHandlingMessagingGateway()
public HttpRequestHandlingMessagingGateway(boolean expectReply)
Method Detail |
---|
public void setConvertExceptions(boolean convertExceptions)
convertExceptions
- the flag to setpublic final void handleRequest(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse) throws javax.servlet.ServletException, java.io.IOException
HttpMessageConverter
s.
handleRequest
in interface org.springframework.web.HttpRequestHandler
javax.servlet.ServletException
java.io.IOException
protected boolean isExpectReply()
public void setPath(java.lang.String path)
public void setPayloadExpression(org.springframework.expression.Expression payloadExpression)
#pathVariables
and
#queryParameters
variables if present. Those variables' values are Maps.
public void setHeaderExpressions(java.util.Map<java.lang.String,org.springframework.expression.Expression> headerExpressions)
#pathVariables
and
#queryParameters
variables if present. Those variables' values are Maps.
public void setMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters)
protected java.util.List<org.springframework.http.converter.HttpMessageConverter<?>> getMessageConverters()
public void setHeaderMapper(org.springframework.integration.mapping.HeaderMapper<org.springframework.http.HttpHeaders> headerMapper)
HeaderMapper
to use when mapping between HTTP headers and MessageHeaders.
public void setSupportedMethodNames(java.lang.String... supportedMethods)
public void setSupportedMethods(org.springframework.http.HttpMethod... supportedMethods)
public void setRequestPayloadType(java.lang.Class<?> requestPayloadType)
HttpMessageConverter
s. By default this value is null which means at runtime any "text" Content-Type will
result in String while all others default to byte[].class
.
public void setExtractReplyPayload(boolean extractReplyPayload)
public void setMultipartResolver(org.springframework.web.multipart.MultipartResolver multipartResolver)
MultipartResolver
to use when checking requests. If no resolver is provided, the
"multipartResolver" bean in the context will be used as a fallback. If that is not available either, this
endpoint will not support multipart requests.
public java.lang.String getComponentType()
getComponentType
in interface org.springframework.integration.context.NamedComponent
getComponentType
in class org.springframework.integration.gateway.MessagingGatewaySupport
protected void onInit() throws java.lang.Exception
MultipartResolver
bean based on the default name defined by the
DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME
constant if available.
onInit
in class org.springframework.integration.gateway.MessagingGatewaySupport
java.lang.Exception
protected final java.lang.Object doHandleRequest(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse) throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |