|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
IAsset.java | - | - | - | - |
|
1 |
// Copyright 2004, 2005 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.tapestry;
|
|
16 |
|
|
17 |
import java.io.InputStream;
|
|
18 |
|
|
19 |
import org.apache.hivemind.Locatable;
|
|
20 |
import org.apache.hivemind.Resource;
|
|
21 |
|
|
22 |
/**
|
|
23 |
* Representation of a asset (GIF, JPEG, etc.) that may be owned by a {@link IComponent}.
|
|
24 |
* <p>
|
|
25 |
* Assets may be completely external (i.e., on some other web site), contained by the
|
|
26 |
* {@link javax.servlet.ServletContext}, or stored somewhere in the classpath.
|
|
27 |
* <p>
|
|
28 |
* In the latter two cases, the resource may be localized.
|
|
29 |
*
|
|
30 |
* @author Howard Lewis Ship
|
|
31 |
*/
|
|
32 |
|
|
33 |
public interface IAsset extends Locatable |
|
34 |
{ |
|
35 |
/**
|
|
36 |
* Returns a URL for the asset, ready to be inserted into the output HTML. If the asset can be
|
|
37 |
* localized, the localized version (matching the {@link java.util.Locale}of the current
|
|
38 |
* {@link IPage page}) is returned.
|
|
39 |
*
|
|
40 |
* @throws ApplicationRuntimeException
|
|
41 |
* if the asset does not exist.
|
|
42 |
*/
|
|
43 |
|
|
44 |
public String buildURL(IRequestCycle cycle);
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Accesses the localized version of the resource (if possible) and returns it as an input
|
|
48 |
* stream. A version of the resource localized to the current {@link IPage page}is returned.
|
|
49 |
*
|
|
50 |
* @throws ApplicationRuntimeException
|
|
51 |
* if the asset does not exist, or can't be read.
|
|
52 |
*/
|
|
53 |
|
|
54 |
public InputStream getResourceAsStream(IRequestCycle cycle);
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Returns the underlying location of the asset.
|
|
58 |
*/
|
|
59 |
|
|
60 |
public Resource getResourceLocation();
|
|
61 |
} |
|