org.apache.anteater.test
Class ServletContainer

java.lang.Object
  |
  +--org.apache.anteater.test.ServletContainer

public class ServletContainer
extends Object

Start an embedded Tomcat servlet container.

Tomcat will start executing in a parallel thread with the main Ant thread. Incoming HTTP requests are received by Tomcat, which will create a new thread for serving the request. The servlet which gets executed will always be ListenerProxyServlet.

When a listener element is executed by Ant, the execution will stop until an HTTP request is received by Tomcat. When this happens, ListenerProxyServlet will pass to the Listener instance the received HTTP message. This in turn will pass the object to the embedded MatcherSet, for the matching process to start.

Responses are serialized from the Ant thread into the ListenerProxyServlet thread, using a PipedWriter object. The servlet thread will in turn write the data back to the HTTP client.

Since:
September 25, 2001
Version:
$Revision: 1.15 $ $Date: 2002/08/12 09:01:25 $
Author:
Ovidiu Predescu, Costin Manolache
See Also:
ListenerProxyServlet

Constructor Summary
ServletContainer()
           
 
Method Summary
 void addContext(String path, String docBase, BaseTask task)
           
 void debug(String msg)
           
 int getDefaultPort()
          Returns the first port declared with setPort(java.lang.String) or DEFAULT_PORT.
 Hashtable getRegisteredListeners()
           
 Queue getRequestsQueue()
           
static ServletContainer getServletContainer()
          Factory method returning the currently active ServletContainer.
 boolean isStarted()
          Whether this Tomcat has been initialized and started.
static void main(String[] args)
           
 void println(String msg)
           
 void registerListener(Listener listener)
           
 void removeContext(String path, BaseTask task)
           
 void removeListener(Listener listener)
           
 void setMaxSpareThreads(int maxSpareThreads)
           
 void setMaxThreads(int maxThreads)
           
 void setMinSpareThreads(int minSpareThreads)
           
 void setPort(String ports)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletContainer

public ServletContainer()
Method Detail

getServletContainer

public static ServletContainer getServletContainer()
Factory method returning the currently active ServletContainer.

Returns:
A non-null ServletContainer instance. Within a VM, should always return the same one.

getRequestsQueue

public Queue getRequestsQueue()

registerListener

public void registerListener(Listener listener)

removeListener

public void removeListener(Listener listener)

getRegisteredListeners

public Hashtable getRegisteredListeners()

setPort

public void setPort(String ports)
             throws org.apache.tools.ant.BuildException
org.apache.tools.ant.BuildException

getDefaultPort

public int getDefaultPort()
Returns the first port declared with setPort(java.lang.String) or DEFAULT_PORT.


setMaxThreads

public void setMaxThreads(int maxThreads)

setMaxSpareThreads

public void setMaxSpareThreads(int maxSpareThreads)

setMinSpareThreads

public void setMinSpareThreads(int minSpareThreads)

addContext

public void addContext(String path,
                       String docBase,
                       BaseTask task)

removeContext

public void removeContext(String path,
                          BaseTask task)

start

public void start()

isStarted

public boolean isStarted()
Whether this Tomcat has been initialized and started. Ie, whether the <servletContainer> task has been called.


debug

public void debug(String msg)

println

public void println(String msg)

stop

public void stop()

main

public static void main(String[] args)
                 throws Exception
Exception


Ant Functional Tester -- see Project home page for details