|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.Resource
org.apache.wicket.markup.html.WebResource
org.apache.wicket.markup.html.PackageResource
public class PackageResource
Represents a localizable static resource.
Use like eg:
PackageResource IMG_UNKNOWN = PackageResource.get(EditPage.class, "questionmark.gif");where the static resource references image 'questionmark.gif' from the the package that EditPage is in to get a package resource. Access to resources can be granted or denied via a
IPackageResourceGuard
. Please see
IResourceSettings.getPackageResourceGuard()
as well.
Nested Class Summary | |
---|---|
static class |
PackageResource.PackageResourceBlockedException
Exception thrown when the creation of a package resource is not allowed. |
Field Summary | |
---|---|
static Pattern |
EXTENSION_CSS
Deprecated. Will be removed in 2.0; contribute resources one by one instead |
static Pattern |
EXTENSION_JS
Deprecated. Will be removed in 2.0; contribute resources one by one instead |
Fields inherited from interface org.apache.wicket.IResourceListener |
---|
INTERFACE |
Constructor Summary | |
---|---|
protected |
PackageResource(Class<?> scope,
String path,
Locale locale,
String style)
Hidden constructor. |
Method Summary | |
---|---|
boolean |
accept(Class<?> scope,
String path)
Whether the package resource that can be reached using the provided parameters may be accessed. |
static void |
bind(Application application,
Class<?> scope,
Pattern pattern)
Deprecated. Since Wicket 1.2.1 this method is effectively a no-op. package resources are automatically tried and bound as shared resources so that
they don't have to be pre-registered anymore. Will be removed in 2.0 |
static void |
bind(Application application,
Class<?> scope,
Pattern pattern,
boolean recurse)
Deprecated. Since Wicket 1.2.1 this method is effectively a no-op. package resources are automatically tried and bound as shared resources so that
they don't have to be pre-registered anymore. Will be removed in 2.0 |
static void |
bind(Application application,
Class<?> scope,
String name)
Binds a resource to the given application object. |
static void |
bind(Application application,
Class<?> scope,
String name,
Locale locale)
Binds a resource to the given application object. |
static void |
bind(Application application,
Class<?> scope,
String name,
Locale locale,
String style)
Binds a resource to the given application object. |
static boolean |
exists(Class<?> scope,
String path,
Locale locale,
String style)
Gets whether a resource for a given set of criteria exists. |
static PackageResource[] |
get(Class<?> scope,
Pattern pattern)
Deprecated. Will be removed in 2.0; contribute resources one by one instead |
static PackageResource[] |
get(Class<?> scope,
Pattern pattern,
boolean recurse)
Deprecated. Will be removed in 2.0; contribute resources one by one instead |
static PackageResource |
get(Class<?> scope,
String path)
Gets a non-localized resource for a given set of criteria. |
static PackageResource |
get(Class<?> scope,
String path,
Locale locale,
String style)
Gets the resource for a given set of criteria. |
String |
getAbsolutePath()
Gets the absolute path of the resource. |
Locale |
getLocale()
Gets the locale. |
String |
getPath()
Gets the path this resource was created with. |
IResourceStream |
getResourceStream()
Returns a new IResourceStream that provides all data for the request. |
IResourceStream |
getResourceStream(boolean failOnError)
|
Class<?> |
getScope()
Gets the scoping class, used for class loading and to determine the package. |
String |
getStyle()
Gets the style. |
Time |
lastModifiedTime()
Returns the last modified time of resource |
protected static PackageResource |
newPackageResource(Class<?> scope,
String path,
Locale locale,
String style)
Create a new PackageResource |
String |
toString()
|
Methods inherited from class org.apache.wicket.markup.html.WebResource |
---|
configureResponse, getCacheDuration, setHeaders |
Methods inherited from class org.apache.wicket.Resource |
---|
getParameters, invalidate, isCacheable, onResourceRequested, setCacheable, setParameters |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
@Deprecated public static final Pattern EXTENSION_CSS
@Deprecated public static final Pattern EXTENSION_JS
Constructor Detail |
---|
protected PackageResource(Class<?> scope, String path, Locale locale, String style)
scope
- This argument will be used to get the class loader for loading the package
resource, and to determine what package it is inpath
- The path to the resourcelocale
- The locale of the resourcestyle
- The style of the resourceMethod Detail |
---|
@Deprecated public static void bind(Application application, Class<?> scope, Pattern pattern)
package resources
are automatically tried and bound as shared resources so that
they don't have to be pre-registered anymore. Will be removed in 2.0
application
- The application to bind to.scope
- The scope of the resource.pattern
- A regular expression to match against the contents of the package of the provided
scope class (eg ".\*\.js" will add all the files with extension
"js" from that package).@Deprecated public static void bind(Application application, Class<?> scope, Pattern pattern, boolean recurse)
package resources
are automatically tried and bound as shared resources so that
they don't have to be pre-registered anymore. Will be removed in 2.0
application
- The application to bind to.scope
- The scope of the resource.pattern
- A regular expression to match against the contents of the package of the provided
scope class (eg ".\*\.js" will add all the files with extension
"js" from that package).recurse
- Whether this method should recurse into sub packagespublic static void bind(Application application, Class<?> scope, String name)
application
- The application to bind to.scope
- The scope of the resource.name
- The name of the resource (like "myfile.js")public static void bind(Application application, Class<?> scope, String name, Locale locale)
application
- The application to bind to.scope
- The scope of the resource.name
- The name of the resource (like "myfile.js")locale
- The locale of the resource.public static void bind(Application application, Class<?> scope, String name, Locale locale, String style)
application
- The application to bind to.scope
- The scope of the resource.name
- The name of the resource (like "myfile.js")locale
- The locale of the resource.style
- The style of the resource.public static boolean exists(Class<?> scope, String path, Locale locale, String style)
scope
- This argument will be used to get the class loader for loading the package
resource, and to determine what package it is in. Typically this is the class in
which you call this methodpath
- The path to the resourcelocale
- The locale of the resourcestyle
- The style of the resource (see Session
)
@Deprecated public static PackageResource[] get(Class<?> scope, Pattern pattern)
scope
- This argument will be used to get the class loader for loading the package
resource, and to determine what package it is in. Typically this is the calling
class/ the class in which you call this methodpattern
- Regexp pattern to match resources
@Deprecated public static PackageResource[] get(Class<?> scope, Pattern pattern, boolean recurse)
scope
- This argument will be used to get the class loader for loading the package
resource, and to determine what package it is in. Typically this is the calling
class/ the class in which you call this methodpattern
- Regexp pattern to match resourcesrecurse
- Whether this method should recurse into sub packages
public static PackageResource get(Class<?> scope, String path)
scope
- This argument will be used to get the class loader for loading the package
resource, and to determine what package it is in. Typically this is the calling
class/ the class in which you call this methodpath
- The path to the resource
public static PackageResource get(Class<?> scope, String path, Locale locale, String style)
scope
- This argument will be used to get the class loader for loading the package
resource, and to determine what package it is in. Typically this is the class in
which you call this methodpath
- The path to the resourcelocale
- The locale of the resourcestyle
- The style of the resource (see Session
)
protected static PackageResource newPackageResource(Class<?> scope, String path, Locale locale, String style)
scope
- This argument will be used to get the class loader for loading the package
resource, and to determine what package it is in. Typically this is the class in
which you call this methodpath
- The path to the resourcelocale
- The locale of the resourcestyle
- The style of the resource (see Session
)
public final String getAbsolutePath()
public final Locale getLocale()
public final String getPath()
public IResourceStream getResourceStream()
Resource
getResourceStream
in class Resource
public IResourceStream getResourceStream(boolean failOnError)
failOnError
- throw an AbortException when resource does not exist
public final Class<?> getScope()
public final String getStyle()
public Time lastModifiedTime()
lastModifiedTime
in interface IModifiable
public boolean accept(Class<?> scope, String path)
IPackageResourceGuard
accept
in interface IPackageResourceGuard
scope
- This argument will be used to get the class loader for loading the package
resource, and to determine what package it is inpath
- The path to the resource
IPackageResourceGuard.accept(java.lang.Class,
java.lang.String)
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |