public class DefaultCometHandler<E> extends Object implements CometHandler<E>
Constructor and Description |
---|
DefaultCometHandler() |
DefaultCometHandler(CometContext<E> cometContext,
Response response) |
Modifier and Type | Method and Description |
---|---|
CometContext<E> |
getCometContext() |
Response |
getResponse() |
void |
onEvent(CometEvent event)
Receive
CometEvent notification. |
void |
onInitialize(CometEvent event)
Receive
CometEvent notification when Grizzly is about to suspend the connection. |
void |
onInterrupt(CometEvent event)
Receive
CometEvent notification when the underlying tcp communication is resumed by Grizzly. |
void |
onTerminate(CometEvent event)
Receive
CometEvent notification when the response is resumed by a CometHandler or by the CometContext |
void |
setCometContext(CometContext<E> cometContext) |
void |
setResponse(Response response) |
public DefaultCometHandler()
public DefaultCometHandler(CometContext<E> cometContext, Response response)
public Response getResponse()
getResponse
in interface CometHandler<E>
public void setResponse(Response response)
setResponse
in interface CometHandler<E>
public CometContext<E> getCometContext()
getCometContext
in interface CometHandler<E>
public void setCometContext(CometContext<E> cometContext)
setCometContext
in interface CometHandler<E>
public void onEvent(CometEvent event) throws IOException
CometHandler
CometEvent
notification. This method will be invoked every time a CometContext.notify(E)
is
invoked. The CometEvent
will contains the message that can be pushed back to the remote client, cached or
ignored. This method can also be used to resume a connection once a notified by invoking CometContext.resumeCometHandler(org.glassfish.grizzly.comet.CometHandler)
.onEvent
in interface CometHandler<E>
IOException
public void onInitialize(CometEvent event) throws IOException
CometHandler
CometEvent
notification when Grizzly is about to suspend the connection. This method is always
invoked during the processing of CometContext.addCometHandler(org.glassfish.grizzly.comet.CometHandler<E>)
operations.onInitialize
in interface CometHandler<E>
IOException
public void onTerminate(CometEvent event) throws IOException
CometHandler
CometEvent
notification when the response is resumed by a CometHandler
or by the CometContext
onTerminate
in interface CometHandler<E>
IOException
public void onInterrupt(CometEvent event) throws IOException
CometHandler
CometEvent
notification when the underlying tcp communication is resumed by Grizzly. This happens
when the CometContext.setExpirationDelay(long)
expires or when the remote client close the connection.onInterrupt
in interface CometHandler<E>
IOException
Copyright © 2015 Oracle Corporation. All rights reserved.