Class BaseHttpInboundEndpoint
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.gateway.MessagingGatewaySupport
org.springframework.integration.http.inbound.BaseHttpInboundEndpoint
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
,org.springframework.context.Lifecycle
,org.springframework.context.Phased
,org.springframework.context.SmartLifecycle
,org.springframework.integration.context.ComponentSourceAware
,org.springframework.integration.context.ExpressionCapable
,org.springframework.integration.context.OrderlyShutdownCapable
,org.springframework.integration.IntegrationPattern
,org.springframework.integration.support.context.NamedComponent
,org.springframework.integration.support.management.IntegrationInboundManagement
,org.springframework.integration.support.management.IntegrationManagement
,org.springframework.integration.support.management.ManageableLifecycle
,org.springframework.integration.support.management.ManageableSmartLifecycle
,org.springframework.integration.support.management.TrackableComponent
- Direct Known Subclasses:
HttpRequestHandlingEndpointSupport
public class BaseHttpInboundEndpoint
extends org.springframework.integration.gateway.MessagingGatewaySupport
implements org.springframework.integration.context.OrderlyShutdownCapable
The
MessagingGatewaySupport
extension for HTTP Inbound endpoints
with basic properties.- Since:
- 5.0
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.integration.gateway.MessagingGatewaySupport
org.springframework.integration.gateway.MessagingGatewaySupport.ConvertingMessagingTemplate
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AtomicInteger
protected static final boolean
protected static final List<org.springframework.http.HttpMethod>
protected static final boolean
Fields inherited from class org.springframework.integration.gateway.MessagingGatewaySupport
messagingTemplate
Fields inherited from class org.springframework.integration.endpoint.AbstractEndpoint
lifecycleCondition, lifecycleLock
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
int
protected org.springframework.expression.spel.support.StandardEvaluationContext
protected org.springframework.http.HttpStatus
evaluateHttpStatus
(org.springframework.http.HttpEntity<?> httpEntity) protected boolean
protected org.springframework.integration.mapping.HeaderMapper<org.springframework.http.HttpHeaders>
org.springframework.integration.IntegrationPatternType
protected org.springframework.expression.Expression
final RequestMapping
protected org.springframework.core.ResolvableType
protected org.springframework.expression.Expression
protected org.springframework.validation.Validator
protected boolean
protected static boolean
isReadable
(org.springframework.http.HttpMethod httpMethod) Checks if the request has a readable body (not a GET, HEAD, or OPTIONS request).protected void
onInit()
protected org.springframework.http.HttpStatus
resolveHttpStatusFromHeaders
(org.springframework.messaging.MessageHeaders headers) void
setCrossOrigin
(CrossOrigin crossOrigin) Set theCrossOrigin
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, 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 theHeaderMapper
to use when mapping between HTTP headers and MessageHeaders.void
setPayloadExpression
(org.springframework.expression.Expression payloadExpression) Specifies a SpEL expression to evaluate in order to generate the Message payload.void
setRequestMapping
(RequestMapping requestMapping) Set theRequestMapping
which allows you to specify a flexible RESTFul-mapping for this endpoint.void
setRequestPayloadType
(org.springframework.core.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
(org.springframework.expression.Expression statusCodeExpression) Specify theExpression
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 theExpression
to resolve a status code for Response to override the default '200 OK' or '500 Internal Server Error' for a timeout.void
setValidator
(org.springframework.validation.Validator validator) Specify aValidator
to validate a converted payload from request.protected void
Methods inherited from class org.springframework.integration.gateway.MessagingGatewaySupport
buildErrorMessage, 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, setShouldTrack
Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stop
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, 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, 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.support.management.IntegrationManagement
getThisAs
Methods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Field Details
-
JAXB_PRESENT
protected static final boolean JAXB_PRESENT -
ROME_TOOLS_PRESENT
protected static final boolean ROME_TOOLS_PRESENT -
NON_READABLE_BODY_HTTP_METHODS
-
activeCount
-
-
Constructor Details
-
BaseHttpInboundEndpoint
public BaseHttpInboundEndpoint(boolean expectReply)
-
-
Method Details
-
setPayloadExpression
public void setPayloadExpression(org.springframework.expression.Expression payloadExpression) Specifies a SpEL expression to evaluate in order to generate the Message payload. The EvaluationContext will be populated with an HttpEntity instance as the root object, and it may contain variables:#pathVariables
#requestParams
#requestAttributes
#requestHeaders
#matrixVariables
#cookies
- Parameters:
payloadExpression
- The payload expression.
-
setHeaderExpressions
public void setHeaderExpressions(Map<String, org.springframework.expression.Expression> headerExpressions) Specifies a Map of SpEL expressions to evaluate in order to generate the Message headers. The keys in the map will be used as the header names. When evaluating the expression, the EvaluationContext will be populated with an HttpEntity instance as the root object, and it may contain variables:#pathVariables
#requestParams
#requestAttributes
#requestHeaders
#matrixVariables
#cookies
- Parameters:
headerExpressions
- The header expressions.
-
setRequestMapping
Set theRequestMapping
which allows you to specify a flexible RESTFul-mapping for this endpoint.- Parameters:
requestMapping
- The request mapping.
-
getRequestMapping
-
setCrossOrigin
Set theCrossOrigin
to permit cross origin requests for this endpoint.- Parameters:
crossOrigin
- the CrossOrigin config.- Since:
- 4.2
-
getCrossOrigin
-
getPayloadExpression
protected org.springframework.expression.Expression getPayloadExpression() -
getHeaderExpressions
-
isExpectReply
protected boolean isExpectReply()- Returns:
- Whether to expect a reply.
-
setHeaderMapper
public void setHeaderMapper(org.springframework.integration.mapping.HeaderMapper<org.springframework.http.HttpHeaders> headerMapper) Set theHeaderMapper
to use when mapping between HTTP headers and MessageHeaders.- Parameters:
headerMapper
- The header mapper.
-
getHeaderMapper
protected org.springframework.integration.mapping.HeaderMapper<org.springframework.http.HttpHeaders> getHeaderMapper() -
setRequestPayloadTypeClass
Specify the type of payload to be generated when the inbound HTTP request content is read by the converters/encoders. By default this value is null which means at runtime any "text" Content-Type will result in String while all others default tobyte[].class
.- Parameters:
requestPayloadType
- The payload type.
-
setRequestPayloadType
public void setRequestPayloadType(org.springframework.core.ResolvableType requestPayloadType) Specify the type of payload to be generated when the inbound HTTP request content is read by the converters/encoders. By default this value is null which means at runtime any "text" Content-Type will result in String while all others default tobyte[].class
.- Parameters:
requestPayloadType
- The payload type.
-
getRequestPayloadType
protected org.springframework.core.ResolvableType getRequestPayloadType() -
setExtractReplyPayload
public void setExtractReplyPayload(boolean extractReplyPayload) Specify whether only the reply Message's payload should be passed in the response. If this is set to 'false', the entire Message will be used to generate the response. The default is 'true'.- Parameters:
extractReplyPayload
- true to extract the reply payload.
-
getExtractReplyPayload
protected boolean getExtractReplyPayload() -
setStatusCodeExpressionString
Specify theExpression
to resolve a status code for Response to override the default '200 OK' or '500 Internal Server Error' for a timeout.- Parameters:
statusCodeExpression
- The status code Expression.- Since:
- 5.0
- See Also:
-
setStatusCodeExpression
public void setStatusCodeExpression(org.springframework.expression.Expression statusCodeExpression) Specify theExpression
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 wheneverexpectReply
is true) resolves anHttpStatus
from theHttpHeaders.STATUS_CODE
replyMessage
header.- Parameters:
statusCodeExpression
- The status code Expression.- Since:
- 4.1
- See Also:
-
MessagingGatewaySupport.setReplyTimeout(long)
HttpRequestHandlingEndpointSupport(boolean)
-
getStatusCodeExpression
protected org.springframework.expression.Expression getStatusCodeExpression() -
setValidator
public void setValidator(org.springframework.validation.Validator validator) Specify aValidator
to validate a converted payload from request.- Parameters:
validator
- theValidator
to use.- Since:
- 5.2
-
getValidator
protected org.springframework.validation.Validator getValidator() -
onInit
protected void onInit()- Overrides:
onInit
in classorg.springframework.integration.gateway.MessagingGatewaySupport
-
evaluateHttpStatus
protected org.springframework.http.HttpStatus evaluateHttpStatus(org.springframework.http.HttpEntity<?> httpEntity) -
resolveHttpStatusFromHeaders
protected org.springframework.http.HttpStatus resolveHttpStatusFromHeaders(org.springframework.messaging.MessageHeaders headers) -
createEvaluationContext
protected org.springframework.expression.spel.support.StandardEvaluationContext createEvaluationContext() -
beforeShutdown
public int beforeShutdown()- Specified by:
beforeShutdown
in interfaceorg.springframework.integration.context.OrderlyShutdownCapable
-
afterShutdown
public int afterShutdown()- Specified by:
afterShutdown
in interfaceorg.springframework.integration.context.OrderlyShutdownCapable
-
getComponentType
- Specified by:
getComponentType
in interfaceorg.springframework.integration.support.context.NamedComponent
- Overrides:
getComponentType
in classorg.springframework.integration.gateway.MessagingGatewaySupport
-
getIntegrationPatternType
public org.springframework.integration.IntegrationPatternType getIntegrationPatternType()- Specified by:
getIntegrationPatternType
in interfaceorg.springframework.integration.IntegrationPattern
- Overrides:
getIntegrationPatternType
in classorg.springframework.integration.gateway.MessagingGatewaySupport
-
validate
-
isReadable
protected static boolean isReadable(@Nullable org.springframework.http.HttpMethod httpMethod) Checks if the request has a readable body (not a GET, HEAD, or OPTIONS request).- Parameters:
httpMethod
- the HTTP method to check- Returns:
- true or false if HTTP request can contain the body
-