Class AbstractTransportServlet<T extends com.levigo.jadice.web.transport.server.session.internal.TransportSession>
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
com.levigo.jadice.web.transport.server.networking.AbstractTransportServlet<T>
- Type Parameters:
T- theTransportSessionimplementation
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
- Direct Known Subclasses:
EventStreamServlet,LongpollTransportServlet
public abstract class AbstractTransportServlet<T extends com.levigo.jadice.web.transport.server.session.internal.TransportSession>
extends jakarta.servlet.http.HttpServlet
The AbstractTransportServlet defines the basic behavior of transport servlet.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ScheduledExecutorServiceprotected com.levigo.jadice.web.transport.server.session.internal.TransportManagerInternalFields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
ConstructorsConstructorDescriptionAbstractTransportServlet(com.levigo.jadice.web.transport.server.session.internal.TransportManagerInternal transportManager) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigureNoCache(jakarta.servlet.http.HttpServletResponse response) Sets the header field "Cache-Control" to "no-cache".protected voidconfigureResponse(jakarta.servlet.http.HttpServletResponse response) Sets the content type to "text/plain" and the corresponding character encoding of aHttpServletResponse, to "UTF-8".protected abstract TcreateTransportSession(ClientSession clientSession) Creates a new transport session of the typeTfor the givenClientSession.voiddestroy()protected com.levigo.jadice.web.transport.server.internal.config.ConnectionConfigurationprotected intDeprecated.only to be used in tests!protected TgetTransportSession(String clientId, Class<T> sessionClass) Gets a transport session for a given client and concreteTransportSessionimplementation.voidinit(jakarta.servlet.ServletConfig config) protected voidservice(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, serviceMethods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Field Details
-
transportManager
protected com.levigo.jadice.web.transport.server.session.internal.TransportManagerInternal transportManager -
timerService
-
-
Constructor Details
-
AbstractTransportServlet
public AbstractTransportServlet() -
AbstractTransportServlet
public AbstractTransportServlet(com.levigo.jadice.web.transport.server.session.internal.TransportManagerInternal transportManager)
-
-
Method Details
-
getMaxMessageSize
Deprecated.only to be used in tests!The maximum possible size of a message in bytes. -
init
public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException - Specified by:
initin interfacejakarta.servlet.Servlet- Overrides:
initin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletException
-
getConfig
protected com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration getConfig() -
configureNoCache
protected void configureNoCache(jakarta.servlet.http.HttpServletResponse response) Sets the header field "Cache-Control" to "no-cache".- Parameters:
response- The http servlet response to modify.
-
configureResponse
protected void configureResponse(jakarta.servlet.http.HttpServletResponse response) Sets the content type to "text/plain" and the corresponding character encoding of aHttpServletResponse, to "UTF-8".- Parameters:
response- the http servlet response to modify
-
createTransportSession
Creates a new transport session of the typeTfor the givenClientSession.- Parameters:
clientSession- The client session to create a transport session for.- Returns:
- The newly created transport session.
-
destroy
public void destroy()- Specified by:
destroyin interfacejakarta.servlet.Servlet- Overrides:
destroyin classjakarta.servlet.GenericServlet
-
getTransportSession
Gets a transport session for a given client and concreteTransportSessionimplementation.- If the transport session implementation is the same as the current transport session for the client, the current one is returned.
- If the transport session is another session as the current transport session, the session gets changed to the new one and is returned.
- If no transport session was set yet, a new session is set for the client and is returned.
- Parameters:
clientId- the identifier of the client to get the transport session forsessionClass- the TransportSession implementation to get session for- Returns:
- the transport session for the given client and transport session implementation
-
service
protected void service(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException - Overrides:
servicein classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-