com.oreilly.servlet
类 DaemonHttpServlet

java.lang.Object
  继承者 javax.servlet.GenericServlet
      继承者 javax.servlet.http.HttpServlet
          继承者 com.oreilly.servlet.DaemonHttpServlet
所有已实现的接口:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
直接已知子类:
RemoteDaemonHttpServlet

public abstract class DaemonHttpServlet
extends javax.servlet.http.HttpServlet

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.

版本:
1.0, 98/09/18
作者:
Jason Hunter, Copyright © 1998
另请参见:
RemoteDaemonHttpServlet, 序列化表格

字段摘要
protected  int DEFAULT_PORT
          The default listening port (1313)
 
构造方法摘要
DaemonHttpServlet()
           
 
方法摘要
 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(Socket client)
          Handles a new socket connection.
 void init(javax.servlet.ServletConfig config)
          Begins a thread listening for socket connections.
 
从类 javax.servlet.http.HttpServlet 继承的方法
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
从类 javax.servlet.GenericServlet 继承的方法
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

DEFAULT_PORT

protected int DEFAULT_PORT
The default listening port (1313)

构造方法详细信息

DaemonHttpServlet

public DaemonHttpServlet()
方法详细信息

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Begins a thread listening for socket connections. Subclasses that override this method must be sure to first call super.init(config).

指定者:
接口 javax.servlet.Servlet 中的 init
覆盖:
javax.servlet.GenericServlet 中的 init
参数:
config - the servlet config
抛出:
javax.servlet.ServletException - if a servlet exception occurs

getSocketPort

protected int getSocketPort()
Returns the socket port on which the servlet will listen. A servlet can change the port in three ways: by using the socketPort init parameter, by setting the DEFAULT_PORT variable before calling super.init(), or by overriding this method's implementation.

返回:
the port number on which to listen

handleClient

public abstract void handleClient(Socket client)
Handles a new socket connection. Subclasses must define this method.

参数:
client - the client socket

destroy

public void destroy()
Halts the thread listening for socket connections. Subclasses that override this method must be sure to first call super.destroy().

指定者:
接口 javax.servlet.Servlet 中的 destroy
覆盖:
javax.servlet.GenericServlet 中的 destroy


Copyright © 2013. All Rights Reserved.