|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.Resource
public abstract class Resource
A Resource is something that implements IResourceListener and provides a getResourceStream() method which returns the raw IResourceStream to be rendered back to the client browser.
Resources themselves do not currently have URLs. Instead, they are referred to by components that have URLs.
Resources can be shared throughout an application by adding them to Application with addResource(Class scope, String name) or addResource(String name). A resource added in such a way is a named resource and is accessible throughout the application via Application.getResource(Class scope, String name) or Application.getResource(String name). The ResourceReference class enables easy access to such resources in a way that is light on clusters.
While resources can be shared between components, it is important to emphasize that components cannot be shared among containers. For example, you can create a button image resource with new DefaultButtonImageResource(...) and store that in the Application with addResource(). You can then assign that logical resource via ResourceReference to several ImageButton components. While the button image resource can be shared between components like this, the ImageButton components in this example are like all other components in Wicket and cannot be shared.
SharedResources
,
Serialized FormField Summary |
---|
Fields inherited from interface org.apache.wicket.IResourceListener |
---|
INTERFACE |
Constructor Summary | |
---|---|
protected |
Resource()
Constructor |
Method Summary | |
---|---|
protected void |
configureResponse(Response response)
Allows implementations to do configure the response, like setting headers etc. |
protected ValueMap |
getParameters()
|
abstract IResourceStream |
getResourceStream()
Returns a new IResourceStream that provides all data for the request. |
protected void |
invalidate()
Sets any loaded resource to null, thus forcing a reload on the next request. |
boolean |
isCacheable()
|
void |
onResourceRequested()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
Resource |
setCacheable(boolean cacheable)
Should this resource be cacheable, so will it set the last modified and the some cache headers in the response. |
void |
setParameters(Map<String,?> parameters)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Resource()
Method Detail |
---|
public abstract IResourceStream getResourceStream()
public final boolean isCacheable()
public final void onResourceRequested()
onResourceRequested
in interface IResourceListener
public final Resource setCacheable(boolean cacheable)
cacheable
- boolean if the lastmodified and cache headers must be set.
public final void setParameters(Map<String,?> parameters)
parameters
- Map of query parameters that parameterize this resourceprotected void configureResponse(Response response)
response
- the responseprotected ValueMap getParameters()
protected void invalidate()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |