net.noderunner.http.servlet
Class ServletServer

java.lang.Object
  extended by net.noderunner.http.ThreadedHttpServer
      extended by net.noderunner.http.servlet.ServletServer
All Implemented Interfaces:
java.lang.Runnable

public class ServletServer
extends ThreadedHttpServer

Extends the threaded HTTP server by sending requests to a single servlet. Currently does not support streamed requests or responses, though this feature may likely be supported in the future.

Author:
Elias Ross

Nested Class Summary
 
Nested classes/interfaces inherited from class net.noderunner.http.ThreadedHttpServer
ThreadedHttpServer.Request
 
Field Summary
 
Fields inherited from class net.noderunner.http.ThreadedHttpServer
ss
 
Constructor Summary
ServletServer(javax.servlet.http.HttpServlet servlet)
          Constructs a new ServletServer.
ServletServer(javax.servlet.http.HttpServlet servlet, int port)
          Constructs a new ServletServer for this local port.
ServletServer(javax.servlet.http.HttpServlet servlet, java.net.ServerSocket ss)
          Constructs a new ServletServer.
 
Method Summary
protected  void handleRequest(ThreadedHttpServer.Request r)
          Override this method to handle the request.
 
Methods inherited from class net.noderunner.http.ThreadedHttpServer
close, exception, getPort, run, start, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServletServer

public ServletServer(javax.servlet.http.HttpServlet servlet)
              throws java.io.IOException
Constructs a new ServletServer.

Parameters:
servlet - pre-initialized HTTP servlet to use
Throws:
java.io.IOException

ServletServer

public ServletServer(javax.servlet.http.HttpServlet servlet,
                     java.net.ServerSocket ss)
Constructs a new ServletServer.

Parameters:
servlet - pre-initialized HTTP servlet to use
ss - server socket

ServletServer

public ServletServer(javax.servlet.http.HttpServlet servlet,
                     int port)
              throws java.io.IOException
Constructs a new ServletServer for this local port.

Parameters:
servlet - pre-initialized HTTP servlet to use
port - TCP/IP port number
Throws:
java.io.IOException
Method Detail

handleRequest

protected void handleRequest(ThreadedHttpServer.Request r)
                      throws java.io.IOException
Description copied from class: ThreadedHttpServer
Override this method to handle the request. You may optionally process this request asynchronously.

Specified by:
handleRequest in class ThreadedHttpServer
Throws:
java.io.IOException


Copyright © 2010. All Rights Reserved.