Coverage Report - org.apache.tiles.request.AbstractRequest
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractRequest
100%
8/8
100%
2/2
2
 
 1  
 /*
 2  
  * $Id: AbstractRequest.java 1375743 2012-08-21 20:05:58Z nlebas $
 3  
  *
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  * http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 package org.apache.tiles.request;
 22  
 
 23  
 /**
 24  
  * Base request.
 25  
  *
 26  
  * @version $Rev: 1375743 $ $Date: 2010-11-14 21:32:50 +0100 (dom, 14 nov 2010)$
 27  
  */
 28  27
 public abstract class AbstractRequest implements DispatchRequest {
 29  
 
 30  
     /**
 31  
      * Name of the attribute used to store the force-include option.
 32  
      *
 33  
      */
 34  1
     public static final String FORCE_INCLUDE_ATTRIBUTE_NAME = AbstractRequest.class
 35  
             .getName() + ".FORCE_INCLUDE";
 36  
 
 37  
     /**
 38  
      * Sets the flag to force inclusion at next dispatch.
 39  
      *
 40  
      * @param forceInclude <code>true</code> means that, at the next dispatch, response
 41  
      * will be included and never forwarded.
 42  
      */
 43  
     protected void setForceInclude(boolean forceInclude) {
 44  5
         getContext(REQUEST_SCOPE).put(FORCE_INCLUDE_ATTRIBUTE_NAME, forceInclude);
 45  5
     }
 46  
 
 47  
     /**
 48  
      * Checks if, when dispatching to a resource, the result must be included
 49  
      * and not forwarded to.
 50  
      *
 51  
      * @return <code>true</code> if inclusion is forced.
 52  
      */
 53  
     protected boolean isForceInclude() {
 54  4
         Boolean forceInclude = (Boolean) getContext(REQUEST_SCOPE).get(
 55  
                 FORCE_INCLUDE_ATTRIBUTE_NAME);
 56  4
         if (forceInclude != null) {
 57  2
             return forceInclude;
 58  
         }
 59  2
         return false;
 60  
     }
 61  
 }