HTTP inbound channel adapter
Channel adapter for receiving messages over HTTP.
The HTTP inbound adapters need to be deployed within a servlet container.
This adapter will simply acknowledge that the request was received by sending a 200
status code back (or using the specified MVC View to generate a response). If you want to send a response message back, use a HTTP inbound gateway instead.
Supported methods
Comma-separated HTTP method names. Determines which types of request are allowed with this endpoint. Possible methods are: GET, POST, HEAD, OPTIONS, PUT, DELETE and TRACE.
Default is POST, GET
.
Mapped request headers
Comma-separated list of names of HTTP headers to be mapped from the HTTP request into the message headers. The values in this list can also be simple patterns to be matched against the header names (e.g. foo
or foo
). The string HTTP_REQUEST_HEADERS
will match against any of the standard HTTP request headers.
All standard HTTP request headers are mapped by default.
Note that all non-standard headers will automatically be prefixed with X-
. This behaviour can be changed by using a custom header mapper.
Header mapper
A custom HeaderMapper
implementation can be used to fully control the mapping between message headers and HTTP headers. For example, to configure whether to use the X-
prefix for user-defined HTTP headers or not.
This setting is mutually exclusive with mapped request headers.
Payload expression
A SpEL expression that is evaluated in order to generate the message payload.
The evaluation context will be populated with an org.springframework.http.HttpEntity
instance as the root object, and the following expression variables will also be made available:
#requestParams - a MultiValueMap<String, String>
containing the request parameters from the query string or posted form data
#pathVariables - a Map<String, String>
containing the URI path placeholders and their values
#matrixVariables - a Map<String, MultiValueMap<String, String>>
containing the matrix variables according to Spring MVC specification
#requestAttributes - the org.springframework.web.context.request.RequestAttributes
associated with the current request
#requestHeaders - the org.springframework.http.HttpHeaders
object from the current request
#cookies - a Map<String, javax.servlet.http.Cookie>
containing the cookies from the current request
Optional
Path
Allows you to specify the URI path (e.g. /order/{orderId}
).
Any {variable}
in this path will be available in the SpEL evaluation context as an entry in the #pathVariables
map.
Ant-style path patterns are also supported (e.g. /myPath/*.do
).
Request payload type
Target type for payload that is the conversion result of the request.
By default this value is null
which means at runtime any "text" Content-Type will result in java.lang.String
while all others default to byte[]
.
Status code expression
A SpEL expression that resolves to an HttpStatus
code when rendering a response. The expression must return an object which can be converted to a org.springframework.http.HttpStatus
enum value. The evaluation context has a bean resolver but no variables, so the usage of this attribute is somewhat limited.
An example might be to resolve, at runtime, some scoped bean that returns an HttpStatus
value, or use a literal expression e.g. 201
. For more control consider using an HTTP inbound gateway: it resolves the status code from the http_statusCode
header of the reply message.
By default status code expression is null
, meaning that the default '200 OK' response status will be returned.
Send timeout
Maximum amount of time in milliseconds to wait when sending a message to the channel if such channel may block. For example, a queue channel can block until space is available if its maximum capacity has been reached.
Default is 1000
(1 second).
View name
View name to be resolved when rendering a response.
Errors key
In the case that a view name is specified this attribute can be used to override the default key of the errors (if the request cannot be handled).
Defaults to errors
(similar to normal MVC usage).
Error code
In the case that a view name is specified this attribute can be used to override the default error code under which the handling exception is exposed.
Defaults to spring.integration.http.handler.error
and is supplied with 3 parameters: the exception itself, its message and its stack trace as a string.
Error channel
The channel that error messages will be sent to if a failure occurs in this gateway's invocation. To completely suppress exceptions, provide a reference to the nullChannel here.
Custom message headers that will be added to messages send by this adapter.
The value is determined by a SpEL expression, which has access to the body and headers of the incoming HTTP request, any path variables (as defined by the path property) and any query parameters from the request URL.
Channel
Channel where the generated messages should be sent to.
You can select the nullChannel
here to silently drop the messages.
Required
Id
Name that uniquely identifies this flow component.
Required