public class BaseHttpInboundEndpoint extends MessagingGatewaySupport implements OrderlyShutdownCapable
MessagingGatewaySupport extension for HTTP Inbound endpoints
with basic properties.IntegrationManagement.ManagementOverrides| Modifier and Type | Field and Description |
|---|---|
protected AtomicInteger |
activeCount |
protected static boolean |
JAXB_PRESENT |
protected static List<HttpMethod> |
NON_READABLE_BODY_HTTP_METHODS |
protected static boolean |
ROME_TOOLS_PRESENT |
messagingTemplatelifecycleCondition, lifecycleLockEXPRESSION_PARSER, loggerMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEDEFAULT_PHASE| Constructor and Description |
|---|
BaseHttpInboundEndpoint(boolean expectReply) |
| Modifier and Type | Method and Description |
|---|---|
int |
afterShutdown()
Called after normal shutdown of schedulers, executors etc,
and after the shutdown delay has elapsed, but before any
forced shutdown of any remaining active scheduler/executor
threads.Can optionally return the number of active messages
still in process.
|
int |
beforeShutdown()
Called before shutdown begins.
|
protected StandardEvaluationContext |
createEvaluationContext() |
protected HttpStatus |
evaluateHttpStatus(HttpEntity<?> httpEntity) |
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
CrossOrigin |
getCrossOrigin() |
protected boolean |
getExtractReplyPayload() |
protected Map<String,Expression> |
getHeaderExpressions() |
protected HeaderMapper<HttpHeaders> |
getHeaderMapper() |
protected Expression |
getPayloadExpression() |
RequestMapping |
getRequestMapping() |
protected ResolvableType |
getRequestPayloadType() |
protected Expression |
getStatusCodeExpression() |
protected Validator |
getValidator() |
protected boolean |
isExpectReply() |
protected boolean |
isReadable(HttpMethod httpMethod)
Checks if the request has a readable body (not a GET, HEAD, or OPTIONS request).
|
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
protected HttpStatus |
resolveHttpStatusFromHeaders(MessageHeaders headers) |
void |
setCrossOrigin(CrossOrigin crossOrigin)
Set the
CrossOrigin to permit cross origin requests for this endpoint. |
void |
setExtractReplyPayload(boolean extractReplyPayload)
Specify whether only the reply Message's payload should be passed in the response.
|
void |
setHeaderExpressions(Map<String,Expression> headerExpressions)
Specifies a Map of SpEL expressions to evaluate in order to generate the Message headers.
|
void |
setHeaderMapper(HeaderMapper<HttpHeaders> headerMapper)
Set the
HeaderMapper to use when mapping between HTTP headers and MessageHeaders. |
void |
setPayloadExpression(Expression payloadExpression)
Specifies a SpEL expression to evaluate in order to generate the Message payload.
|
void |
setRequestMapping(RequestMapping requestMapping)
Set the
RequestMapping which allows you to specify a flexible RESTFul-mapping for this endpoint. |
void |
setRequestPayloadType(ResolvableType requestPayloadType)
Specify the type of payload to be generated when the inbound HTTP request
content is read by the converters/encoders.
|
void |
setRequestPayloadTypeClass(Class<?> requestPayloadType)
Specify the type of payload to be generated when the inbound HTTP request
content is read by the converters/encoders.
|
void |
setStatusCodeExpression(Expression statusCodeExpression)
Specify the
Expression to resolve a status code for Response to override
the default '200 OK' or '500 Internal Server Error' for a timeout. |
void |
setStatusCodeExpressionString(String statusCodeExpression)
Specify the
Expression to resolve a status code for Response to override
the default '200 OK' or '500 Internal Server Error' for a timeout. |
void |
setValidator(Validator validator)
Specify a
Validator to validate a converted payload from request. |
protected void |
validate(Object value) |
buildErrorMessage, doStart, doStop, getErrorChannel, getErrorMessageAttributes, getManagedName, getManagedType, getMessageCount, getMessageCountLong, getOverrides, getReplyChannel, getRequestChannel, isCountsEnabled, isLoggingEnabled, receive, receive, receiveMessage, receiveMessage, registerReplyMessageCorrelatorIfNecessary, reset, send, sendAndReceive, sendAndReceiveMessage, sendAndReceiveMessageReactive, setCountsEnabled, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setErrorOnTimeout, setLoggingEnabled, setManagedName, setManagedType, setReplyChannel, setReplyChannelName, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestChannelName, setRequestMapper, setRequestTimeout, setShouldTrackdestroy, doStop, 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, waitgetBeanName, getComponentNamemessageCountdestroy, registerMetricsCaptorprotected static final boolean JAXB_PRESENT
protected static final boolean ROME_TOOLS_PRESENT
protected static final List<HttpMethod> NON_READABLE_BODY_HTTP_METHODS
protected final AtomicInteger activeCount
public void setPayloadExpression(Expression payloadExpression)
#pathVariables#requestParams#requestAttributes#requestHeaders#matrixVariables#cookies
payloadExpression - The payload expression.public void setHeaderExpressions(Map<String,Expression> headerExpressions)
#pathVariables#requestParams#requestAttributes#requestHeaders#matrixVariables#cookies
headerExpressions - The header expressions.public void setRequestMapping(RequestMapping requestMapping)
RequestMapping which allows you to specify a flexible RESTFul-mapping for this endpoint.requestMapping - The request mapping.public final RequestMapping getRequestMapping()
public void setCrossOrigin(CrossOrigin crossOrigin)
CrossOrigin to permit cross origin requests for this endpoint.crossOrigin - the CrossOrigin config.public CrossOrigin getCrossOrigin()
protected Expression getPayloadExpression()
protected Map<String,Expression> getHeaderExpressions()
protected boolean isExpectReply()
public void setHeaderMapper(HeaderMapper<HttpHeaders> headerMapper)
HeaderMapper to use when mapping between HTTP headers and MessageHeaders.headerMapper - The header mapper.protected HeaderMapper<HttpHeaders> getHeaderMapper()
public void setRequestPayloadTypeClass(Class<?> requestPayloadType)
byte[].class.requestPayloadType - The payload type.public void setRequestPayloadType(ResolvableType requestPayloadType)
byte[].class.requestPayloadType - The payload type.protected ResolvableType getRequestPayloadType()
public void setExtractReplyPayload(boolean extractReplyPayload)
extractReplyPayload - true to extract the reply payload.protected boolean getExtractReplyPayload()
public void setStatusCodeExpressionString(String statusCodeExpression)
Expression to resolve a status code for Response to override
the default '200 OK' or '500 Internal Server Error' for a timeout.statusCodeExpression - The status code Expression.setStatusCodeExpression(Expression)public void setStatusCodeExpression(Expression statusCodeExpression)
Expression to resolve a status code for Response to override
the default '200 OK' or '500 Internal Server Error' for a timeout.
The statusCodeExpression is applied only for the one-way
<http:inbound-channel-adapter/> or when no reply (timeout) is received for
a gateway. The <http:inbound-gateway/> (or whenever
expectReply is true) resolves
an HttpStatus from the
HttpHeaders.STATUS_CODE reply
Message header.
statusCodeExpression - The status code Expression.MessagingGatewaySupport.setReplyTimeout(long),
HttpRequestHandlingEndpointSupport.HttpRequestHandlingEndpointSupport(boolean)protected Expression getStatusCodeExpression()
public void setValidator(Validator validator)
Validator to validate a converted payload from request.validator - the Validator to use.protected Validator getValidator()
protected void onInit()
IntegrationObjectSupportonInit in class MessagingGatewaySupportprotected HttpStatus evaluateHttpStatus(HttpEntity<?> httpEntity)
protected HttpStatus resolveHttpStatusFromHeaders(MessageHeaders headers)
protected StandardEvaluationContext createEvaluationContext()
public int beforeShutdown()
OrderlyShutdownCapablebeforeShutdown in interface OrderlyShutdownCapablepublic int afterShutdown()
OrderlyShutdownCapableafterShutdown in interface OrderlyShutdownCapablepublic String getComponentType()
IntegrationObjectSupportgetComponentType in interface NamedComponentgetComponentType in class MessagingGatewaySupportprotected boolean isReadable(HttpMethod httpMethod)
httpMethod - the HTTP method to checkprotected void validate(Object value)