Class WebClient

java.lang.Object
org.apache.activemq.web.WebClient
All Implemented Interfaces:
jakarta.servlet.http.HttpSessionActivationListener, jakarta.servlet.http.HttpSessionBindingListener, Externalizable, Serializable, EventListener
Direct Known Subclasses:
AjaxWebClient

public class WebClient extends Object implements jakarta.servlet.http.HttpSessionActivationListener, jakarta.servlet.http.HttpSessionBindingListener, Externalizable
Represents a messaging client used from inside a web container typically stored inside a HttpSession TODO controls to prevent DOS attacks with users requesting many consumers TODO configure consumers with small prefetch.
See Also:
  • Field Details

  • Constructor Details

    • WebClient

      public WebClient()
  • Method Details

    • getWebClient

      public static WebClient getWebClient(jakarta.servlet.http.HttpServletRequest request)
      Helper method to get the client for the current session, lazily creating a client if there is none currently
      Parameters:
      request - is the current HTTP request
      Returns:
      the current client or a newly creates
    • getWebClient

      public static WebClient getWebClient(jakarta.servlet.http.HttpSession session)
      Returns:
      the web client for the current HTTP session or null if there is not a web client created yet
    • initContext

      public static void initContext(jakarta.servlet.ServletContext context)
    • getDeliveryMode

      public int getDeliveryMode()
    • setDeliveryMode

      public void setDeliveryMode(int deliveryMode)
    • getUsername

      public String getUsername()
    • setUsername

      public void setUsername(String username)
    • getPassword

      public String getPassword()
    • setPassword

      public void setPassword(String password)
    • closeConsumers

      public void closeConsumers()
    • close

      public void close()
    • isClosed

      public boolean isClosed()
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
      ClassNotFoundException
    • send

      public void send(jakarta.jms.Destination destination, jakarta.jms.Message message) throws jakarta.jms.JMSException
      Throws:
      jakarta.jms.JMSException
    • send

      public void send(jakarta.jms.Destination destination, jakarta.jms.Message message, boolean persistent, int priority, long timeToLive) throws jakarta.jms.JMSException
      Throws:
      jakarta.jms.JMSException
    • getSession

      public jakarta.jms.Session getSession() throws jakarta.jms.JMSException
      Throws:
      jakarta.jms.JMSException
    • getConnection

      public jakarta.jms.Connection getConnection() throws jakarta.jms.JMSException
      Throws:
      jakarta.jms.JMSException
    • initConnectionFactory

      protected static void initConnectionFactory(jakarta.servlet.ServletContext servletContext)
    • getProducer

      public jakarta.jms.MessageProducer getProducer() throws jakarta.jms.JMSException
      Throws:
      jakarta.jms.JMSException
    • setProducer

      public void setProducer(jakarta.jms.MessageProducer producer)
    • getConsumer

      public jakarta.jms.MessageConsumer getConsumer(jakarta.jms.Destination destination, String selector) throws jakarta.jms.JMSException
      Throws:
      jakarta.jms.JMSException
    • getConsumer

      public jakarta.jms.MessageConsumer getConsumer(jakarta.jms.Destination destination, String selector, boolean create) throws jakarta.jms.JMSException
      Throws:
      jakarta.jms.JMSException
    • closeConsumer

      public void closeConsumer(jakarta.jms.Destination destination) throws jakarta.jms.JMSException
      Throws:
      jakarta.jms.JMSException
    • getConsumers

      public List<jakarta.jms.MessageConsumer> getConsumers()
    • createSession

      protected jakarta.jms.Session createSession() throws jakarta.jms.JMSException
      Throws:
      jakarta.jms.JMSException
    • getSemaphore

      public Semaphore getSemaphore()
    • sessionWillPassivate

      public void sessionWillPassivate(jakarta.servlet.http.HttpSessionEvent event)
      Specified by:
      sessionWillPassivate in interface jakarta.servlet.http.HttpSessionActivationListener
    • sessionDidActivate

      public void sessionDidActivate(jakarta.servlet.http.HttpSessionEvent event)
      Specified by:
      sessionDidActivate in interface jakarta.servlet.http.HttpSessionActivationListener
    • valueBound

      public void valueBound(jakarta.servlet.http.HttpSessionBindingEvent event)
      Specified by:
      valueBound in interface jakarta.servlet.http.HttpSessionBindingListener
    • valueUnbound

      public void valueUnbound(jakarta.servlet.http.HttpSessionBindingEvent event)
      Specified by:
      valueUnbound in interface jakarta.servlet.http.HttpSessionBindingListener
    • createWebClient

      protected static WebClient createWebClient(jakarta.servlet.http.HttpServletRequest request)