public class HttpRequestHandlingController extends HttpRequestHandlingEndpointSupport implements Controller
Controller interface to be used with a DispatcherServlet front
controller.
The 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 core map will be passed to the view, and it will contain either the
reply Message or payload depending on the value of BaseHttpInboundEndpoint.setExtractReplyPayload(boolean)
(true by default, meaning just the payload).
The corresponding key in the map is determined by the replyKey property (with a default of "reply").
IntegrationManagement.ManagementOverrides| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_ERROR_CODE
The View model key for the error code.
|
static String |
DEFAULT_ERRORS_KEY
The View model key for errors.
|
static String |
DEFAULT_REPLY_KEY
The View model key for reply.
|
activeCount, JAXB_PRESENT, NON_READABLE_BODY_HTTP_METHODS, ROME_TOOLS_PRESENTmessagingTemplatelifecycleCondition, lifecycleLockEXPRESSION_PARSER, loggerMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEDEFAULT_PHASE| Constructor and Description |
|---|
HttpRequestHandlingController() |
HttpRequestHandlingController(boolean expectReply) |
| Modifier and Type | Method and Description |
|---|---|
ModelAndView |
handleRequest(HttpServletRequest servletRequest,
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 |
setErrorCode(String errorCode)
The error code to use to signal an error in the message handling.
|
void |
setErrorsKey(String errorsKey)
The key used to expose
Errors in the core,
in the case that message handling fails. |
void |
setReplyKey(String replyKey)
Specify the key to be used when adding the reply Message or payload to the core map (will be payload only unless
the value of
BaseHttpInboundEndpoint.setExtractReplyPayload(boolean) is false). |
void |
setViewExpression(Expression viewExpression)
Specifies a SpEL expression to evaluate in order to generate the view name.
|
void |
setViewName(String viewName)
Specify the view name.
|
doHandleRequest, extractRequestBody, getMessageConverters, prepareRequest, prepareRequestEntity, setMergeWithDefaultConverters, setMessageConverters, setMultipartResolver, setStatusCodeIfNeeded, setupResponseAndConvertReplyafterShutdown, 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, validatebuildErrorMessage, buildSendTimer, destroy, doStart, doStop, getErrorChannel, getErrorMessageAttributes, getManagedName, getManagedType, getOverrides, getReplyChannel, getRequestChannel, isLoggingEnabled, receive, receive, receiveMessage, receiveMessage, registerMetricsCaptor, registerReplyMessageCorrelatorIfNecessary, send, sendAndReceive, sendAndReceiveMessage, sendAndReceiveMessageReactive, sendTimer, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setErrorOnTimeout, setLoggingEnabled, setManagedName, setManagedType, setReplyChannel, setReplyChannelName, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestChannelName, setRequestMapper, setRequestTimeout, setShouldTrackdoStop, getPhase, getRole, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetThisAsgetBeanName, getComponentNamepublic static final String DEFAULT_ERROR_CODE
public static final String DEFAULT_REPLY_KEY
public static final String DEFAULT_ERRORS_KEY
public HttpRequestHandlingController()
public HttpRequestHandlingController(boolean expectReply)
public void setViewName(String viewName)
viewName - The view name.public void setReplyKey(String replyKey)
BaseHttpInboundEndpoint.setExtractReplyPayload(boolean) is false). The
default key is "reply".replyKey - The reply key.public void setErrorsKey(String errorsKey)
Errors in the core,
in the case that message handling fails. Defaults to "errors".errorsKey - The key value to set.public void setErrorCode(String errorCode)
MessageSource.
The default value is spring.integration.http.handler.error. Three arguments are provided: the
exception, its message and its stack trace as a String.errorCode - The error code to set.public void setViewExpression(Expression viewExpression)
viewExpression - The view expression.protected void onInit()
HttpRequestHandlingEndpointSupportMultipartResolver bean based on the default name defined by the
DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME constant if available.
Sets up default converters if no converters set, or HttpRequestHandlingEndpointSupport.setMergeWithDefaultConverters(boolean)
was called with true after the converters were set.onInit in class HttpRequestHandlingEndpointSupportpublic final ModelAndView handleRequest(HttpServletRequest servletRequest, HttpServletResponse servletResponse)
handleRequest in interface Controller