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: 70   Methods: 4
NCLOC: 35   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
DecodedRequestInjector.java 100% 100% 100% 100%
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.request;
 16   
 
 17   
 import java.io.IOException;
 18   
 
 19   
 import javax.servlet.ServletException;
 20   
 import javax.servlet.http.HttpServletRequest;
 21   
 import javax.servlet.http.HttpServletResponse;
 22   
 
 23   
 import org.apache.tapestry.Tapestry;
 24   
 import org.apache.tapestry.services.ServletRequestServicer;
 25   
 import org.apache.tapestry.services.ServletRequestServicerFilter;
 26   
 import org.apache.tapestry.spec.ILibrarySpecification;
 27   
 
 28   
 /**
 29   
  * Checks to see if a {@link org.apache.tapestry.request.IRequestDecoder}has been provided as an
 30   
  * application extension, and (if so), creates a new HttpServletRequest wrapper around the decoded
 31   
  * request.
 32   
  * 
 33   
  * @author Howard M. Lewis Ship
 34   
  * @since 4.0
 35   
  */
 36   
 public class DecodedRequestInjector implements ServletRequestServicerFilter
 37   
 {
 38   
     private ILibrarySpecification _applicationSpecification;
 39   
 
 40   
     private IRequestDecoder _decoder;
 41   
 
 42  47
     public void initializeService()
 43   
     {
 44  47
         if (_applicationSpecification.checkExtension(Tapestry.REQUEST_DECODER_EXTENSION_NAME))
 45  1
             _decoder = (IRequestDecoder) _applicationSpecification.getExtension(
 46   
                     Tapestry.REQUEST_DECODER_EXTENSION_NAME,
 47   
                     IRequestDecoder.class);
 48   
     }
 49   
 
 50  150
     public void service(HttpServletRequest request, HttpServletResponse response,
 51   
             ServletRequestServicer servicer) throws IOException, ServletException
 52   
     {
 53  150
         HttpServletRequest decodedRequest = _decoder == null ? request : wrapRequest(request);
 54   
 
 55  150
         servicer.service(decodedRequest, response);
 56   
     }
 57   
 
 58  1
     public HttpServletRequest wrapRequest(HttpServletRequest request)
 59   
     {
 60  1
         DecodedRequest decodedRequest = _decoder.decodeRequest(request);
 61   
 
 62  1
         return new DecodedRequestWrapper(request, decodedRequest);
 63   
     }
 64   
 
 65  47
     public void setApplicationSpecification(ILibrarySpecification applicationSpecification)
 66   
     {
 67  47
         _applicationSpecification = applicationSpecification;
 68   
     }
 69   
 
 70   
 }