From: <jef...@us...> - 2002-06-29 11:57:35
|
Update of /cvsroot/aft/Anteater/src/org/apache/anteater/test In directory usw-pr-cvs1:/tmp/cvs-serv28110/src/org/apache/anteater/test Modified Files: Deploy.java Listener.java SendResponse.java Log Message: Expand the javadocs, particularly the part relating to listeners Index: Deploy.java =================================================================== RCS file: /cvsroot/aft/Anteater/src/org/apache/anteater/test/Deploy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Deploy.java 16 Jun 2002 07:04:47 -0000 1.1 +++ Deploy.java 29 Jun 2002 11:57:32 -0000 1.2 @@ -1,15 +1,30 @@ package org.apache.anteater.test; +/** + * Task for deploying new web applications into the {@link ServletContainer} at + * runtime. + * + * @version $Revision$ $Date$ + * @author <a href="mailto:ov...@cu...">Ovidiu Predescu</a> + * @since June 16, 2002 + */ public class Deploy extends BaseTask { protected String path; protected String docBase; + /** + * Context path to map to the webapp. + * Must start with '/'. + */ public void setPath(String path) { this.path = path; } + /** + * Path to the directory containing the unpacked webapp. + */ public void setWebapp(String docBase) { this.docBase = docBase; Index: Listener.java =================================================================== RCS file: /cvsroot/aft/Anteater/src/org/apache/anteater/test/Listener.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- Listener.java 27 Jun 2002 11:44:57 -0000 1.12 +++ Listener.java 29 Jun 2002 11:57:32 -0000 1.13 @@ -25,6 +25,9 @@ * there's no request received, or if the request is received, but no * matchers succeed, the <code>listener</code> element fails. * + * See <a href="../servlet/package-summary.html">here</a> for a description of + * how this interacts with other classes. + * @author <a href="mailto:ov...@cu...">Ovidiu Predescu</a> * @version $Revision$ $Date$ * @since September 26, 2001 @@ -128,18 +131,24 @@ return path; } + /** Called by ListenerProxyServlet. + */ public void setHttpMessageRequest(HttpMessage request) { this.request = request; request.setUseTidy(useTidy); } + /** Called by ListenerProxyServlet. + */ public void setHttpServletResponse(HttpServletResponse servletResponse) { this.servletResponse = servletResponse; objectModel.put("HttpServletResponse", servletResponse); } + /** Called by ListenerProxyServlet. + */ public void setResponseWriter(PipedWriter writer) { this.responseWriter = writer; Index: SendResponse.java =================================================================== RCS file: /cvsroot/aft/Anteater/src/org/apache/anteater/test/SendResponse.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- SendResponse.java 5 Apr 2002 00:13:45 -0000 1.6 +++ SendResponse.java 29 Jun 2002 11:57:32 -0000 1.7 @@ -13,7 +13,15 @@ /** * Sends an HTTP response back in the servlet thread. * + * <p> + * This task looks in the object model for a stored {@link HttpServletResponse} and + * {@link Writer}, which it uses to write the response. + * <p> + * See <a href="../servlet/package-summary.html">here</a> for + * a description of how this interacts with other classes. + * * @author <a href="mailto:ov...@cu...">Ovidiu Predescu</a> + * @author <a href="mailto:jef...@us...">Jeff Turner</a> * @version $Revision$ $Date$ * @since October 1, 2001 */ @@ -27,16 +35,33 @@ public SendResponse() {} + /** + * Set the path of the file whose contents will constitute the HTTP body + * returned to the caller. + * + * @param href Path to a file + */ public void setHref(String href) { this.href = href; } + /** Set MIME content type to label body contents as. + * + * @param contentType <a href="http://www.ietf.org/rfc/rfc2046.txt">MIME + * type</a>, eg <code>text/html</code> or <code>text/plain</code>. + */ public void setContentType(String contentType) { this.contentType = contentType; } + /** Set the HTTP response code to send to the client. + * + * @param code <a + * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP + * response code</a>, eg 200 (OK), 400 (Bad request), 404 (Not Found). + */ public void setResponseCode(int code) throws BuildException { @@ -48,6 +73,14 @@ this.objectModel = objectModel; } + + // Question: Why do we need to pass the Writer separately? Can't this + // method just write to response.getWriter()? (JT) + /** + * Sends a response back to the HTTP client. + * @param response The HttpServletResponse set by the servlet. This will have it's content type and status set. + * @param responseWriter a Writer, which will send bytes through an inter-thread pipe to the servlet, and then on to the client as the response body. + */ public void writeTo(HttpServletResponse response, Writer responseWriter) throws IOException, BuildException { @@ -70,13 +103,17 @@ responseWriter.write(expBody); } - if (debug != 0) + if (debug != 0) { println(" body:\n" + expBody); + } responseWriter.flush(); responseWriter.close(); } + /** Retrieves the {@link HttpServletResponse} and {@link Writer}, and uses the + * contents of the file specified by {@link #setHref} to write a response. + */ public void execute() throws BuildException { |