Class AbstractTransportServlet.AbstractTransportSession

java.lang.Object
com.levigo.jadice.web.transport.server.networking.AbstractTransportServlet.AbstractTransportSession
All Implemented Interfaces:
com.levigo.jadice.web.transport.server.session.internal.TransportSession
Direct Known Subclasses:
LongpollTransportServlet.LongpollSession
Enclosing class:
AbstractTransportServlet<T extends com.levigo.jadice.web.transport.server.session.internal.TransportSession>

public abstract class AbstractTransportServlet.AbstractTransportSession extends Object implements com.levigo.jadice.web.transport.server.session.internal.TransportSession
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final ClientSession
     
    protected static final int
    The maximum number of messages to be sent in one poll-response.
    protected static final int
    The maximum amount of Longpolls allowed by one client.
    protected static final int
    The maximum size of the messages to be sent in one poll-response.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected int
    readLine(byte[] b, int off, int len, Reader in)
    Copied from ServletInputStream.readLine(byte[], int, int)
    protected void
    receiveAndDispatchIncomingMessages(jakarta.servlet.http.HttpServletRequest request)
    Reads messages of a request line by line until the end of the stream has been reached.
    abstract void
    Perform a server-initiated shutdown of the transport session.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.levigo.jadice.web.transport.server.session.internal.TransportSession

    dispatch, getMethod
  • Field Details

    • MAX_PENDING_POLLS

      protected static final int MAX_PENDING_POLLS
      The maximum amount of Longpolls allowed by one client.
      See Also:
    • MAX_MESSAGE_COUNT

      protected static final int MAX_MESSAGE_COUNT
      The maximum number of messages to be sent in one poll-response.
      See Also:
    • MAX_RESPONSE_SIZE

      protected static final int MAX_RESPONSE_SIZE
      The maximum size of the messages to be sent in one poll-response.
      See Also:
    • client

      protected final ClientSession client
  • Constructor Details

    • AbstractTransportSession

      public AbstractTransportSession(ClientSession client)
  • Method Details

    • readLine

      protected int readLine(byte[] b, int off, int len, Reader in) throws IOException
      Copied from ServletInputStream.readLine(byte[], int, int)

      Reads the reader, one line at a time. Starting at an offset, reads bytes into an array, until it reads a certain number of bytes or reaches a newline character, which it reads into the array as well.

      This method returns -1 if it reaches the end of the input stream before reading the maximum number of bytes.

      Parameters:
      b - an array of bytes into which data is read
      off - an integer specifying the character at which this method begins reading
      len - an integer specifying the maximum number of bytes to read
      in - the Reader to read from
      Returns:
      an integer specifying the actual number of bytes read, or -1 if the end of the stream is reached
      Throws:
      IOException - if an input or output exception has occurred
    • receiveAndDispatchIncomingMessages

      protected void receiveAndDispatchIncomingMessages(jakarta.servlet.http.HttpServletRequest request) throws jakarta.servlet.ServletException, IOException
      Reads messages of a request line by line until the end of the stream has been reached. Each message gets evaluated and redirected to the appropriate ClientSession if they don't have a logical dependency to the protocol:
      Parameters:
      request - The servlet request.
      Throws:
      IOException - If an error occurred trying to read the request message.
      jakarta.servlet.ServletException - When the size of the message received is greater then AbstractTransportServlet.getMaxMessageSize() bytes or if the message was incomplete.
    • shutdown

      public abstract void shutdown()
      Description copied from interface: com.levigo.jadice.web.transport.server.session.internal.TransportSession
      Perform a server-initiated shutdown of the transport session.
      Specified by:
      shutdown in interface com.levigo.jadice.web.transport.server.session.internal.TransportSession