Clover coverage report - Code Coverage for tapestry release 4.0-alpha-3
Coverage timestamp: Mon May 16 2005 09:05:49 EDT
file stats: LOC: 93   Methods: 1
NCLOC: 58   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
HttpServletRequestStrategy.java 83.3% 92.9% 100% 91.8%
coverage coverage
 1   
 // Copyright 2005 The Apache Software Foundation
 2   
 //
 3   
 // Licensed under the Apache License, Version 2.0 (the "License");
 4   
 // you may not use this file except in compliance with the License.
 5   
 // You may obtain a copy of the License at
 6   
 //
 7   
 //     http://www.apache.org/licenses/LICENSE-2.0
 8   
 //
 9   
 // Unless required by applicable law or agreed to in writing, software
 10   
 // distributed under the License is distributed on an "AS IS" BASIS,
 11   
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12   
 // See the License for the specific language governing permissions and
 13   
 // limitations under the License.
 14   
 
 15   
 package org.apache.tapestry.describe;
 16   
 
 17   
 import java.util.Iterator;
 18   
 import java.util.List;
 19   
 
 20   
 import javax.servlet.http.HttpServletRequest;
 21   
 
 22   
 import org.apache.tapestry.web.WebUtils;
 23   
 
 24   
 /**
 25   
  * Strategy for describing an {@link javax.servlet.http.HttpServletRequest}.
 26   
  * 
 27   
  * @author Howard M. Lewis Ship
 28   
  * @since 4.0
 29   
  */
 30   
 public class HttpServletRequestStrategy implements DescribableStrategy
 31   
 {
 32   
 
 33  22
     public void describeObject(Object object, DescriptionReceiver receiver)
 34   
     {
 35  22
         HttpServletRequest request = (HttpServletRequest) object;
 36   
 
 37  22
         receiver.title("HttpServletRequest");
 38  22
         receiver.property("authType", request.getAuthType());
 39  22
         receiver.property("characterEncoding", request.getCharacterEncoding());
 40  22
         receiver.property("contentLength", request.getContentLength());
 41  22
         receiver.property("contextPath", request.getContextPath());
 42  22
         receiver.property("contentType", request.getContentType());
 43  22
         receiver.array("cookies", request.getCookies());
 44  22
         receiver.property("locale", request.getLocale());
 45  22
         receiver.property("method", request.getMethod());
 46  22
         receiver.property("pathInfo", request.getPathInfo());
 47  22
         receiver.property("pathTranslated", request.getPathTranslated());
 48  22
         receiver.property("protocol", request.getProtocol());
 49  22
         receiver.property("queryString", request.getQueryString());
 50  22
         receiver.property("requestURI", request.getRequestURI());
 51  22
         receiver.property("scheme", request.getScheme());
 52  22
         receiver.property("secure", request.isSecure());
 53  22
         receiver.property("serverName", request.getServerName());
 54  22
         receiver.property("serverPort", request.getServerPort());
 55  22
         receiver.property("servletPath", request.getServletPath());
 56  22
         receiver.property("userPrincipal", request.getUserPrincipal());
 57   
 
 58  22
         receiver.section("Parameters");
 59   
 
 60  22
         List keys = WebUtils.toSortedList(request.getParameterNames());
 61  22
         Iterator i = keys.iterator();
 62  22
         while (i.hasNext())
 63   
         {
 64  51
             String key = (String) i.next();
 65  51
             String[] values = request.getParameterValues(key);
 66   
 
 67  51
             receiver.array(key, values);
 68   
         }
 69   
 
 70  22
         receiver.section("Headers");
 71  22
         keys = WebUtils.toSortedList(request.getHeaderNames());
 72  22
         i = keys.iterator();
 73  22
         while (i.hasNext())
 74   
         {
 75  0
             String key = (String) i.next();
 76  0
             String value = request.getHeader(key);
 77   
 
 78  0
             receiver.property(key, value);
 79   
         }
 80   
 
 81  22
         receiver.section("Attributes");
 82  22
         keys = WebUtils.toSortedList(request.getAttributeNames());
 83  22
         i = keys.iterator();
 84  22
         while (i.hasNext())
 85   
         {
 86  22
             String key = (String) i.next();
 87  22
             Object value = request.getAttribute(key);
 88   
 
 89  22
             receiver.property(key, value);
 90   
         }
 91   
     }
 92   
 
 93   
 }