Class JettyMessageConsumer
- java.lang.Object
-
- com.adaptris.core.AdaptrisMessageWorkerImp
-
- com.adaptris.core.AdaptrisMessageConsumerImp
-
- com.adaptris.core.http.jetty.BasicJettyConsumer
-
- com.adaptris.core.http.jetty.JettyMessageConsumer
-
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisMessageConsumer
,AdaptrisMessageWorker
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,StateManagedComponent
@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
This is the standard class that receives documents via HTTP.You should configure the
BasicJettyConsumer.setPath(String)
to contain the URI that should trigger this consumer (e.g./path/to/my/workflow
). The value fromBasicJettyConsumer.setMethods(String)
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 aJettyPoolingWorkflowInterceptor
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.adaptris.core.http.jetty.BasicJettyConsumer
BasicJettyConsumer.BasicServlet, BasicJettyConsumer.HttpOperation
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
log
-
-
Constructor Summary
Constructors Constructor Description JettyMessageConsumer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 requestHeaderHandler<javax.servlet.http.HttpServletRequest>
getHeaderHandler()
What to do with any HTTP headersParameterHandler<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 requestvoid
setHeaderHandler(HeaderHandler<javax.servlet.http.HttpServletRequest> headerHandler)
What to do with any HTTP headersvoid
setParameterHandler(ParameterHandler<javax.servlet.http.HttpServletRequest> parameterHandler)
What to do with any parameters that are part of the request.-
Methods inherited from class com.adaptris.core.http.jetty.BasicJettyConsumer
asServletWrapper, close, consumeLocationKey, ensureIsPath, getAdditionalDebug, getMethods, getPath, getSendProcessingInterval, getTimeoutAction, getWarnAfter, init, logHeaders, prepare, servletPath, setAdditionalDebug, setMethods, setPath, setSendProcessingInterval, setTimeoutAction, setWarnAfter, start, stop, validMethods, withPath
-
Methods inherited from class com.adaptris.core.AdaptrisMessageConsumerImp
changeState, newThreadName, registerAdaptrisMessageListener, renameThread, requestClose, requestInit, requestStart, requestStop, retrieveAdaptrisMessageListener, retrieveComponentState
-
Methods inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
createName, createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueID
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueId
-
Methods inherited from interface com.adaptris.core.AdaptrisMessageWorker
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createName, createQualifier, isTrackingEndpoint
-
-
-
-
Method Detail
-
createMessage
public AdaptrisMessage createMessage(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
Description copied from class:BasicJettyConsumer
Create an AdaptrisMessage from the incoming servlet request and response.- Specified by:
createMessage
in classBasicJettyConsumer
- Parameters:
request
- the HttpServletRequestresponse
- the HttpServletResponse- Returns:
- an AdaptrisMessage instance.
- Throws:
java.io.IOException
javax.servlet.ServletException
- See Also:
HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
-
getParameterHandler
public ParameterHandler<javax.servlet.http.HttpServletRequest> getParameterHandler()
What to do with any parameters that are part of the request.The default if not explicitly specified is to ignore any parameters and discard them
-
setParameterHandler
public void setParameterHandler(ParameterHandler<javax.servlet.http.HttpServletRequest> parameterHandler)
What to do with any parameters that are part of the request.The default if not explicitly specified is to ignore any parameters and discard them
-
getHeaderHandler
public HeaderHandler<javax.servlet.http.HttpServletRequest> getHeaderHandler()
What to do with any HTTP headersThe default if not explicitly specified is to ignore http headers and discard them
-
setHeaderHandler
public void setHeaderHandler(HeaderHandler<javax.servlet.http.HttpServletRequest> headerHandler)
What to do with any HTTP headersThe default if not explicitly specified is to ignore http headers and discard them
-
getCheckCharset
public java.lang.Boolean getCheckCharset()
Whether or not to check the character encoding on the requestThis defaults to change true if not explicitly specified. If set to true, then this is the defined behaviour
- If the
HttpServletRequest#getCharacterEncoding()
is valid (according toCharset.forName(String)
) then it is used. - If the
HttpServletRequest#getCharacterEncoding
is not supported then the default content encoding is used, based on your settings for theAdaptrisMessageFactory
instance andCoreConstants.OBJ_METADATA_EXCEPTION
object metadata is populated with aUnsupportedCharsetException
exception.
If set to false, then
InterlokMessage.setContentEncoding(String)
is just invoked withHttpServletRequest#getCharacterEncoding()
which may cause failures when receiving data from clients where the supported character sets differs. - If the
-
setCheckCharset
public void setCheckCharset(java.lang.Boolean checkCharset)
Whether or not to check the character encoding on the requestThis defaults to change true if not explicitly specified. If set to true, then this is the defined behaviour
- If the
HttpServletRequest#getCharacterEncoding()
is valid (according toCharset.forName(String)
) then it is used. - If the
HttpServletRequest#getCharacterEncoding
is not supported then the default content encoding is used, based on your settings for theAdaptrisMessageFactory
instance andCoreConstants.OBJ_METADATA_EXCEPTION
object metadata is populated with aUnsupportedCharsetException
exception.
If set to false, then
InterlokMessage.setContentEncoding(String)
is just invoked withHttpServletRequest#getCharacterEncoding()
which may cause failures when receiving data from clients where the supported character sets differs. - If the
-
-