2009/05/20 - Apache Shale has been retired.

For more information, please explore the Attic.

Coverage Report - org.apache.shale.application.ContextRelativePathFilter
 
Classes in this File Line Coverage Branch Coverage Complexity
ContextRelativePathFilter
0%
0/8
0%
0/2
3
 
 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  
 
 18  
 package org.apache.shale.application;
 19  
 
 20  
 import org.apache.shale.application.faces.ShaleWebContext;
 21  
 
 22  
 /**
 23  
  * <p>Command that filters incoming requests based on matching the
 24  
  * context-relative portion of the request URI (in other words, servlet
 25  
  * path plus path info) against regular expression patterns that are
 26  
  * configured on this instance.  See {@link AbstractRegExpFilter} for
 27  
  * details of the matching algorithm.</p>
 28  
  *
 29  
  * <p><strong>USAGE NOTE:</strong> - This command will only be effective if
 30  
  * used before the regular filter chain is processed.  In other words, you
 31  
  * should invoke it as part of a <code>preprocess</code> chain in the
 32  
  * <code>shale</code> catalog.</p>
 33  
  *
 34  
  * $Id: ContextRelativePathFilter.java 464373 2006-10-16 04:21:54Z rahul $
 35  
  *
 36  
  * @see AbstractRegExpFilter
 37  
  */
 38  0
 public class ContextRelativePathFilter extends AbstractRegExpFilter {
 39  
 
 40  
 
 41  
     // ------------------------------------------------------- Protected Methods
 42  
 
 43  
 
 44  
     /**
 45  
      * <p>Return the servlet path (if any) concatenated with the path info
 46  
      * (if any) for this request.</p>
 47  
      *
 48  
      * @param context <code>Context</code> for the current request
 49  
      */
 50  
     protected String value(ShaleWebContext context) {
 51  
 
 52  0
         String servletPath = context.getRequest().getServletPath();
 53  0
         if (servletPath == null) {
 54  0
             servletPath = "";
 55  
         }
 56  0
         String pathInfo = context.getRequest().getPathInfo();
 57  0
         if (pathInfo == null) {
 58  0
             pathInfo = "";
 59  
         }
 60  0
         return servletPath + pathInfo;
 61  
 
 62  
     }
 63  
 
 64  
 
 65  
 }