Coverage report

  %line %branch
org.apache.jetspeed.pipeline.valve.impl.CleanupValveImpl
0% 
0% 

 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  * 
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.apache.jetspeed.pipeline.valve.impl;
 18  
 
 19  
 import java.util.Stack;
 20  
 
 21  
 import javax.servlet.RequestDispatcher;
 22  
 import javax.servlet.http.HttpServletRequest;
 23  
 
 24  
 import org.apache.commons.logging.Log;
 25  
 import org.apache.commons.logging.LogFactory;
 26  
 import org.apache.jetspeed.pipeline.PipelineException;
 27  
 import org.apache.jetspeed.pipeline.valve.AbstractValve;
 28  
 import org.apache.jetspeed.pipeline.valve.CleanupValve;
 29  
 import org.apache.jetspeed.pipeline.valve.ValveContext;
 30  
 import org.apache.jetspeed.request.RequestContext;
 31  
 
 32  
 /**
 33  
  * <p>
 34  
  * CleanupValveImpl
 35  
  * </p>
 36  
  * 
 37  
  * All this valve does right now is look for JSP pages that were
 38  
  * pushed onto the <code>org.apache.jetspeed.renderStack</code>
 39  
  * request attribute, and attempts to includde them.
 40  
  * 
 41  
  * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
 42  
  * @version $Id: CleanupValveImpl.java 516448 2007-03-09 16:25:47Z ate $
 43  
  *
 44  
  */
 45  
 public class CleanupValveImpl extends AbstractValve implements CleanupValve
 46  
 {
 47  
 
 48  
     public static final String RENDER_STACK_ATTR = "org.apache.jetspeed.renderStack";
 49  
 
 50  0
     private static final Log log = LogFactory.getLog(CleanupValveImpl.class);
 51  
 
 52  
     
 53  
     public CleanupValveImpl()
 54  0
     {
 55  0
     }
 56  
 
 57  
     /**
 58  
      * @see org.apache.jetspeed.pipeline.valve.Valve#invoke(org.apache.jetspeed.request.RequestContext, org.apache.jetspeed.pipeline.valve.ValveContext)
 59  
      */
 60  
     public void invoke(RequestContext request, ValveContext context) throws PipelineException
 61  
     {
 62  
 
 63  
         // Complete any renderings that are on the rendering stack 
 64  
 
 65  
         // TODO: we should abstract the rendering as we will
 66  
         // want to eventually support other types of templates
 67  
         // other than JSPs.
 68  0
         HttpServletRequest httpRequest = request.getRequest();
 69  0
         Stack renderStack = (Stack) httpRequest.getAttribute(RENDER_STACK_ATTR);
 70  0
         String fragment = null;
 71  
         try
 72  
         {
 73  0
             if (renderStack != null)
 74  
             {
 75  0
                 while (!renderStack.empty())
 76  
                 {
 77  0
                     fragment = (String) renderStack.pop();
 78  0
                     RequestDispatcher rd = httpRequest.getRequestDispatcher(fragment);
 79  0
                     rd.include(httpRequest, request.getResponse());
 80  0
                 }
 81  
             }
 82  
         }
 83  0
         catch (Exception e)
 84  
         {
 85  0
             log.error("CleanupValveImpl: failed while trying to render fragment " + fragment);
 86  0
             log.error("CleanupValveImpl: Unable to complete all renderings", e);
 87  0
         }        
 88  0
     }
 89  
     
 90  
     /**
 91  
      * @see java.lang.Object#toString()
 92  
      */
 93  
     public String toString()
 94  
     {
 95  0
         return "CleanupValveImpl";
 96  
     }
 97  
 
 98  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.