org.apache.anteater.servlet
Class ListenerProxyServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--org.apache.anteater.servlet.ListenerProxyServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class ListenerProxyServlet
extends javax.servlet.http.HttpServlet

This is the servlet which is registered with Tomcat to receive all the incoming HTTP requests.

When a request is received on a given path, the servlet will verify if there's a matching Listener waiting for an incoming request on that path. If no listener is registered a 404 error message is sent back to the client.

If there is a listener waiting for an HTTP request in the main Ant thread, the request is placed in a Queue, and the thread running the listener is awaken. This will give it the opportunity to execute the set of matchers against the incoming HTTP request. The servlet thread blocks at this point, waiting for the listener's thread to start writing the response back to the client.

When the listener finishes the matching, it starts writing the response on a PipedWriter object. The servlet thread waits at the other end of the pipe on a PipedReader. When the listener closes its end of the pipe, the servlet considers that the response to be sent was created, flushes all the data it has received back to the HTTP client, and returns from the service(ServletRequest, ServletResponse) method.

Since:
September 27, 2001
Version:
$Revision: 1.3 $ $Date: 2002/08/01 10:28:37 $
Author:
Ovidiu Predescu
See Also:
Serialized Form

Constructor Summary
ListenerProxyServlet()
           
 
Method Summary
 void service(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListenerProxyServlet

public ListenerProxyServlet()
Method Detail

service

public void service(javax.servlet.ServletRequest servletRequest,
                    javax.servlet.ServletResponse servletResponse)
Specified by:
service in interface javax.servlet.Servlet
Overrides:
service in class javax.servlet.http.HttpServlet


Ant Functional Tester -- see Project home page for details