|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.GenericServlet javax.servlet.http.HttpServlet org.xmlBlaster.protocol.http.appletproxy.AppletServlet
public class AppletServlet
This servlet supports requests from an applet and sends instant message callbacks to it.
The servlet doesn't leave the doGet() method after an invocation of actionType "connect" keeping a permanent http connection.
The logging output is redirected to the normal servlet log file. If you use Apache/Jserv, look into /var/log/httpd/jserv.log, for tomcat 5.x check jakarta-tomcat/logs/catalina.out
The file
xmlBlaster/demo/http/WEB-INF/web.xml
allows to switch on/off logging and to choose any other xmlBlaster client side configuration like queue sizes etc.
XmlBlasterAccessRaw
,
HelloWorld3
,
Serialized FormField Summary | |
---|---|
static java.lang.String |
ENCODING
|
private Global |
initialGlobal
|
private static java.util.logging.Logger |
log
|
static long |
requestCounter
|
private static long |
serialVersionUID
|
private Timeout |
timeout
|
Constructor Summary | |
---|---|
AppletServlet()
|
Method Summary | |
---|---|
protected void |
connect(java.lang.String ME,
java.util.logging.Logger log,
javax.servlet.http.HttpSession session,
java.lang.String qos,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
|
private java.lang.String |
decode(java.lang.String in,
java.lang.String encoding)
|
void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
This method is supported just for cases where the servlet is contacted directy from a browser in which case it is easy for the user to pass the data directly via the url. |
void |
doGetFake(java.lang.String ME,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
java.lang.String actionType,
MsgHolder msgHolder)
GET request from the browser, usually to do an initial login. |
void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
POST request from the applet. |
protected MsgHolder |
extractMessage(java.lang.String ME,
java.util.logging.Logger log,
javax.servlet.http.HttpServletRequest req,
MsgHolder binaryMsg)
|
static java.lang.String |
getAttribute(javax.servlet.http.HttpServletRequest req,
java.lang.String name,
java.lang.String defaultVal)
Get a request attribute, if not found the session is checked, if not found again, the given default is returned. |
static boolean |
getParameter(javax.servlet.http.HttpServletRequest req,
java.lang.String name,
boolean defaultVal)
|
static java.lang.String |
getParameter(javax.servlet.http.HttpServletRequest req,
java.lang.String name,
java.lang.String defaultVal)
Get the request parameter. |
private PushHandler |
getPushHandler(javax.servlet.http.HttpServletRequest req)
|
void |
init(javax.servlet.ServletConfig conf)
This method is invoked only once when the servlet is started. |
static void |
initSystemProperties(javax.servlet.ServletConfig conf)
Setting the system properties. |
void |
log(java.util.logging.LogRecord record)
Event fired by Logger.java through interface I_LogListener. |
private MsgHolder |
readBinaryProtocol(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
This method is used by the binary protocol. |
private byte[] |
readBodyContent(javax.servlet.http.HttpServletRequest req)
|
private void |
writeResponse(javax.servlet.http.HttpServletResponse res,
java.lang.String actionType,
java.lang.Object obj)
Transforms the given text to send it back to the applet. |
private void |
writeResponse(javax.servlet.http.HttpServletResponse res,
java.lang.String actionType,
java.lang.String text)
|
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static java.util.logging.Logger log
private static final long serialVersionUID
private Global initialGlobal
private Timeout timeout
public static final java.lang.String ENCODING
public static long requestCounter
Constructor Detail |
---|
public AppletServlet()
Method Detail |
---|
public void init(javax.servlet.ServletConfig conf) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
conf
- init parameter of the servlet
javax.servlet.ServletException
protected void connect(java.lang.String ME, java.util.logging.Logger log, javax.servlet.http.HttpSession session, java.lang.String qos, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws XmlBlasterException, java.io.IOException, javax.servlet.ServletException
XmlBlasterException
java.io.IOException
javax.servlet.ServletException
public void doGetFake(java.lang.String ME, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, java.lang.String actionType, MsgHolder msgHolder) throws javax.servlet.ServletException, java.io.IOException
javax.servlet.ServletException
java.io.IOException
private final java.lang.String decode(java.lang.String in, java.lang.String encoding)
private byte[] readBodyContent(javax.servlet.http.HttpServletRequest req)
private MsgHolder readBinaryProtocol(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws java.io.IOException
req
- res
-
java.io.IOException
protected MsgHolder extractMessage(java.lang.String ME, java.util.logging.Logger log, javax.servlet.http.HttpServletRequest req, MsgHolder binaryMsg)
public void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, java.io.IOException
doGet
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
java.io.IOException
public void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, java.io.IOException
Handles all requests coming from the applet. It reads the passed parameters either from the url (in which case they are encoded) or directly from the input stream (the body of the request). In the latter case they are binary data which is not encoded and is refered to as binary protocol. The asynchronous updates are pushed back using PushHandler.java
doPost
in class javax.servlet.http.HttpServlet
req
- Data from browserres
- Response of the servlet
javax.servlet.ServletException
java.io.IOException
public static final void initSystemProperties(javax.servlet.ServletConfig conf)
private void writeResponse(javax.servlet.http.HttpServletResponse res, java.lang.String actionType, java.lang.String text) throws java.io.IOException
java.io.IOException
#writeResponse(HttpServletResponse, String, text)
private void writeResponse(javax.servlet.http.HttpServletResponse res, java.lang.String actionType, java.lang.Object obj) throws java.io.IOException
The actionType and the text are java.io.Serialized and than Base64 encoded.
res
- actionType
- A type with the applet knows how to read, "subscribe" etc. for subscribe return QoS
java.io.IOException
private PushHandler getPushHandler(javax.servlet.http.HttpServletRequest req) throws XmlBlasterException
If
- no PushHandler exists
XmlBlasterException
public void log(java.util.logging.LogRecord record)
log
in interface I_LogListener
public static final java.lang.String getParameter(javax.servlet.http.HttpServletRequest req, java.lang.String name, java.lang.String defaultVal)
req
- request from clientname
- parameter namedefaultVal
- default value if parameter not found
public static final java.lang.String getAttribute(javax.servlet.http.HttpServletRequest req, java.lang.String name, java.lang.String defaultVal)
req
- request from clientname
- parameter namedefaultVal
- default value if parameter not found
public static final boolean getParameter(javax.servlet.http.HttpServletRequest req, java.lang.String name, boolean defaultVal)
getParameter(HttpServletRequest, String, String)
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |