commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: jakarta-commons/latka/src/java/org/apache/commons/latka/servlet ViewResponseServlet.java
Date Sat, 29 Jun 2002 13:25:22 GMT
dion        2002/06/29 06:25:22

  Modified:    latka/src/java/org/apache/commons/latka/servlet
                        ViewResponseServlet.java
  Log:
  Style and formmatting issues
  
  Revision  Changes    Path
  1.3       +103 -37   jakarta-commons/latka/src/java/org/apache/commons/latka/servlet/ViewResponseServlet.java
  
  Index: ViewResponseServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/servlet/ViewResponseServlet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ViewResponseServlet.java	16 May 2002 08:04:40 -0000	1.2
  +++ ViewResponseServlet.java	29 Jun 2002 13:25:22 -0000	1.3
  @@ -1,3 +1,64 @@
  +/*
  + * $Header$
  + * $Revision$
  + * $Date$
  + *
  + * ====================================================================
  + *
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without
  + * modification, are permitted provided that the following conditions
  + * are met:
  + *
  + * 1. Redistributions of source code must retain the above copyright
  + *    notice, this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright
  + *    notice, this list of conditions and the following disclaimer in
  + *    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 acknowlegement:
  + *       "This product includes software developed by the
  + *        Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowlegement may appear in the software itself,
  + *    if and wherever such third-party acknowlegements normally appear.
  + *
  + * 4. The names "The Jakarta Project", "Commons", 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 apache@apache.org.
  + *
  + * 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
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * ====================================================================
  + *
  + * This software consists of voluntary contributions made by many
  + * individuals on behalf of the Apache Software Foundation.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + *
  + */
  +
   package org.apache.commons.latka.servlet;
   
   import java.io.InputStream;
  @@ -17,57 +78,62 @@
   
   import org.apache.log4j.Category;
   
  +/**
  + * A servlet to view the result of running a Latka suite
  + *
  + * @author Morgan Delagrange
  + * @version $Id$
  + */
   public class ViewResponseServlet extends HttpServlet {
     
  -  public static Category _log = 
  -    Category.getInstance(ViewResponseServlet.class);
  -
  -  public void doPost(HttpServletRequest req, HttpServletResponse res) 
  -  throws IOException {
  -    doGet(req,res);
  -  }
  +    public static final Category _log = Category.getInstance(
  +        ViewResponseServlet.class);
   
  -  public void doGet(HttpServletRequest req, HttpServletResponse res) 
  -  throws IOException {
  -    HttpSession session = req.getSession();
  +    public void doPost(HttpServletRequest req, HttpServletResponse res) throws
  +        IOException {
  +        doGet(req,res);
  +    }
   
  -    List list = (List) session.getAttribute("latka.failedResponses");
  +    public void doGet(HttpServletRequest req, HttpServletResponse res) 
  +        throws IOException {
  +        HttpSession session = req.getSession();
   
  -    String responseHash = req.getParameter("responseId");
  +        List list = (List) session.getAttribute("latka.failedResponses");
   
  -    Collections.sort(list,new ToStringComparator());
  -    int i = Collections.binarySearch(list,responseHash,new ToStringComparator());
  +        String responseHash = req.getParameter("responseId");
   
  -    Response response = (Response) list.get(i);
  +        Collections.sort(list,new ToStringComparator());
  +        int i = Collections.binarySearch(list,responseHash,new ToStringComparator());
   
  -    // set the content type, if specified
  -    String contentType = response.getHeader("Content-type");
  -    _log.debug("Content type = " + contentType);
  -    if (contentType != null) {
  -      res.setHeader("Content-type",contentType);
  -    }
  +        Response response = (Response) list.get(i);
   
  -    InputStream responseStream = response.getStream();
  -    OutputStream servletStream = res.getOutputStream();
  +        // set the content type, if specified
  +        String contentType = response.getHeader("Content-type");
  +        _log.debug("Content type = " + contentType);
  +        if (contentType != null) {
  +            res.setHeader("Content-type",contentType);
  +        }
   
  -    _log.debug("got input and output streams");
  +        InputStream responseStream = response.getStream();
  +        OutputStream servletStream = res.getOutputStream();
   
  -    int someByte = responseStream.read();
  +        _log.debug("got input and output streams");
   
  -    _log.debug("read first byte: " + someByte);
  +        int someByte = responseStream.read();
   
  -    while (someByte > -1) {
  -      servletStream.write(someByte);
  -      someByte = responseStream.read();
  -    }
  +        _log.debug("read first byte: " + someByte);
   
  -    _log.debug("end doGet(HttpServletRequest,HttpServletResponse)");
  -  }
  +        while (someByte > -1) {
  +          servletStream.write(someByte);
  +          someByte = responseStream.read();
  +        }
   
  -  private class ToStringComparator implements Comparator {
  -    public int compare(Object o1, Object o2) {
  -      return o1.toString().compareTo(o2.toString());
  +        _log.debug("end doGet(HttpServletRequest,HttpServletResponse)");
       }
  -  }
   
  -}
  +    private class ToStringComparator implements Comparator {
  +        public int compare(Object o1, Object o2) {
  +            return o1.toString().compareTo(o2.toString());
  +        }
  +    }
  +}
  \ No newline at end of file
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message