Class BasicJettyConsumer
- java.lang.Object
-
- com.adaptris.core.AdaptrisMessageWorkerImp
-
- com.adaptris.core.AdaptrisMessageConsumerImp
-
- com.adaptris.core.http.jetty.BasicJettyConsumer
-
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisMessageConsumer
,AdaptrisMessageWorker
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,StateManagedComponent
- Direct Known Subclasses:
JettyMessageConsumer
public abstract class BasicJettyConsumer extends AdaptrisMessageConsumerImp
This is the abstract class for all implementations that make use of Jetty to receive messages.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
BasicJettyConsumer.BasicServlet
static interface
BasicJettyConsumer.HttpOperation
-
Field Summary
-
Fields inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
log
-
-
Constructor Summary
Constructors Constructor Description BasicJettyConsumer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected ServletWrapper
asServletWrapper()
void
close()
Closes the component.java.lang.String
consumeLocationKey()
Provides the metadata key '"jettyURI"' that contains the URI which triggered the consumer.abstract AdaptrisMessage
createMessage(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Create an AdaptrisMessage from the incoming servlet request and response.protected java.lang.String
ensureIsPath(java.lang.String s)
java.lang.Boolean
getAdditionalDebug()
java.lang.String
getMethods()
Comma separated string of valid methods.java.lang.String
getPath()
The path we register against jetty for this consumerTimeInterval
getSendProcessingInterval()
TimeoutAction
getTimeoutAction()
TimeInterval
getWarnAfter()
void
init()
Initialises the component.protected void
logHeaders(javax.servlet.http.HttpServletRequest req)
void
prepare()
Prepare for initialisation.protected java.lang.String
servletPath()
void
setAdditionalDebug(java.lang.Boolean additionalDebug)
void
setMethods(java.lang.String methods)
Comma separated string of valid methods.void
setPath(java.lang.String path)
The path we register against jetty for this consumervoid
setSendProcessingInterval(TimeInterval t)
If required send a 102 upon this interval.void
setTimeoutAction(TimeoutAction action)
Set the behaviour that should occur when the workflow takes too long to finish.void
setWarnAfter(TimeInterval t)
Log a warning after this interval.void
start()
Starts the component.void
stop()
Stop the componentprotected java.lang.String
validMethods()
<T extends BasicJettyConsumer>
TwithPath(java.lang.String path)
-
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
-
servletPath
protected java.lang.String servletPath()
-
validMethods
protected java.lang.String validMethods()
-
prepare
public void prepare() throws CoreException
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Throws:
CoreException
-
createMessage
public abstract AdaptrisMessage createMessage(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
Create an AdaptrisMessage from the incoming servlet request and response.- 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)
-
logHeaders
protected void logHeaders(javax.servlet.http.HttpServletRequest req)
-
asServletWrapper
protected ServletWrapper asServletWrapper() throws CoreException
- Throws:
CoreException
-
ensureIsPath
protected java.lang.String ensureIsPath(java.lang.String s) throws CoreException
- Throws:
CoreException
-
init
public void init() throws CoreException
Description copied from interface:ComponentLifecycle
Initialises the component.Component initialisation includes config verification, creation of connections etc.
- Throws:
CoreException
- wrapping any underlyingException
s- See Also:
ComponentLifecycle.init()
-
start
public void start() throws CoreException
Description copied from interface:ComponentLifecycle
Starts the component.Once a component is started it should be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling start will begin message delivery.- Throws:
CoreException
- wrapping any underlyingException
s- See Also:
ComponentLifecycle.start()
-
stop
public void stop()
Description copied from interface:ComponentLifecycle
Stop the componentA stopped component is not expected to be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling stop will pause message delivery. Throwing aRuntimeException
may cause unintended consequences- See Also:
ComponentLifecycle.stop()
-
close
public void close()
Description copied from interface:ComponentLifecycle
Closes the component.A closed component should release any connections it uses, etc. and clean up completely. Throwing a
RuntimeException
may cause unintended consequences- See Also:
ComponentLifecycle.close()
-
getTimeoutAction
public TimeoutAction getTimeoutAction()
-
setTimeoutAction
public void setTimeoutAction(TimeoutAction action)
Set the behaviour that should occur when the workflow takes too long to finish.This setting only has an impact if the consumer is the entry point for a
PoolingWorkflow
instance. In the event that the wait time is exceeded, then the behaviour specified here is done.- Parameters:
action
- the action; default is a 202 after 10 minutes.
-
getAdditionalDebug
public java.lang.Boolean getAdditionalDebug()
-
setAdditionalDebug
public void setAdditionalDebug(java.lang.Boolean additionalDebug)
-
getWarnAfter
public TimeInterval getWarnAfter()
- Returns:
- the warnAfter
-
setWarnAfter
public void setWarnAfter(TimeInterval t)
Log a warning after this interval.- Parameters:
t
- the warnAfter to set, default is to never warn.
-
getSendProcessingInterval
public TimeInterval getSendProcessingInterval()
- Returns:
- the sendExpectEvery
-
setSendProcessingInterval
public void setSendProcessingInterval(TimeInterval t)
If required send a 102 upon this interval.- Parameters:
t
- the sendExpectEvery to set, default is 20 seconds.
-
consumeLocationKey
public java.lang.String consumeLocationKey()
Provides the metadata key '"jettyURI"' that contains the URI which triggered the consumer.- Returns:
- the metadata key;
- Since:
- 3.9.0
-
withPath
public <T extends BasicJettyConsumer> T withPath(java.lang.String path)
-
getPath
public java.lang.String getPath()
The path we register against jetty for this consumer
-
setPath
public void setPath(java.lang.String path)
The path we register against jetty for this consumer
-
getMethods
public java.lang.String getMethods()
Comma separated string of valid methods.
-
setMethods
public void setMethods(java.lang.String methods)
Comma separated string of valid methods.
-
-