1 /*
2 * $Id$
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
22 package org.apache.tiles.request;
23
24 import java.io.IOException;
25 import java.io.InputStream;
26 import java.util.Locale;
27
28 /**
29 * A (localized) resource accessible through the ApplicationContext.
30 * Typically this is a file inside the web application's war.
31 *
32 * @version $Rev$ $Date$
33 */
34 public interface ApplicationResource {
35
36 /**
37 * Get the path name for this resource.
38 * You can access this ressource by passing the path to
39 * {@link ApplicationContext#getResource(String) getResource}.
40 *
41 * @return the path including localization.
42 */
43 String getLocalePath();
44
45 /**
46 * Get the path name for this resource. Multiple versions of
47 * a resource can share the same path if the locale part is different.
48 *
49 * @return the path excluding localization.
50 */
51 String getPath();
52
53 /**
54 * Get the Locale for this resource.
55 *
56 * @return the Locale.
57 */
58 Locale getLocale();
59
60 /**
61 * Get the path name of another version of the resource.
62 *
63 * @param locale the Locale for the new version.
64 * @return the path including localization.
65 */
66 String getLocalePath(Locale locale);
67
68 /**
69 * Get a java.io.InputStream to read the contents of this resource.
70 *
71 * @return the InputStream.
72 * @throws IOException if the contents cannot be read.
73 */
74 InputStream getInputStream() throws IOException;
75
76 /**
77 * Get the last modification date for this resource.
78 *
79 * @return the difference, measured in milliseconds, between the current
80 * time and midnight, January 1, 1970 UTC.
81 * @throws IOException if the last modification date cannot be found.
82 */
83 long getLastModified() throws IOException;
84 }