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, javax.servlet.Servlet, javax.servlet.ServletConfig
- Direct Known Subclasses:
- MessageListenerServlet, MessageServlet, PortfolioPublishServlet
public abstract class MessageServletSupport
- extends javax.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 paramters
- topic
- Set to 'true' if the servle should default to using topics rather than channels
- destination
- The default destination to use if one is not specifiied
- Version:
- $Revision: 1.1.1.1 $
- See Also:
- Serialized Form
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 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MessageServletSupport
public MessageServletSupport()
init
public void init(javax.servlet.ServletConfig servletConfig)
throws javax.servlet.ServletException
- Specified by:
init
in interface javax.servlet.Servlet
- Overrides:
init
in class javax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
asBoolean
public static boolean asBoolean(String param)
asBoolean
public static boolean asBoolean(String param,
boolean defaultValue)
appendParametersToMessage
protected void appendParametersToMessage(javax.servlet.http.HttpServletRequest request,
javax.jms.TextMessage message)
throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
getSendTimeToLive
protected long getSendTimeToLive(javax.servlet.http.HttpServletRequest request)
getSendPriority
protected int getSendPriority(javax.servlet.http.HttpServletRequest request)
isSendPersistent
protected boolean isSendPersistent(javax.servlet.http.HttpServletRequest request)
asDestination
protected javax.jms.Destination asDestination(Object value)
asInteger
protected Integer asInteger(Object value)
asLong
protected Long asLong(Object value)
asLong
protected long asLong(String name)
asInt
protected int asInt(String name)
asString
protected String asString(Object value)
getDestination
protected javax.jms.Destination getDestination(WebClient client,
javax.servlet.http.HttpServletRequest request)
throws javax.jms.JMSException
- Returns:
- the destination to use for the current request
- Throws:
javax.jms.JMSException
getDestinationFromURI
protected javax.jms.Destination getDestinationFromURI(WebClient client,
javax.servlet.http.HttpServletRequest request)
throws javax.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:
javax.jms.JMSException
getDestination
protected javax.jms.Destination getDestination(WebClient client,
javax.servlet.http.HttpServletRequest request,
String destinationName)
throws javax.jms.JMSException
- Returns:
- the Destination object for the given destination name
- Throws:
javax.jms.JMSException
isTopic
protected boolean isTopic(javax.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(javax.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
Copyright © 2011 Apache Software Foundation. All Rights Reserved.