Package org.apache.activemq.web
Class MessageServletSupport
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.apache.activemq.web.MessageServletSupport
-
- All Implemented Interfaces:
Serializable
,Servlet
,ServletConfig
- Direct Known Subclasses:
MessageListenerServlet
,MessageServlet
,PortfolioPublishServlet
public abstract class MessageServletSupport extends 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MessageServletSupport()
-
Method Summary
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
-
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
-
-
-
Method Detail
-
init
public void init(ServletConfig servletConfig) throws ServletException
- Specified by:
init
in interfaceServlet
- Overrides:
init
in classGenericServlet
- Throws:
ServletException
-
asBoolean
public static boolean asBoolean(String param)
-
asBoolean
public static boolean asBoolean(String param, boolean defaultValue)
-
appendParametersToMessage
protected void appendParametersToMessage(HttpServletRequest request, TextMessage message) throws JMSException
- Throws:
JMSException
-
getSendTimeToLive
protected long getSendTimeToLive(HttpServletRequest request)
-
getSendPriority
protected int getSendPriority(HttpServletRequest request)
-
isSendPersistent
protected boolean isSendPersistent(HttpServletRequest request)
-
isSync
protected boolean isSync(HttpServletRequest request)
-
asDestination
protected Destination asDestination(Object value)
-
asLong
protected long asLong(String name)
-
asInt
protected int asInt(String name)
-
getDestination
protected Destination getDestination(WebClient client, HttpServletRequest request) throws JMSException
- Returns:
- the destination to use for the current request
- Throws:
JMSException
-
getDestinationFromURI
protected Destination getDestinationFromURI(WebClient client, HttpServletRequest request) throws 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:
JMSException
-
getDestination
protected Destination getDestination(WebClient client, HttpServletRequest request, String destinationName) throws JMSException
- Returns:
- the Destination object for the given destination name
- Throws:
JMSException
-
isTopic
protected boolean isTopic(HttpServletRequest request)
- Returns:
- true if the current request is for a topic destination, else false if its for a queue
-
getPostedMessageBody
protected String getPostedMessageBody(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
protected String getSelector(HttpServletRequest request) throws IOException
- Throws:
IOException
-
-