|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.request.resource.AbstractResource org.apache.wicket.request.resource.PackageResource
public class PackageResource
Represents a localizable static resource.
Use like eg:
MyPackageResource IMG_UNKNOWN = new MyPackageResource(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. |
Nested classes/interfaces inherited from class org.apache.wicket.request.resource.AbstractResource |
---|
AbstractResource.ResourceResponse, AbstractResource.WriteCallback |
Nested classes/interfaces inherited from interface org.apache.wicket.request.resource.IResource |
---|
IResource.Attributes |
Field Summary |
---|
Fields inherited from class org.apache.wicket.request.resource.AbstractResource |
---|
INTERNAL_HEADERS |
Constructor Summary | |
---|---|
protected |
PackageResource(Class<?> scope,
String name,
Locale locale,
String style,
String variation)
Hidden constructor. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
|
static boolean |
exists(Class<?> scope,
String path,
Locale locale,
String style,
String variation)
Gets whether a resource for a given set of criteria exists. |
IResourceStream |
getCacheableResourceStream()
be aware that method takes the current wicket session's locale and style into account when locating the stream. |
Serializable |
getCacheKey()
get unique caching key for the resource stream produced by IStaticCacheableResource.getCacheableResourceStream() |
protected IResourceStream |
getResourceStream()
locate resource stream for current resource Unfortunately this method has changed from scope 'public' in wicket 1.4 to scope 'protected' in wicket 1.5. |
Class<?> |
getScope()
Gets the scoping class, used for class loading and to determine the package. |
String |
getStyle()
Gets the style. |
String |
getTextEncoding()
get text encoding (intented for character-based resources) |
int |
hashCode()
|
protected AbstractResource.ResourceResponse |
newResourceResponse(IResource.Attributes attributes)
creates a new resource response based on the request attributes |
protected byte[] |
processResponse(IResource.Attributes attributes,
byte[] original)
Gives a chance to modify the resource going to be written in the response |
void |
setTextEncoding(String textEncoding)
set text encoding (intented for character-based resources) |
String |
toString()
|
Methods inherited from class org.apache.wicket.request.resource.AbstractResource |
---|
configureCache, flushResponseAfterHeaders, getCachingStrategy, respond, setResponseHeaders |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.wicket.request.resource.IResource |
---|
respond |
Constructor Detail |
---|
protected PackageResource(Class<?> scope, String name, Locale locale, String style, String variation)
scope
- This argument will be used to get the class loader for loading the package
resource, and to determine what package it is inname
- The relative path to the resourcelocale
- The locale of the resourcestyle
- The style of the resourcevariation
- The component's variation (of the style)Method Detail |
---|
public String getTextEncoding()
null
to use defaultpublic void setTextEncoding(String textEncoding)
textEncoding
- custom encoding or null
to use defaultpublic Serializable getCacheKey()
IStaticCacheableResource
IStaticCacheableResource.getCacheableResourceStream()
getCacheKey
in interface IStaticCacheableResource
#equals(Object)
and
#hashCode()
public final Class<?> getScope()
public final String getStyle()
protected AbstractResource.ResourceResponse newResourceResponse(IResource.Attributes attributes)
newResourceResponse
in class AbstractResource
attributes
- current request attributes from client
protected byte[] processResponse(IResource.Attributes attributes, byte[] original)
attributes
- current request attributes from clientoriginal
- the original response
public IResourceStream getCacheableResourceStream()
getCacheableResourceStream
in interface IStaticCacheableResource
IStaticCacheableResource.getCacheableResourceStream()
,
getResourceStream()
protected IResourceStream getResourceStream()
getResourceStream()
and wait for wicket
1.6getResourceStream()
public again:
public class MyPackageResource extends PackageResource { public MyPackageResource(Class<?> scope, String name, Locale locale, String style, String variation) { super(scope, name, locale, style, variation); } // change access to public here public IResourceStream getResourceStream() { return super.getResourceStream(); } }
null
if not foundpublic static boolean exists(Class<?> scope, String path, Locale locale, String style, String variation)
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
)variation
- The component's variation (of the style)
public String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |