Coverage Report - org.apache.tapestry5.services.AssetPathConverter
 
Classes in this File Line Coverage Branch Coverage Complexity
AssetPathConverter
N/A
N/A
1
 
 1  
 // Copyright 2009 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.tapestry5.services;
 16  
 
 17  
 /**
 18  
  * Converts the {@linkplain org.apache.tapestry5.Asset#toClientURL() path (or URI) of an asset} into a new format. This
 19  
  * is the <em>hook</em> needed to make use of a <a href="http://en.wikipedia.org/wiki/Content_Delivery_Network">Content
 20  
  * Delivery Network</a>.
 21  
  * <p/>
 22  
  * The default implementation of this is <em>identity</em>, the URI is passed through unchanged. Using a contribution to
 23  
  * the {@link org.apache.tapestry5.ioc.services.ServiceOverride} service, you may override the default implementation.
 24  
  *
 25  
  * @since 5.1.0.0
 26  
  */
 27  
 public interface AssetPathConverter
 28  
 {
 29  
     /**
 30  
      * Returns true if the converter returns that same converted path for any specific asset path (in which case, the
 31  
      * converted asset path may be cached in component instance variables more aggresively). This value should be false
 32  
      * if the converted path can vary for the same input path ... that is, if external factors (such as the identity of
 33  
      * the user, or information obtained from the request) is involved in generating the final client URI.
 34  
      *
 35  
      * @return true if invariant (and therefore cachable)
 36  
      */
 37  
     boolean isInvariant();
 38  
 
 39  
     /**
 40  
      * Converts the default asset client URI to its final form, ready to be sent to the client. The default asset path
 41  
      * is an absolute path (it starts with a leading slash) and incorporates the context path if any.
 42  
      *
 43  
      * @param assetPath default asset path
 44  
      * @return a URI that can be sent to the client
 45  
      */
 46  
     String convertAssetPath(String assetPath);
 47  
 }