Class 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 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 Detail

      • MessageServletSupport

        public MessageServletSupport()
    • Method Detail

      • 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)
      • isSync

        protected boolean isSync​(javax.servlet.http.HttpServletRequest request)
      • asDestination

        protected javax.jms.Destination asDestination​(Object value)
      • asLong

        protected Long asLong​(Object value)
      • asLong

        protected long asLong​(String name)
      • asInt

        protected int asInt​(String name)
      • 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