Package org.apache.activemq.web
Class MessageServletSupport
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.apache.activemq.web.MessageServletSupport
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
- Direct Known Subclasses:
MessageListenerServlet,MessageServlet,PortfolioPublishServlet
public abstract class MessageServletSupport
extends jakarta.servlet.http.HttpServlet
A useful base class for any JMS related servlet; there are various ways to
map JMS operations to web requests so we put most of the common behaviour in
a reusable base class. This servlet can be configured with the following init
parameters
- topic
- Set to 'true' if the servlet should default to using topics rather than channels
- destination
- The default destination to use if one is not specifiied
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappendParametersToMessage(jakarta.servlet.http.HttpServletRequest request, jakarta.jms.TextMessage message) static booleanstatic booleanprotected jakarta.jms.DestinationasDestination(Object value) protected intprotected Integerprotected Longprotected longprotected Stringprotected jakarta.jms.DestinationgetDestination(WebClient client, jakarta.servlet.http.HttpServletRequest request) protected jakarta.jms.DestinationgetDestination(WebClient client, jakarta.servlet.http.HttpServletRequest request, String destinationName) protected jakarta.jms.DestinationgetDestinationFromURI(WebClient client, jakarta.servlet.http.HttpServletRequest request) protected StringgetPostedMessageBody(jakarta.servlet.http.HttpServletRequest request) protected StringgetSelector(jakarta.servlet.http.HttpServletRequest request) protected intgetSendPriority(jakarta.servlet.http.HttpServletRequest request) protected longgetSendTimeToLive(jakarta.servlet.http.HttpServletRequest request) voidinit(jakarta.servlet.ServletConfig servletConfig) protected booleanisSendPersistent(jakarta.servlet.http.HttpServletRequest request) protected booleanisSync(jakarta.servlet.http.HttpServletRequest request) protected booleanisTopic(jakarta.servlet.http.HttpServletRequest request) Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
MessageServletSupport
public MessageServletSupport()
-
-
Method Details
-
init
public void init(jakarta.servlet.ServletConfig servletConfig) throws jakarta.servlet.ServletException - Specified by:
initin interfacejakarta.servlet.Servlet- Overrides:
initin classjakarta.servlet.GenericServlet- Throws:
jakarta.servlet.ServletException
-
asBoolean
-
asBoolean
-
appendParametersToMessage
protected void appendParametersToMessage(jakarta.servlet.http.HttpServletRequest request, jakarta.jms.TextMessage message) throws jakarta.jms.JMSException - Throws:
jakarta.jms.JMSException
-
getSendTimeToLive
protected long getSendTimeToLive(jakarta.servlet.http.HttpServletRequest request) -
getSendPriority
protected int getSendPriority(jakarta.servlet.http.HttpServletRequest request) -
isSendPersistent
protected boolean isSendPersistent(jakarta.servlet.http.HttpServletRequest request) -
isSync
protected boolean isSync(jakarta.servlet.http.HttpServletRequest request) -
asDestination
-
asInteger
-
asLong
-
asLong
-
asInt
-
asString
-
getDestination
protected jakarta.jms.Destination getDestination(WebClient client, jakarta.servlet.http.HttpServletRequest request) throws jakarta.jms.JMSException - Returns:
- the destination to use for the current request
- Throws:
jakarta.jms.JMSException
-
getDestinationFromURI
protected jakarta.jms.Destination getDestinationFromURI(WebClient client, jakarta.servlet.http.HttpServletRequest request) throws jakarta.jms.JMSException - Returns:
- the destination to use for the current request using the relative URI from where this servlet was invoked as the destination name
- Throws:
jakarta.jms.JMSException
-
getDestination
protected jakarta.jms.Destination getDestination(WebClient client, jakarta.servlet.http.HttpServletRequest request, String destinationName) throws jakarta.jms.JMSException - Returns:
- the Destination object for the given destination name
- Throws:
jakarta.jms.JMSException
-
isTopic
protected boolean isTopic(jakarta.servlet.http.HttpServletRequest request) - Returns:
- true if the current request is for a topic destination, else false if its for a queue
-
getPostedMessageBody
protected String getPostedMessageBody(jakarta.servlet.http.HttpServletRequest request) throws IOException - Returns:
- the text that was posted to the servlet which is used as the body of the message to be sent
- Throws:
IOException
-
getSelector
- Throws:
IOException
-