vmassol     2002/08/30 13:49:37

  Modified:    sample-servlet/src/sample/j2ee13/org/apache/cactus/sample
                        SampleFilter.java
  Log:
  new coding conventions
  
  Revision  Changes    Path
  1.3       +23 -14    
jakarta-cactus/sample-servlet/src/sample/j2ee13/org/apache/cactus/sample/SampleFilter.java
  
  Index: SampleFilter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/sample-servlet/src/sample/j2ee13/org/apache/cactus/sample/SampleFilter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SampleFilter.java 10 Apr 2002 00:39:47 -0000      1.2
  +++ SampleFilter.java 30 Aug 2002 20:49:37 -0000      1.3
  @@ -55,6 +55,7 @@
   
   import java.io.IOException;
   import java.io.OutputStream;
  +
   import javax.servlet.Filter;
   import javax.servlet.FilterChain;
   import javax.servlet.FilterConfig;
  @@ -87,11 +88,12 @@
        * cycle of the filter.
        *
        * @param theConfig the filter config
  +     * 
  +     * @exception ServletException on failure
        */
       public void init(FilterConfig theConfig) throws ServletException
       {
           this.config = theConfig;
  -
       }
   
       /**
  @@ -102,19 +104,23 @@
        * @param theResponse the returned HTTP response
        * @param theChain the chain of filters extracted from the definition
        *        given in <code>web.xml</code> by the container.
  -     */
  -    public void doFilter(ServletRequest theRequest,
  -        ServletResponse theResponse, FilterChain theChain)
  -        throws IOException, ServletException
  +     * 
  +     * @exception ServletException on failure
  +     * @exception IOException on failure
  +     */
  +    public void doFilter(ServletRequest theRequest, 
  +        ServletResponse theResponse, FilterChain theChain) throws IOException,
  +        ServletException
       {
           OutputStream out = theResponse.getOutputStream();
  +
           addHeader(out);
   
           // Create a wrapper of the response so that we can later write to
           // the response (add the footer). If we did not do this, we would
           // get an error saying that the response has already been
           // committed.
  -        GenericResponseWrapper wrapper =
  +        GenericResponseWrapper wrapper = 
               new GenericResponseWrapper((HttpServletResponse) theResponse);
   
           theChain.doFilter(theRequest, wrapper);
  @@ -130,13 +136,15 @@
        * <code>web.xml</code>). Don't write anything if no parameter is defined.
        *
        * @param theOutputStream the output stream
  +     * 
  +     * @exception IOException on failure
        */
  -    protected void addHeader(OutputStream theOutputStream)
  -        throws IOException
  +    protected void addHeader(OutputStream theOutputStream) throws IOException
       {
           String header = this.config.getInitParameter("header");
   
  -        if (header != null) {
  +        if (header != null)
  +        {
               theOutputStream.write(header.getBytes());
           }
       }
  @@ -147,13 +155,15 @@
        * <code>web.xml</code>). Don't write anything if no parameter is defined.
        *
        * @param theOutputStream the output stream
  +     * 
  +     * @exception IOException on failure
        */
  -    protected void addFooter(OutputStream theOutputStream)
  -        throws IOException
  +    protected void addFooter(OutputStream theOutputStream) throws IOException
       {
           String footer = this.config.getInitParameter("footer");
   
  -        if (footer != null) {
  +        if (footer != null)
  +        {
               theOutputStream.write(footer.getBytes());
           }
       }
  @@ -165,5 +175,4 @@
       public void destroy()
       {
       }
  -
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to