org.codehaus.activemq.web
Class MessageServletSupport
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.codehaus.activemq.web.MessageServletSupport
- All Implemented Interfaces:
- Serializable, Servlet, ServletConfig
- Direct Known Subclasses:
- MessageServlet
- 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.
- Version:
- $Revision: 1.9 $
- See Also:
- Serialized Form
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(ServletConfig servletConfig)
throws ServletException
- Throws:
ServletException
createWebClient
protected WebClient createWebClient(HttpServletRequest request)
asBoolean
public static boolean asBoolean(String param)
getWebClient
protected WebClient getWebClient(HttpServletRequest request)
- Helper method to get the client for the current session
- Parameters:
request
- is the current HTTP request
- Returns:
- the current client or a newly creates
appendParametersToMessage
protected void appendParametersToMessage(HttpServletRequest request,
TextMessage message)
throws JMSException
- Throws:
JMSException
getDestination
protected Destination getDestination(WebClient client,
HttpServletRequest request)
throws JMSException,
NoDestinationSuppliedException
- Returns:
- the destination to use for the current request
- Throws:
JMSException
NoDestinationSuppliedException
getDestinationFromURI
protected Destination getDestinationFromURI(WebClient client,
HttpServletRequest request)
throws NoDestinationSuppliedException,
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:
NoDestinationSuppliedException
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
asLong
protected long asLong(String name)
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
Copyright © 2004 Protique, Ltd.. All Rights Reserved.