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
FieldsModifier and TypeFieldDescriptionprotected final ClientSessionprotected static final intThe maximum number of messages to be sent in one poll-response.protected static final intThe maximum amount ofLongpolls allowed by one client.protected static final intThe maximum size of the messages to be sent in one poll-response. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intCopied fromServletInputStream.readLine(byte[], int, int)protected voidreceiveAndDispatchIncomingMessages(jakarta.servlet.http.HttpServletRequest request) Reads messages of a request line by line until the end of the stream has been reached.abstract voidshutdown()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, waitMethods 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_POLLSThe maximum amount ofLongpolls allowed by one client.- See Also:
-
MAX_MESSAGE_COUNT
protected static final int MAX_MESSAGE_COUNTThe maximum number of messages to be sent in one poll-response.- See Also:
-
MAX_RESPONSE_SIZE
protected static final int MAX_RESPONSE_SIZEThe maximum size of the messages to be sent in one poll-response.- See Also:
-
client
-
-
Constructor Details
-
AbstractTransportSession
-
-
Method Details
-
readLine
Copied fromServletInputStream.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 readoff- an integer specifying the character at which this method begins readinglen- an integer specifying the maximum number of bytes to readin- 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 appropriateClientSessionif they don't have a logical dependency to the protocol:- "c" leads to a shutdown of the longpoll session.
- An empty message is used as a heart beat message
- The sizeof a message is greater then the
AbstractTransportServlet.getMaxMessageSize()bytes
- 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 thenAbstractTransportServlet.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.TransportSessionPerform a server-initiated shutdown of the transport session.- Specified by:
shutdownin interfacecom.levigo.jadice.web.transport.server.session.internal.TransportSession
-