Class SilverpeasServerSentEventServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.silverpeas.core.web.mvc.webcomponent.SilverpeasHttpServlet
-
- org.silverpeas.core.web.mvc.webcomponent.SilverpeasAuthenticatedHttpServlet
-
- org.silverpeas.core.webapi.notification.sse.SilverpeasServerSentEventServlet
-
- All Implemented Interfaces:
Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
- Direct Known Subclasses:
CommonServerSentEventServlet
public abstract class SilverpeasServerSentEventServlet extends SilverpeasAuthenticatedHttpServlet
This abstraction defines the behavior the Servlets in charge of responding to EventSource JavaScript API must have.
Finally, adding a new URI to handle EventSource needs to extends this class and to parametrize the mapping! (seeCommonServerSentEventServlet
as an example)- Author:
- Yohann Chastagnier
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.silverpeas.core.web.mvc.webcomponent.SilverpeasHttpServlet
SilverpeasHttpServlet.HttpError, SilverpeasHttpServlet.UserSessionStatus
-
-
Constructor Summary
Constructors Constructor Description SilverpeasServerSentEventServlet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Default Methods Modifier and Type Method Description protected void
doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse response)
static boolean
isSseRequest(javax.servlet.http.HttpServletRequest request)
Indicates if the given request is an SSE one.default void
prepareEventsOnOpening(org.silverpeas.core.webapi.notification.sse.SilverpeasServerEventWebAccess.WebAccessContext wac, Long initialLastServerEventId)
default void
send(org.silverpeas.core.webapi.notification.sse.SilverpeasServerEventWebAccess.WebAccessContext wac, SilverpeasServerEventContext context)
-
Methods inherited from class org.silverpeas.core.web.mvc.webcomponent.SilverpeasAuthenticatedHttpServlet
getMainSessionController, getSessionInfo, getSynchronizerTokenService, renewSessionSecurityToken, service, throwUserSessionExpiration
-
Methods inherited from class org.silverpeas.core.web.mvc.webcomponent.SilverpeasHttpServlet
existOpenedUserSession, forbidden, notFound, preconditionFailed, redirectOrForwardService, sendError, sendError, throwHttpForbiddenError, throwHttpForbiddenError, throwHttpNotFoundError, throwHttpNotFoundError, throwHttpPreconditionFailedError, throwHttpPreconditionFailedError
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
-
-
-
-
Method Detail
-
isSseRequest
public static boolean isSseRequest(javax.servlet.http.HttpServletRequest request)
Indicates if the given request is an SSE one.If the servlet has not been called at least one time, this method will always return true, even if the request is an SSE one
- Parameters:
request
- the request to check.- Returns:
- true if an SSE one, false otherwise.
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse response)
- Overrides:
doGet
in classjavax.servlet.http.HttpServlet
-
prepareEventsOnOpening
public default void prepareEventsOnOpening(org.silverpeas.core.webapi.notification.sse.SilverpeasServerEventWebAccess.WebAccessContext wac, Long initialLastServerEventId)
-
send
public default void send(org.silverpeas.core.webapi.notification.sse.SilverpeasServerEventWebAccess.WebAccessContext wac, SilverpeasServerEventContext context) throws IOException
- Throws:
IOException
-
-