vmassol     2003/10/29 09:46:25

  Modified:    integration/maven/sample/src/java/org/apache/maven/cactus/sample/util
                        GenericResponseWrapper.java
                        FilterServletOutputStream.java
               integration/maven/sample/src/java/org/apache/maven/cactus/sample
                        SampleServlet.java SampleFilter.java
                        SampleBodyTag.java
  Log:
  Applied Cactus coding style
  
  Revision  Changes    Path
  1.2       +33 -24    
jakarta-cactus/integration/maven/sample/src/java/org/apache/maven/cactus/sample/util/GenericResponseWrapper.java
  
  Index: GenericResponseWrapper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/integration/maven/sample/src/java/org/apache/maven/cactus/sample/util/GenericResponseWrapper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GenericResponseWrapper.java       29 Oct 2003 17:35:11 -0000      1.1
  +++ GenericResponseWrapper.java       29 Oct 2003 17:46:25 -0000      1.2
  @@ -1,9 +1,9 @@
  -package org.apache.maven.cactus.sample.util;
  -
  -/* ====================================================================
  +/*
  + * ====================================================================
  + *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -18,21 +18,21 @@
    *    the documentation and/or other materials provided with the
    *    distribution.
    *
  - * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + * 3. The end-user documentation included with the redistribution, if
  + *    any, must include the following acknowlegement:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowledgment may appear in the software itself,
  - *    if and wherever such third-party acknowledgments normally appear.
  + *    Alternately, this acknowlegement may appear in the software itself,
  + *    if and wherever such third-party acknowlegements normally appear.
    *
  - * 4. The names "Apache" and "Apache Software Foundation" and
  - *    "Apache Maven" must not be used to endorse or promote products
  + * 4. The names "The Jakarta Project", "Cactus" and "Apache Software
  + *    Foundation" must not be used to endorse or promote products
    *    derived from this software without prior written permission. For
    *    written permission, please contact [EMAIL PROTECTED]
    *
  - * 5. Products derived from this software may not be called "Apache",
  - *    "Apache Maven", nor may "Apache" appear in their name, without
  - *    prior written permission of the Apache Software Foundation.
  + * 5. Products derived from this software may not be called "Apache"
  + *    nor may "Apache" appear in their names without prior written
  + *    permission of the Apache Group.
    *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  @@ -53,8 +53,8 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    *
  - * ====================================================================
    */
  +package org.apache.maven.cactus.sample.util;
   
   import java.io.ByteArrayOutputStream;
   import java.io.PrintWriter;
  @@ -81,7 +81,8 @@
    *
    * @see FilterServletOutputStream
    */
  -public class GenericResponseWrapper extends HttpServletResponseWrapper {
  +public class GenericResponseWrapper extends HttpServletResponseWrapper
  +{
       /**
        * Holder for the output data
        */
  @@ -108,7 +109,8 @@
       /**
        * @param theResponse the wrapped response object
        */
  -    public GenericResponseWrapper(HttpServletResponse theResponse) {
  +    public GenericResponseWrapper(HttpServletResponse theResponse)
  +    {
           super(theResponse);
           this.output = new ByteArrayOutputStream();
       }
  @@ -118,7 +120,8 @@
       /**
        * @return the data sent to the output stream
        */
  -    public byte[] getData() {
  +    public byte[] getData()
  +    {
           return output.toByteArray();
       }
   
  @@ -127,14 +130,16 @@
       /**
        * @see HttpServletResponseWrapper#getOutputStream()
        */
  -    public ServletOutputStream getOutputStream() {
  +    public ServletOutputStream getOutputStream()
  +    {
           return new FilterServletOutputStream(this.output);
       }
   
       /**
        * @see HttpServletResponseWrapper#setContentLength(int)
        */
  -    public void setContentLength(int theLength) {
  +    public void setContentLength(int theLength)
  +    {
           this.contentLength = theLength;
           super.setContentLength(theLength);
       }
  @@ -142,14 +147,16 @@
       /**
        * @see HttpServletResponseWrapper#getContentLength()
        */
  -    public int getContentLength() {
  +    public int getContentLength()
  +    {
           return this.contentLength;
       }
   
       /**
        * @see HttpServletResponseWrapper#setContentType(String)
        */
  -    public void setContentType(String theType) {
  +    public void setContentType(String theType)
  +    {
           this.contentType = theType;
           super.setContentType(theType);
       }
  @@ -157,14 +164,16 @@
       /**
        * @see HttpServletResponseWrapper#getContentType()
        */
  -    public String getContentType() {
  +    public String getContentType()
  +    {
           return this.contentType;
       }
   
       /**
        * @see HttpServletResponseWrapper#getWriter()
        */
  -    public PrintWriter getWriter() {
  +    public PrintWriter getWriter()
  +    {
           return new PrintWriter(getOutputStream(), true);
       }
   }
  
  
  
  1.2       +28 -22    
jakarta-cactus/integration/maven/sample/src/java/org/apache/maven/cactus/sample/util/FilterServletOutputStream.java
  
  Index: FilterServletOutputStream.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/integration/maven/sample/src/java/org/apache/maven/cactus/sample/util/FilterServletOutputStream.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FilterServletOutputStream.java    29 Oct 2003 17:35:11 -0000      1.1
  +++ FilterServletOutputStream.java    29 Oct 2003 17:46:25 -0000      1.2
  @@ -1,9 +1,9 @@
  -package org.apache.maven.cactus.sample.util;
  -
  -/* ====================================================================
  +/*
  + * ====================================================================
  + *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -18,21 +18,21 @@
    *    the documentation and/or other materials provided with the
    *    distribution.
    *
  - * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + * 3. The end-user documentation included with the redistribution, if
  + *    any, must include the following acknowlegement:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowledgment may appear in the software itself,
  - *    if and wherever such third-party acknowledgments normally appear.
  + *    Alternately, this acknowlegement may appear in the software itself,
  + *    if and wherever such third-party acknowlegements normally appear.
    *
  - * 4. The names "Apache" and "Apache Software Foundation" and
  - *    "Apache Maven" must not be used to endorse or promote products
  + * 4. The names "The Jakarta Project", "Cactus" and "Apache Software
  + *    Foundation" must not be used to endorse or promote products
    *    derived from this software without prior written permission. For
    *    written permission, please contact [EMAIL PROTECTED]
    *
  - * 5. Products derived from this software may not be called "Apache",
  - *    "Apache Maven", nor may "Apache" appear in their name, without
  - *    prior written permission of the Apache Software Foundation.
  + * 5. Products derived from this software may not be called "Apache"
  + *    nor may "Apache" appear in their names without prior written
  + *    permission of the Apache Group.
    *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  @@ -53,8 +53,8 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    *
  - * ====================================================================
    */
  +package org.apache.maven.cactus.sample.util;
   
   import java.io.DataOutputStream;
   import java.io.IOException;
  @@ -77,7 +77,8 @@
    *
    * @see GenericResponseWrapper
    */
  -public class FilterServletOutputStream extends ServletOutputStream {
  +public class FilterServletOutputStream extends ServletOutputStream
  +{
       /**
        * The stream where all the data will get written to
        */
  @@ -89,7 +90,8 @@
        * @param theOutput the output stream that we wrap in a
        *        <code>DataOutputStream</code> in order to hold the data
        */
  -    public FilterServletOutputStream(OutputStream theOutput) {
  +    public FilterServletOutputStream(OutputStream theOutput)
  +    {
           stream = new DataOutputStream(theOutput);
       }
   
  @@ -98,21 +100,25 @@
       /**
        * @see ServletOutputStream#write(int)
        */
  -    public void write(int b) throws IOException {
  -        stream.write(b);
  +    public void write(int theByte) throws IOException
  +    {
  +        stream.write(theByte);
       }
   
       /**
        * @see ServletOutputStream#write(byte[])
        */
  -    public void write(byte[] b) throws IOException {
  -        stream.write(b);
  +    public void write(byte[] theBytes) throws IOException
  +    {
  +        stream.write(theBytes);
       }
   
       /**
        * @see ServletOutputStream#write(byte[], int, int)
        */
  -    public void write(byte[] b, int off, int len) throws IOException {
  +    public void write(byte[] theByte, int theOffset, int theLength) 
  +        throws IOException
  +    {
           stream.write(b, off, len);
       }
   }
  
  
  
  1.2       +24 -23    
jakarta-cactus/integration/maven/sample/src/java/org/apache/maven/cactus/sample/SampleServlet.java
  
  Index: SampleServlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/integration/maven/sample/src/java/org/apache/maven/cactus/sample/SampleServlet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SampleServlet.java        29 Oct 2003 17:35:13 -0000      1.1
  +++ SampleServlet.java        29 Oct 2003 17:46:25 -0000      1.2
  @@ -1,9 +1,9 @@
  -package org.apache.maven.cactus.sample;
  -
  -/* ====================================================================
  +/*
  + * ====================================================================
  + *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -18,21 +18,21 @@
    *    the documentation and/or other materials provided with the
    *    distribution.
    *
  - * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + * 3. The end-user documentation included with the redistribution, if
  + *    any, must include the following acknowlegement:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowledgment may appear in the software itself,
  - *    if and wherever such third-party acknowledgments normally appear.
  + *    Alternately, this acknowlegement may appear in the software itself,
  + *    if and wherever such third-party acknowlegements normally appear.
    *
  - * 4. The names "Apache" and "Apache Software Foundation" and
  - *    "Apache Maven" must not be used to endorse or promote products
  + * 4. The names "The Jakarta Project", "Cactus" and "Apache Software
  + *    Foundation" must not be used to endorse or promote products
    *    derived from this software without prior written permission. For
    *    written permission, please contact [EMAIL PROTECTED]
    *
  - * 5. Products derived from this software may not be called "Apache",
  - *    "Apache Maven", nor may "Apache" appear in their name, without
  - *    prior written permission of the Apache Software Foundation.
  + * 5. Products derived from this software may not be called "Apache"
  + *    nor may "Apache" appear in their names without prior written
  + *    permission of the Apache Group.
    *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  @@ -53,8 +53,8 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    *
  - * ====================================================================
    */
  +package org.apache.maven.cactus.sample;
   
   import javax.servlet.http.HttpServlet;
   import javax.servlet.http.HttpServletRequest;
  @@ -70,27 +70,28 @@
    *
    * @version $Id$
    */
  -
  -public class SampleServlet extends HttpServlet {
  -
  +public class SampleServlet extends HttpServlet
  +{
       /**
        *Take a request object and return whether the user is authenticated o not.
        *
  -     * @param request the HttpServletRequest object
  +     * @param theRequest the HttpServletRequest object
        *
        * @return boolean whether the request is by an authenticated user or not
        *
        */
  -    public boolean isAuthenticated(HttpServletRequest request) {
  -        HttpSession session = request.getSession(false);
  +    public boolean isAuthenticated(HttpServletRequest theRequest)
  +    {
  +        HttpSession session = theRequest.getSession(false);
   
  -        if (session == null) {
  +        if (session == null)
  +        {
               return false;
           }
   
           String authenticationAttribute =
               (String) session.getAttribute("authenticated");
   
  -        return new Boolean(authenticationAttribute).booleanValue();
  +        return Boolean.valueOf(authenticationAttribute);
       }
   }
  
  
  
  1.2       +31 -23    
jakarta-cactus/integration/maven/sample/src/java/org/apache/maven/cactus/sample/SampleFilter.java
  
  Index: SampleFilter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/integration/maven/sample/src/java/org/apache/maven/cactus/sample/SampleFilter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SampleFilter.java 29 Oct 2003 17:35:13 -0000      1.1
  +++ SampleFilter.java 29 Oct 2003 17:46:25 -0000      1.2
  @@ -1,9 +1,9 @@
  -package org.apache.maven.cactus.sample;
  -
  -/* ====================================================================
  +/*
  + * ====================================================================
  + *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -18,21 +18,21 @@
    *    the documentation and/or other materials provided with the
    *    distribution.
    *
  - * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + * 3. The end-user documentation included with the redistribution, if
  + *    any, must include the following acknowlegement:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowledgment may appear in the software itself,
  - *    if and wherever such third-party acknowledgments normally appear.
  + *    Alternately, this acknowlegement may appear in the software itself,
  + *    if and wherever such third-party acknowlegements normally appear.
    *
  - * 4. The names "Apache" and "Apache Software Foundation" and
  - *    "Apache Maven" must not be used to endorse or promote products
  + * 4. The names "The Jakarta Project", "Cactus" and "Apache Software
  + *    Foundation" must not be used to endorse or promote products
    *    derived from this software without prior written permission. For
    *    written permission, please contact [EMAIL PROTECTED]
    *
  - * 5. Products derived from this software may not be called "Apache",
  - *    "Apache Maven", nor may "Apache" appear in their name, without
  - *    prior written permission of the Apache Software Foundation.
  + * 5. Products derived from this software may not be called "Apache"
  + *    nor may "Apache" appear in their names without prior written
  + *    permission of the Apache Group.
    *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  @@ -53,8 +53,8 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    *
  - * ====================================================================
    */
  +package org.apache.maven.cactus.sample;
   
   import java.io.IOException;
   import java.io.OutputStream;
  @@ -78,7 +78,8 @@
    *
    * @version $Id$
    */
  -public class SampleFilter implements Filter {
  +public class SampleFilter implements Filter
  +{
       /**
        * We need to save the filter config as the Fitler API does not offer
        * a means to get the filter config ... except in the <code>init()</code>
  @@ -93,7 +94,8 @@
        *
        * @exception ServletException on failure
        */
  -    public void init(FilterConfig theConfig) throws ServletException {
  +    public void init(FilterConfig theConfig) throws ServletException
  +    {
           this.config = theConfig;
       }
   
  @@ -111,7 +113,8 @@
        */
       public void doFilter(ServletRequest theRequest,
           ServletResponse theResponse, FilterChain theChain) throws IOException,
  -        ServletException {
  +        ServletException
  +    {
           OutputStream out = theResponse.getOutputStream();
   
           addHeader(out);
  @@ -139,10 +142,12 @@
        *
        * @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());
           }
       }
  @@ -156,10 +161,12 @@
        *
        * @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());
           }
       }
  @@ -168,6 +175,7 @@
        * Filter un-initialisation. Called by the servlet engine during the life
        * cycle of the filter.
        */
  -    public void destroy() {
  +    public void destroy()
  +    {
       }
   }
  
  
  
  1.2       +33 -23    
jakarta-cactus/integration/maven/sample/src/java/org/apache/maven/cactus/sample/SampleBodyTag.java
  
  Index: SampleBodyTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/integration/maven/sample/src/java/org/apache/maven/cactus/sample/SampleBodyTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SampleBodyTag.java        29 Oct 2003 17:35:13 -0000      1.1
  +++ SampleBodyTag.java        29 Oct 2003 17:46:25 -0000      1.2
  @@ -1,9 +1,9 @@
  -package org.apache.maven.cactus.sample;
  -
  -/* ====================================================================
  +/*
  + * ====================================================================
  + *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -18,21 +18,21 @@
    *    the documentation and/or other materials provided with the
    *    distribution.
    *
  - * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + * 3. The end-user documentation included with the redistribution, if
  + *    any, must include the following acknowlegement:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowledgment may appear in the software itself,
  - *    if and wherever such third-party acknowledgments normally appear.
  + *    Alternately, this acknowlegement may appear in the software itself,
  + *    if and wherever such third-party acknowlegements normally appear.
    *
  - * 4. The names "Apache" and "Apache Software Foundation" and
  - *    "Apache Maven" must not be used to endorse or promote products
  + * 4. The names "The Jakarta Project", "Cactus" and "Apache Software
  + *    Foundation" must not be used to endorse or promote products
    *    derived from this software without prior written permission. For
    *    written permission, please contact [EMAIL PROTECTED]
    *
  - * 5. Products derived from this software may not be called "Apache",
  - *    "Apache Maven", nor may "Apache" appear in their name, without
  - *    prior written permission of the Apache Software Foundation.
  + * 5. Products derived from this software may not be called "Apache"
  + *    nor may "Apache" appear in their names without prior written
  + *    permission of the Apache Group.
    *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  @@ -53,8 +53,8 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    *
  - * ====================================================================
    */
  +package org.apache.maven.cactus.sample;
   
   import java.io.IOException;
   
  @@ -68,10 +68,12 @@
    * and each "occurrence" of the target is replaced by the "replacement".
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Nicholas Lesiecki</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
    *
    * @version $Id$
    */
  -public class SampleBodyTag extends BodyTagSupport {
  +public class SampleBodyTag extends BodyTagSupport
  +{
       /**
        * The substring to be replaced in the body.
        */
  @@ -87,7 +89,8 @@
        *
        * @param theTarget the substring to be replaced in the body
        */
  -    public void setTarget(String theTarget) {
  +    public void setTarget(String theTarget)
  +    {
           this.target = theTarget;
       }
   
  @@ -96,14 +99,16 @@
        *
        * @param theReplacement the replacement string
        */
  -    public void setReplacement(String theReplacement) {
  +    public void setReplacement(String theReplacement)
  +    {
           this.replacement = theReplacement;
       }
   
       /**
        * @see BodyTagSupport#doAfterBody()
        */
  -    public int doAfterBody() throws JspTagException {
  +    public int doAfterBody() throws JspTagException
  +    {
           String contentString = this.bodyContent.getString();
           StringBuffer contentBuffer = new StringBuffer(contentString);
   
  @@ -111,7 +116,8 @@
           int targetLength = this.target.length();
   
           // while instances of target still exist
  -        while ((beginIndex = contentString.indexOf(this.target)) > -1) {
  +        while ((beginIndex = contentString.indexOf(this.target)) > -1)
  +        {
               int endIndex = beginIndex + targetLength;
   
               contentBuffer.replace(beginIndex, endIndex, this.replacement);
  @@ -122,9 +128,12 @@
           // write out the changed body
           JspWriter pageWriter = this.bodyContent.getEnclosingWriter();
   
  -        try {
  +        try
  +        {
               pageWriter.write(contentString);
  -        } catch (IOException e) {
  +        } 
  +        catch (IOException e)
  +        {
               throw new JspTagException(e.getMessage());
           }
   
  @@ -134,7 +143,8 @@
       /**
        * @see BodyTagSupport#release()
        */
  -    public void release() {
  +    public void release()
  +    {
           this.target = null;
           this.replacement = null;
       }
  
  
  

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

Reply via email to