@ComponentProfile(summary="Listen for HTTP traffic on the specified URI", tag="consumer,http,https", metadata={"jettyQueryString","jettyURI","jettyURL","httpmethod","_interlokMessageConsumedFrom"}, recommended={EmbeddedConnection.class,JettyConnection.class}) public class JettyMessageConsumer extends BasicJettyConsumer
You should configure the BasicJettyConsumer.setDestination(com.adaptris.core.ConsumeDestination)
to contain the URI that should trigger
this consumer (e.g. /path/to/my/workflow
). The value from
ConsumeDestination.getFilterExpression()
is used to determine which HTTP methods are appropriate for
this consumer and should be a comma separated list. In the event that the filter expression is empty / null then all HTTP methods
are acceptable ("GET", "POST", "HEAD", "PUT", "DELETE",
"TRACE", "CONNECT", "PATCH"
) and will need to be handled directly by your workflow. OPTIONS
will be automatically.
If you want to preserve the http request headers or parameters simply configure a handler for either or both the headers and parameters.
See the following javadoc for the following configuration items for headers/parameters;
Note that if you intend for this class to be consumer withing a PoolingWorkflow
then you should
consider configuring a JettyPoolingWorkflowInterceptor
as part of that workflow.
In the adapter configuration file this class is aliased as jetty-message-consumer which is the preferred alternative to the fully qualified classname when building your configuration.
BasicJettyConsumer.BasicServlet, BasicJettyConsumer.HttpOperation
log
Constructor and Description |
---|
JettyMessageConsumer() |
Modifier and Type | Method and Description |
---|---|
AdaptrisMessage |
createMessage(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Create an AdaptrisMessage from the incoming servlet request and response.
|
java.lang.Boolean |
getCheckCharset()
Whether or not to check the character encoding on the request
|
HeaderHandler<javax.servlet.http.HttpServletRequest> |
getHeaderHandler()
What to do with any HTTP headers
|
ParameterHandler<javax.servlet.http.HttpServletRequest> |
getParameterHandler()
What to do with any parameters that are part of the request.
|
void |
setCheckCharset(java.lang.Boolean checkCharset)
Whether or not to check the character encoding on the request
|
void |
setHeaderHandler(HeaderHandler<javax.servlet.http.HttpServletRequest> headerHandler)
What to do with any HTTP headers
|
void |
setParameterHandler(ParameterHandler<javax.servlet.http.HttpServletRequest> parameterHandler)
What to do with any parameters that are part of the request.
|
asServletWrapper, close, consumeLocationKey, ensureIsPath, getAdditionalDebug, getDestination, getMethods, getPath, getSendProcessingInterval, getTimeoutAction, getWarnAfter, init, logHeaders, newThreadName, prepare, servletPath, setAdditionalDebug, setDestination, setMethods, setPath, setSendProcessingInterval, setTimeoutAction, setWarnAfter, start, stop, validMethods, withPath
changeState, registerAdaptrisMessageListener, renameThread, requestClose, requestInit, requestStart, requestStop, retrieveAdaptrisMessageListener, retrieveComponentState
createName, createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueID
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
getUniqueId
createName, createQualifier, isTrackingEndpoint
public AdaptrisMessage createMessage(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
BasicJettyConsumer
createMessage
in class BasicJettyConsumer
request
- the HttpServletRequestresponse
- the HttpServletResponsejava.io.IOException
javax.servlet.ServletException
HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
public ParameterHandler<javax.servlet.http.HttpServletRequest> getParameterHandler()
The default if not explicitly specified is to ignore any parameters and discard them
public void setParameterHandler(ParameterHandler<javax.servlet.http.HttpServletRequest> parameterHandler)
The default if not explicitly specified is to ignore any parameters and discard them
public HeaderHandler<javax.servlet.http.HttpServletRequest> getHeaderHandler()
The default if not explicitly specified is to ignore http headers and discard them
public void setHeaderHandler(HeaderHandler<javax.servlet.http.HttpServletRequest> headerHandler)
The default if not explicitly specified is to ignore http headers and discard them
public java.lang.Boolean getCheckCharset()
This defaults to change true if not explicitly specified. If set to true, then this is the defined behaviour
HttpServletRequest#getCharacterEncoding()
is valid (according to
Charset.forName(String)
) then it is used.HttpServletRequest#getCharacterEncoding
is not supported then the default
content encoding is used, based on your settings for the AdaptrisMessageFactory
instance and CoreConstants.OBJ_METADATA_EXCEPTION
object metadata is populated with a
UnsupportedCharsetException
exception.
If set to false, then InterlokMessage.setContentEncoding(String)
is just invoked with
HttpServletRequest#getCharacterEncoding()
which may cause failures when receiving data
from clients where the supported character sets differs.
public void setCheckCharset(java.lang.Boolean checkCharset)
This defaults to change true if not explicitly specified. If set to true, then this is the defined behaviour
HttpServletRequest#getCharacterEncoding()
is valid (according to
Charset.forName(String)
) then it is used.HttpServletRequest#getCharacterEncoding
is not supported then the default
content encoding is used, based on your settings for the AdaptrisMessageFactory
instance and CoreConstants.OBJ_METADATA_EXCEPTION
object metadata is populated with a
UnsupportedCharsetException
exception.
If set to false, then InterlokMessage.setContentEncoding(String)
is just invoked with
HttpServletRequest#getCharacterEncoding()
which may cause failures when receiving data
from clients where the supported character sets differs.