|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.grizzly.comet.handlers.ReflectorCometHandler
public class ReflectorCometHandler
Simple CometHandler
that write (using a PrintWriter
)
all messages (CometEvent.attachment
it receive. This CometHandler
just reflect everything, without filtering, the result of a {@link CometContext#notify).
Field Summary | |
---|---|
protected PrintWriter |
printWriter
|
Constructor Summary | |
---|---|
ReflectorCometHandler()
Create a reflector. |
|
ReflectorCometHandler(boolean useStreaming)
Create a reflector. |
|
ReflectorCometHandler(boolean useStreaming,
String startingMessage,
String endingMessage)
Create a reflector. |
Method Summary | |
---|---|
void |
attach(PrintWriter printWriter)
Attach a PrintWriter that will be used to write the returned value of
CometEvent.attachment |
void |
onEvent(CometEvent event)
Write CometEvent.attachment and resume the connection if
useStreaming is false |
void |
onInitialize(CometEvent event)
Send the startingMessage before the
connection get suspended. |
void |
onInterrupt(CometEvent event)
Send the endingMessage before the
connection get interupted. |
void |
onTerminate(CometEvent event)
Send the endingMessage before the
connection get terminated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected PrintWriter printWriter
Constructor Detail |
---|
public ReflectorCometHandler()
public ReflectorCometHandler(boolean useStreaming)
useStreaming
- should the connection be resumed on the first push,
or never resumed from the onEvent(com.sun.grizzly.comet.CometEvent)
. Default is true.public ReflectorCometHandler(boolean useStreaming, String startingMessage, String endingMessage)
useStreaming
- should the connection be resumed on the first push,
or never resumed from the onEvent(com.sun.grizzly.comet.CometEvent)
. Default is true.endingMessage
- Message send when the connection is about to be suspended
(onInitialize(com.sun.grizzly.comet.CometEvent)
)
or gets interrupted (onInterrupt(com.sun.grizzly.comet.CometEvent)
)endingMessage
- Message send when the connection terminate (onTerminate(com.sun.grizzly.comet.CometEvent)
)
or gets interrupted (onInterrupt(com.sun.grizzly.comet.CometEvent)
)Method Detail |
---|
public void attach(PrintWriter printWriter)
PrintWriter
that will be used to write the returned value of
CometEvent.attachment
attach
in interface CometHandler<PrintWriter>
printWriter
- PrintWriter
that will be used to write the returned value of
CometEvent.attachment
public void onEvent(CometEvent event) throws IOException
CometEvent.attachment
and resume the connection if
useStreaming
is false
onEvent
in interface CometHandler<PrintWriter>
event
-
IOException
public void onInitialize(CometEvent event) throws IOException
startingMessage
before the
connection get suspended.
onInitialize
in interface CometHandler<PrintWriter>
event
- (@link CometEvent}
IOException
public void onTerminate(CometEvent event) throws IOException
endingMessage
before the
connection get terminated.
onTerminate
in interface CometHandler<PrintWriter>
event
- (@link CometEvent}
IOException
public void onInterrupt(CometEvent event) throws IOException
endingMessage
before the
connection get interupted.
onInterrupt
in interface CometHandler<PrintWriter>
event
- (@link CometEvent}
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |