| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| Asset |
|
| 1.0;1 |
| 1 | // Copyright 2006, 2008, 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; | |
| 16 | ||
| 17 | import org.apache.tapestry5.ioc.Resource; | |
| 18 | ||
| 19 | /** | |
| 20 | * An Asset is any kind of resource that can be exposed to the client web browser. Although quite often an Asset is a | |
| 21 | * resource in a web application's context folder, within Tapestry, Assets may also be resources on the classpath (i.e., | |
| 22 | * packaged inside JARs). | |
| 23 | * <p/> | |
| 24 | * An Asset's toString() will return the URL for the resource (the same value as {@link #toClientURL()}). | |
| 25 | * <p/> | |
| 26 | * Release 5.1.0.0 introduced {@link org.apache.tapestry5.Asset2}, which extends this interface with an additional | |
| 27 | * method. | |
| 28 | */ | |
| 29 | public interface Asset | |
| 30 | { | |
| 31 | /** | |
| 32 | * Returns a URL that can be passed, unchanged, to the client in order for it to access the resource. The same value | |
| 33 | * is returned from <code>toString()</code>. | |
| 34 | * <p/> | |
| 35 | * Tapestry's built-in asset types (context and classpath) always incorporate a version number as part of the path, | |
| 36 | * and alternate implementations are encouraged to do so as well. In addition, Tapestry ensures that context and | |
| 37 | * classpath assets have a far-future expires header (to ensure aggresive caching by the client). | |
| 38 | * <p/> | |
| 39 | */ | |
| 40 | String toClientURL(); | |
| 41 | ||
| 42 | /** | |
| 43 | * Returns the underlying Resource for the Asset. | |
| 44 | */ | |
| 45 | Resource getResource(); | |
| 46 | ||
| 47 | } |