|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xmlBlaster.protocol.http.appletproxy.PushHandler
public class PushHandler
This handles and hides the different http push modes when sending
data back to the applet through method update().
Push mode works with keeping a permanent http connection
Field Summary | |
---|---|
private I_Callback |
callbackInterceptor
|
private boolean |
closed
Current http connection state |
private Global |
glob
|
(package private) boolean |
isChunked
|
private static java.util.logging.Logger |
log
|
private java.lang.String |
ME
|
private long |
missingPongs
|
private javax.servlet.ServletOutputStream |
outMulti
|
private long |
pingCounter
|
private long |
pingInterval
Ping the applet every 10 seconds. |
private Timestamp |
pingTimeoutHandle
|
private javax.servlet.http.HttpServletResponse |
res
|
private java.lang.String |
sessionId
|
private Timeout |
timeout
|
private I_XmlBlasterAccess |
xmlBlasterAccess
|
Constructor Summary | |
---|---|
PushHandler(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
java.lang.String sessionId,
java.lang.String loginName,
I_XmlBlasterAccess xmlBlasterAccess,
Timeout timeout)
Use the persistent HTTP callback connection. |
Method Summary | |
---|---|
void |
cleanup()
Shutdown applet connection and xmlBlaster connection. |
I_XmlBlasterAccess |
getXmlBlasterAccess()
|
boolean |
isClosed()
|
void |
ping(java.lang.String state)
calls the ping method in the parentframe of the callback frame The data must be Javascript code |
void |
pong()
This is the browser response for our previous ping. |
private void |
pushToApplet(byte[] chunk)
Pushing a message to the applet. |
void |
setPingInterval(long pingInterval)
Set or change the ping interval. |
void |
setProxyInterceptor(I_Callback interceptor)
If you implement I_ProxyInterceptor and register it here, your update() implementation is called and may manipulate the received message from xmlBlaster before it is sent to the applet. |
void |
shutdownAppletConnection()
Don't forget to call this method when you want to close the connection. |
void |
startPing()
|
void |
stopPing()
|
void |
timeout(java.lang.Object userData)
You will be notified about the timeout through this method. |
java.lang.String |
update(java.lang.String sessionId,
UpdateKey updateKey,
byte[] content,
UpdateQos updateQos)
Pushes received message back to browser or applet. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.String ME
private Global glob
private static java.util.logging.Logger log
private long pingInterval
private final Timeout timeout
private Timestamp pingTimeoutHandle
private long pingCounter
private long missingPongs
private I_XmlBlasterAccess xmlBlasterAccess
private I_Callback callbackInterceptor
private javax.servlet.http.HttpServletResponse res
private java.lang.String sessionId
private boolean closed
private javax.servlet.ServletOutputStream outMulti
boolean isChunked
Constructor Detail |
---|
public PushHandler(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, java.lang.String sessionId, java.lang.String loginName, I_XmlBlasterAccess xmlBlasterAccess, Timeout timeout) throws javax.servlet.ServletException, java.io.IOException
res
- The response objectsessionId
- The applet idloginName
- For loggin onlyxmlBlasterAccess
- Not yet logged in
javax.servlet.ServletException
java.io.IOException
Method Detail |
---|
public void timeout(java.lang.Object userData)
I_Timeout
timeout
in interface I_Timeout
userData
- I_Timeout
public void startPing() throws XmlBlasterException
XmlBlasterException
public void stopPing() throws XmlBlasterException
XmlBlasterException
public boolean isClosed()
public void setPingInterval(long pingInterval) throws XmlBlasterException
Ping the applet to avoid that the web server or a internet proxy
closes the http connection after a vendor specific timeout.
Note that the ping sends some bytes as well, a proxy
may close the http connection if the amount of bytes per second
falls below a certain level.
The applet responses with 'pong' which allows us to check if the applet
is still here.
pingInterval
- in milli seconds (defaults to 10000)
XmlBlasterException
public I_XmlBlasterAccess getXmlBlasterAccess()
public void shutdownAppletConnection()
public void setProxyInterceptor(I_Callback interceptor)
interceptor
- Your optional implementationpublic void cleanup()
private void pushToApplet(byte[] chunk) throws java.io.IOException
chunk
- The raw data, we encode it with base64, the applet must know how to handle it.
java.io.IOException
public java.lang.String update(java.lang.String sessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos)
The callbacks are java-serialized Maps for key/qos etc.
Format: Serialized "'update' sessionId QoS Key Content" and then Base64 encoded
update
in interface I_Callback
sessionId
- The session ID specified by the client which registered the callback.
You can specify a cbSessionId during connection (with ConnectQos)
and this is bounced back here so you can authenticate the message.updateKey
- The arrived key containing the topic namecontent
- The arrived message content. This is your payload.I_XmlBlasterAccess
public void ping(java.lang.String state) throws XmlBlasterException
state
- The string "refresh"XmlBlasterException
public void pong()
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |