org.xmlBlaster.protocol.http.ajax
Class BlasterInstance
java.lang.Object
org.xmlBlaster.protocol.http.ajax.BlasterInstance
- All Implemented Interfaces:
- I_Callback, BlasterInstanceMBean
public class BlasterInstance
- extends java.lang.Object
- implements I_Callback, BlasterInstanceMBean
One browser session maps on exactly one xmlBlaster login session.
Callback messages are send as xml to the browser:
<xmlBlasterResponse>
<update>
<qos>...</qos>
<key>...</key>
<content>...</content>
</update>
</xmlBlasterResponse>
- Author:
- Marcel Ruff xmlBlaster@marcelruff.info 2007
Method Summary |
void |
execute(byte[] xmlScriptRaw,
java.lang.String xmlScript,
java.io.Writer out)
|
java.lang.String |
getCbSessionId()
|
java.lang.String |
getClientInfo()
|
java.lang.String |
getCreationTimestamp()
|
java.lang.String |
getGpsTopicId()
|
java.lang.String |
getLastAccessedTimestamp()
|
java.lang.String |
getRelativeName()
|
java.lang.String |
getRemoteAddr()
|
javax.servlet.http.HttpSession |
getSession()
|
java.lang.String |
getStartupPos()
|
int |
getUpdateQueueSize()
|
I_XmlBlasterAccess |
getXmlBlasterAccess()
|
void |
init(javax.servlet.http.HttpServletRequest req,
java.util.Properties props)
|
boolean |
isAdmin()
|
boolean |
isShutdown()
|
(package private) void |
plainGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
java.io.StringWriter out)
|
void |
put(MsgUnit msgUnit)
|
int |
sendUpdates(java.io.Writer out,
boolean onlyContent,
int numEntries,
long timeout)
This method gets the entries in the correct form, i.e. |
void |
setAdmin(boolean admin)
|
void |
setSession(javax.servlet.http.HttpSession session)
|
void |
setXmlBlasterAccess(I_XmlBlasterAccess xmlBlasterAccess)
|
void |
shutdown()
|
java.lang.String |
shutdownAndBlockIP()
|
java.lang.String |
update(java.lang.String cbSessionId,
UpdateKey updateKey,
byte[] content,
UpdateQos updateQos)
This is the callback method invoked from I_XmlBlasterAccess
informing the client in an asynchronous mode about a new message. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
private static java.util.logging.Logger log
ajaxServlet
private AjaxServlet ajaxServlet
xmlBlasterAccess
private I_XmlBlasterAccess xmlBlasterAccess
glob
private Global glob
id
private java.lang.String id
session
private javax.servlet.http.HttpSession session
sessionId
private java.lang.String sessionId
storageId
private StorageId storageId
updateQueue
private I_Queue updateQueue
RELATED_AJAX
private final java.lang.String RELATED_AJAX
- See Also:
- Constant Field Values
blockingQueueWrapper
private BlockingQueueWrapper blockingQueueWrapper
contextNode
private ContextNode contextNode
mbeanHandle
private JmxMBeanHandle mbeanHandle
- My JMX registration
isShutdownInProgress
private boolean isShutdownInProgress
clientInfo
private java.lang.String clientInfo
remoteAddr
private java.lang.String remoteAddr
admin
private boolean admin
BlasterInstance
public BlasterInstance(AjaxServlet ajaxServlet,
javax.servlet.http.HttpServletRequest req)
getGpsTopicId
public java.lang.String getGpsTopicId()
getCbSessionId
public java.lang.String getCbSessionId()
init
public void init(javax.servlet.http.HttpServletRequest req,
java.util.Properties props)
throws XmlBlasterException
- Throws:
XmlBlasterException
execute
public void execute(byte[] xmlScriptRaw,
java.lang.String xmlScript,
java.io.Writer out)
throws XmlBlasterException,
java.io.UnsupportedEncodingException,
java.io.IOException
- Throws:
XmlBlasterException
java.io.UnsupportedEncodingException
java.io.IOException
getSession
public javax.servlet.http.HttpSession getSession()
setSession
public void setSession(javax.servlet.http.HttpSession session)
getXmlBlasterAccess
public I_XmlBlasterAccess getXmlBlasterAccess()
setXmlBlasterAccess
public void setXmlBlasterAccess(I_XmlBlasterAccess xmlBlasterAccess)
put
public void put(MsgUnit msgUnit)
throws XmlBlasterException
- Throws:
XmlBlasterException
sendUpdates
public int sendUpdates(java.io.Writer out,
boolean onlyContent,
int numEntries,
long timeout)
throws XmlBlasterException,
java.io.IOException
- This method gets the entries in the correct form, i.e. the first stored comes first.
- Parameters:
out
- The out streamonlyContent
- if false the complete MsgUnit XML is sendnumEntries
- if -1 unlimitedtimeout
- if 0 not blocking, if timeout > 0: blocking, if timeout < 0: infinite blocking
- Returns:
- Number of send updates
- Throws:
XmlBlasterException
java.io.IOException
update
public java.lang.String update(java.lang.String cbSessionId,
UpdateKey updateKey,
byte[] content,
UpdateQos updateQos)
throws XmlBlasterException
- Description copied from interface:
I_Callback
- This is the callback method invoked from I_XmlBlasterAccess
informing the client in an asynchronous mode about a new message.
So you should implement in your client code the I_Callback interface -
suppling the update() method where you can do with the message whatever you want.
The raw protocol driver specific update() method (e.g. CORBA-BlasterCallback.update())
is unpacked and for each arrived message this update is called.
- Specified by:
update
in interface I_Callback
- Parameters:
cbSessionId
- 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.
- Throws:
XmlBlasterException
- See Also:
I_XmlBlasterAccess
getStartupPos
public java.lang.String getStartupPos()
shutdown
public void shutdown()
- Specified by:
shutdown
in interface BlasterInstanceMBean
plainGet
void plainGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
java.io.StringWriter out)
throws java.io.IOException,
XmlBlasterException
- Throws:
java.io.IOException
XmlBlasterException
getUpdateQueueSize
public int getUpdateQueueSize()
- Specified by:
getUpdateQueueSize
in interface BlasterInstanceMBean
getRelativeName
public java.lang.String getRelativeName()
- Specified by:
getRelativeName
in interface BlasterInstanceMBean
getCreationTimestamp
public java.lang.String getCreationTimestamp()
- Specified by:
getCreationTimestamp
in interface BlasterInstanceMBean
getLastAccessedTimestamp
public java.lang.String getLastAccessedTimestamp()
- Specified by:
getLastAccessedTimestamp
in interface BlasterInstanceMBean
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interface BlasterInstanceMBean
getClientInfo
public java.lang.String getClientInfo()
- Specified by:
getClientInfo
in interface BlasterInstanceMBean
shutdownAndBlockIP
public java.lang.String shutdownAndBlockIP()
- Specified by:
shutdownAndBlockIP
in interface BlasterInstanceMBean
getRemoteAddr
public java.lang.String getRemoteAddr()
- Specified by:
getRemoteAddr
in interface BlasterInstanceMBean
isAdmin
public boolean isAdmin()
- Specified by:
isAdmin
in interface BlasterInstanceMBean
setAdmin
public void setAdmin(boolean admin)
- Specified by:
setAdmin
in interface BlasterInstanceMBean
Copyright © 1999-2014 The xmlBlaster.org contributers.