|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.oreilly.servlet.DaemonHttpServlet
public abstract class DaemonHttpServlet
A superclass for HTTP servlets that wish to accept raw socket connections. DaemonHttpServlet starts listening for client requests in its init() method and stops listening in its destroy() method. In between, for every connection it receives, it calls the abstract handleClient(Socket client) method. This method should be implemented by the servlet subclassing DaemonHttpServlet. The port on which the servlet is to listen is determined by the getSocketPort() method.
RemoteDaemonHttpServlet
,
Serialized FormField Summary | |
---|---|
protected int |
DEFAULT_PORT
The default listening port (1313) |
Constructor Summary | |
---|---|
DaemonHttpServlet()
|
Method Summary | |
---|---|
void |
destroy()
Halts the thread listening for socket connections. |
protected int |
getSocketPort()
Returns the socket port on which the servlet will listen. |
abstract void |
handleClient(java.net.Socket client)
Handles a new socket connection. |
void |
init(javax.servlet.ServletConfig config)
Begins a thread listening for socket connections. |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
---|
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 |
---|
protected int DEFAULT_PORT
Constructor Detail |
---|
public DaemonHttpServlet()
Method Detail |
---|
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
config
- the servlet config
javax.servlet.ServletException
- if a servlet exception occursprotected int getSocketPort()
public abstract void handleClient(java.net.Socket client)
client
- the client socketpublic void destroy()
destroy
in interface javax.servlet.Servlet
destroy
in class javax.servlet.GenericServlet
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |