|
Spring Integration | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.integration.context.IntegrationObjectSupport org.springframework.integration.endpoint.AbstractEndpoint org.springframework.integration.gateway.AbstractMessagingGateway org.springframework.integration.http.HttpRequestHandlingController
public class HttpRequestHandlingController
Inbound HTTP endpoint that implements Spring's Controller
interface to be used with a DispatcherServlet front controller.
viewName
will be passed into the
ModelAndView return value.
This endpoint will have request/reply behavior by default. That
can be overridden by passing false
to the constructor.
In the request/reply case, the model map will be passed to the view, and it
will contain either the reply Message or payload depending on the value of
extractReplyPayload
(true by default, meaning just the payload).
The corresponding key in the map is determined by the replyKey
property (with a default of "reply").
Field Summary |
---|
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport |
---|
logger |
Constructor Summary | |
---|---|
HttpRequestHandlingController()
|
|
HttpRequestHandlingController(boolean expectReply)
|
Method Summary | |
---|---|
protected 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. |
String |
getComponentType()
Subclasses may implement this method to provide component type information. |
protected List<HttpMessageConverter<?>> |
getMessageConverters()
|
ModelAndView |
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 void |
onInit()
Locates the MultipartResolver bean based on the default name defined by
the DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME constant if available. |
void |
setExtractReplyPayload(boolean extractReplyPayload)
Specify whether only the reply Message's payload should be passed in the response. |
void |
setHeaderMapper(HeaderMapper<HttpHeaders> headerMapper)
Set the HeaderMapper to use when mapping between HTTP headers and MessageHeaders. |
void |
setMessageConverters(List<HttpMessageConverter<?>> messageConverters)
Set the message body converters to use. |
void |
setMultipartResolver(MultipartResolver multipartResolver)
Specify the MultipartResolver to use when checking requests. |
void |
setReplyKey(String replyKey)
Specify the key to be used when adding the reply Message or payload to the model map (will be payload only unless the value of HttpRequestHandlingEndpointSupport.setExtractReplyPayload(boolean) is false ). |
void |
setRequestPayloadType(Class<?> requestPayloadType)
Specify the type of payload to be generated when the inbound HTTP request content is read by the HttpMessageConverter s. |
void |
setSupportedMethodNames(String... supportedMethods)
Specify the supported request method names for this gateway. |
void |
setSupportedMethods(HttpMethod... supportedMethods)
Specify the supported request methods for this gateway. |
void |
setViewName(String viewName)
Specify the view name. |
Methods inherited from class org.springframework.integration.gateway.AbstractMessagingGateway |
---|
doStart, doStop, fromMessage, receive, send, sendAndReceive, sendAndReceiveMessage, setExceptionMapper, setReplyChannel, setReplyTimeout, setRequestChannel, setRequestTimeout, setShouldThrowErrors, toMessage |
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, getChannelResolver, getComponentName, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, toString, writeMessageHistory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HttpRequestHandlingController()
public HttpRequestHandlingController(boolean expectReply)
Method Detail |
---|
public void setViewName(String viewName)
public void setReplyKey(String replyKey)
HttpRequestHandlingEndpointSupport.setExtractReplyPayload(boolean)
is false
).
The default key is "reply".
public final ModelAndView handleRequest(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse) throws Exception
handleRequest
in interface Controller
Exception
public void setMessageConverters(List<HttpMessageConverter<?>> messageConverters)
protected List<HttpMessageConverter<?>> getMessageConverters()
public void setHeaderMapper(HeaderMapper<HttpHeaders> headerMapper)
HeaderMapper
to use when mapping between HTTP headers and MessageHeaders.
public void setSupportedMethodNames(String... supportedMethods)
public void setSupportedMethods(HttpMethod... supportedMethods)
public void setRequestPayloadType(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(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 String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class AbstractMessagingGateway
protected void onInit() throws Exception
MultipartResolver
bean based on the default name defined by
the DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME
constant if available.
onInit
in class AbstractMessagingGateway
Exception
protected final Object doHandleRequest(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse) throws IOException
IOException
|
Spring Integration | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |