tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r450967 - in /tomcat/tc6.0.x/trunk/java/org/apache/catalina: CometEvent.java CometFilter.java CometFilterChain.java CometProcessor.java
Date Thu, 28 Sep 2006 18:51:23 GMT
Author: remm
Date: Thu Sep 28 11:51:22 2006
New Revision: 450967

URL: http://svn.apache.org/viewvc?view=rev&rev=450967
Log:
- Javadoc update.

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometEvent.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometFilter.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometFilterChain.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometProcessor.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometEvent.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometEvent.java?view=diff&rev=450967&r1=450966&r2=450967
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometEvent.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometEvent.java Thu Sep 28 11:51:22 2006
@@ -78,33 +78,40 @@
     
     
     /**
-     * Returns the HttpServletRequest or the last HttpServletRequestWrapper if a filter was
applied
+     * Returns the HttpServletRequest.
+     * 
      * @return HttpServletRequest
      */
     public HttpServletRequest getHttpServletRequest();
     
     /**
-     * Returns the HttpServletResponse or the last HttpServletResponseWrapper
+     * Returns the HttpServletResponse.
+     * 
      * @return HttpServletResponse
      */
     public HttpServletResponse getHttpServletResponse();
     
     /**
-     * Returns the event type
+     * Returns the event type.
+     * 
      * @return EventType
      */
     public EventType getEventType();
     
     /**
-     * Returns 
+     * Returns the sub type of this event.
+     * 
      * @return EventSubType
      */
     public EventSubType getEventSubType();
     
     /**
      * Ends the Comet session. This signals to the container that 
-     * the container wants to end the comet session.
-     * The container may invoke event(CometEvent.END) synchronously or asynchronously
+     * the container wants to end the comet session. This will send back to the
+     * client a notice that the server has no more data to send as part of this
+     * request. The servlet should perform any needed cleanup as if it had recieved
+     * an END or ERROR event. 
+     * 
      * @throws IOException if an IO exception occurs
      */
     public void close() throws IOException;
@@ -119,6 +126,7 @@
      * web application SHOULD NOT attempt to reuse the request and response objects after
a timeout
      * as the <code>error(HttpServletRequest, HttpServletResponse)</code> method
indicates.<br/>
      * This method should not be called asynchronously, as that will have no effect.
+     * 
      * @param timeout The timeout in milliseconds for this connection, must be a positive
value, larger than 0
      * @throws IOException An IOException may be thrown to indicate an IO error, 
      *         or that the EOF has been reached on the connection

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometFilter.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometFilter.java?view=diff&rev=450967&r1=450966&r2=450967
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometFilter.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometFilter.java Thu Sep 28 11:51:22 2006
@@ -19,19 +19,63 @@
 
 import java.io.IOException;
 
-import javax.servlet.FilterChain;
+import javax.servlet.Filter;
 import javax.servlet.ServletException;
 
 /**
- * The CometFilter interface.
+ * A Comet filter, similar to regular filters, performs filtering tasks on either 
+ * the request to a resource (a Comet servlet), or on the response from a resource, or both.
+ * <br><br>
+ * Filters perform filtering in the <code>doFilterEvent</code> method. Every
Filter has access to 
+ * a FilterConfig object from which it can obtain its initialization parameters, a
+ * reference to the ServletContext which it can use, for example, to load resources
+ * needed for filtering tasks.
+ * <p>
+ * Filters are configured in the deployment descriptor of a web application
+ * <p>
+ * Examples that have been identified for this design are<br>
+ * 1) Authentication Filters <br>
+ * 2) Logging and Auditing Filters <br>
+ * 3) Image conversion Filters <br>
+ * 4) Data compression Filters <br>
+ * 5) Encryption Filters <br>
+ * 6) Tokenizing Filters <br>
+ * 7) Filters that trigger resource access events <br>
+ * 8) XSL/T filters <br>
+ * 9) Mime-type chain Filter <br>
+ * <br>
  * 
  * @author Remy Maucherat
  * @author Filip Hanik
  */
-public interface CometFilter {
+public interface CometFilter extends Filter {
 
     
-    public void doFilterEvent(CometEvent event, CometFilterChain chain) throws IOException,
ServletException;
+    /**
+     * The <code>doFilterEvent</code> method of the CometFilter is called by
the container
+     * each time a request/response pair is passed through the chain due
+     * to a client event for a resource at the end of the chain. The CometFilterChain passed
in to this
+     * method allows the Filter to pass on the event to the next entity in the
+     * chain.<p>
+     * A typical implementation of this method would follow the following pattern:- <br>
+     * 1. Examine the request<br>
+     * 2. Optionally wrap the request object contained in the event with a custom implementation
to
+     * filter content or headers for input filtering and pass a CometEvent instance containing
+     * the wrapped request to the next filter<br>
+     * 3. Optionally wrap the response object contained in the event with a custom implementation
to
+     * filter content or headers for output filtering and pass a CometEvent instance containing
+     * the wrapped request to the next filter<br>
+     * 4. a) <strong>Either</strong> invoke the next entity in the chain using
the CometFilterChain object (<code>chain.doFilterEvent()</code>), <br> 
 
+     * 4. b) <strong>or</strong> not pass on the request/response pair to the
next entity in the filter chain to block the event processing<br>
+     * 5. Directly set fields on the response after invocation of the next entity in the
filter chain.
+     * 
+     * @param event the event that is being processed. Another event may be passed along
the chain.
+     * @param chain 
+     * @throws IOException
+     * @throws ServletException
+     */
+    public void doFilterEvent(CometEvent event, CometFilterChain chain)
+        throws IOException, ServletException;
     
 
 }

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometFilterChain.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometFilterChain.java?view=diff&rev=450967&r1=450966&r2=450967
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometFilterChain.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometFilterChain.java Thu Sep 28 11:51:22
2006
@@ -22,7 +22,10 @@
 import javax.servlet.ServletException;
 
 /**
- * The CometFilter interface.
+ * A CometFilterChain is an object provided by the servlet container to the developer
+ * giving a view into the invocation chain of a filtered event for a resource. Filters
+ * use the CometFilterChain to invoke the next filter in the chain, or if the calling filter
+ * is the last filter in the chain, to invoke the resource at the end of the chain.
  * 
  * @author Remy Maucherat
  * @author Filip Hanik
@@ -30,6 +33,12 @@
 public interface CometFilterChain {
 
     
+    /**
+     * Causes the next filter in the chain to be invoked, or if the calling filter is the
last filter
+     * in the chain, causes the resource at the end of the chain to be invoked.
+     *
+     * @param event the event to pass along the chain.
+     */
     public void doFilterEvent(CometEvent event) throws IOException, ServletException;
     
 

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometProcessor.java?view=diff&rev=450967&r1=450966&r2=450967
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometProcessor.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/CometProcessor.java Thu Sep 28 11:51:22
2006
@@ -25,6 +25,8 @@
  * This interface should be implemented by servlets which would like to handle
  * asynchronous IO, recieving events when data is available for reading, and
  * being able to output data without the need for being invoked by the container.
+ * Note: When this interface is implemented, the service method of the servlet will
+ * never be called, and will be replaced with a begin event.
  */
 public interface CometProcessor {
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message