|
||||||||||
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.DynamicWebResource
public abstract class DynamicWebResource
An WebResource subclass for dynamic resources (resources created programmatically).
This class caches the generated resource in memory, and is thus very useful for things you
generate dynamically, but reuse for a while after that. If you need resources that stream
directly and are not cached, extend WebResource
directly and implement
Resource.getResourceStream()
yourself.
Nested Class Summary | |
---|---|
static class |
DynamicWebResource.ResourceState
The resource state returned by the getResourceState() method. |
Field Summary |
---|
Fields inherited from interface org.apache.wicket.IResourceListener |
---|
INTERFACE |
Constructor Summary | |
---|---|
DynamicWebResource()
Creates a dynamic resource. |
|
DynamicWebResource(Locale locale)
Creates a dynamic resource from for the given locale |
|
DynamicWebResource(Locale locale,
String filename)
Creates a dynamic resource from for the given locale |
|
DynamicWebResource(String filename)
Creates a dynamic resource. |
Method Summary | |
---|---|
Locale |
getLocale()
Returns the resource locale. |
protected abstract DynamicWebResource.ResourceState |
getResourceState()
Gets the byte array for our dynamic resource. |
IResourceStream |
getResourceStream()
Returns a new IResourceStream that provides all data for the request. |
protected void |
setHeaders(WebResponse response)
Subclasses can override this to set there headers when the resource is being served. |
Methods inherited from class org.apache.wicket.markup.html.WebResource |
---|
configureResponse, getCacheDuration |
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, toString, wait, wait, wait |
Constructor Detail |
---|
public DynamicWebResource()
public DynamicWebResource(String filename)
filename
- The filename that will be set as the Content-Disposition header.public DynamicWebResource(Locale locale)
locale
- The locale of this resourcepublic DynamicWebResource(Locale locale, String filename)
locale
- The locale of this resourcefilename
- The filename that will be set as the Content-Disposition header.Method Detail |
---|
protected void setHeaders(WebResponse response)
WebResource
response.setDateHeader("Expires", System.currentTimeMillis() + (3600 * 1000)); response.setHeader("Cache-Control", "max-age=" + 3600);So if a resource wants to control this or doesn't want to set this info it should override this method and don't call super.
setHeaders
in class WebResource
response
- The WebResponse where set(Date)Header can be called on.WebResource.setHeaders(org.apache.wicket.protocol.http.WebResponse)
public Locale getLocale()
public IResourceStream getResourceStream()
Resource
getResourceStream
in class Resource
protected abstract DynamicWebResource.ResourceState getResourceState()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |