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 void
appendParametersToMessage
(jakarta.servlet.http.HttpServletRequest request, jakarta.jms.TextMessage message) static boolean
static boolean
protected jakarta.jms.Destination
asDestination
(Object value) protected int
protected Integer
protected Long
protected long
protected String
protected jakarta.jms.Destination
getDestination
(WebClient client, jakarta.servlet.http.HttpServletRequest request) protected jakarta.jms.Destination
getDestination
(WebClient client, jakarta.servlet.http.HttpServletRequest request, String destinationName) protected jakarta.jms.Destination
getDestinationFromURI
(WebClient client, jakarta.servlet.http.HttpServletRequest request) protected String
getPostedMessageBody
(jakarta.servlet.http.HttpServletRequest request) protected String
getSelector
(jakarta.servlet.http.HttpServletRequest request) protected int
getSendPriority
(jakarta.servlet.http.HttpServletRequest request) protected long
getSendTimeToLive
(jakarta.servlet.http.HttpServletRequest request) void
init
(jakarta.servlet.ServletConfig servletConfig) protected boolean
isSendPersistent
(jakarta.servlet.http.HttpServletRequest request) protected boolean
isSync
(jakarta.servlet.http.HttpServletRequest request) protected boolean
isTopic
(jakarta.servlet.http.HttpServletRequest request) Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
Methods 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:
init
in interfacejakarta.servlet.Servlet
- Overrides:
init
in 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
-