|
||||||||||
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.ResourceResponse
public static class AbstractResource.ResourceResponse
Represents data used to configure response and write resource data.
Constructor Summary | |
---|---|
AbstractResource.ResourceResponse()
Construct. |
Method Summary | |
---|---|
boolean |
dataNeedsToBeWritten(IResource.Attributes attributes)
Check to determine if the resource data needs to be written. |
void |
disableCaching()
disable caching |
Duration |
getCacheDuration()
returns how long this resource may be cached The special value Duration.NONE means caching is disabled. |
WebResponse.CacheScope |
getCacheScope()
returns what kind of caches are allowed to cache the resource response resources are only cached at all if caching is enabled by setting a cache duration. |
ContentDisposition |
getContentDisposition()
|
long |
getContentLength()
|
String |
getContentType()
|
Integer |
getErrorCode()
|
String |
getErrorMessage()
|
String |
getFileName()
|
HttpHeaderCollection |
getHeaders()
get custom headers |
Time |
getLastModified()
|
Integer |
getStatusCode()
|
protected String |
getTextEncoding()
|
AbstractResource.WriteCallback |
getWriteCallback()
|
void |
setCacheDuration(Duration duration)
Controls how long this response may be cached |
void |
setCacheDurationToMaximum()
set caching to maximum available duration |
void |
setCacheScope(WebResponse.CacheScope scope)
controls what kind of caches are allowed to cache the response resources are only cached at all if caching is enabled by setting a cache duration. |
void |
setContentDisposition(ContentDisposition contentDisposition)
Determines whether the resource will be inline or an attachment. |
void |
setContentLength(long contentLength)
Sets the content length (in bytes) of the data. |
void |
setContentType(String contentType)
Sets the content type for the resource. |
void |
setError(Integer errorCode)
Sets the error code for resource. |
void |
setError(Integer errorCode,
String errorMessage)
Sets the error code and message for resource. |
void |
setFileName(String fileName)
Sets the file name of the resource. |
void |
setLastModified(Time lastModified)
Sets the last modified data of the resource. |
void |
setStatusCode(Integer statusCode)
Sets the status code for resource. |
void |
setTextEncoding(String textEncoding)
Sets the text encoding for the resource. |
void |
setWriteCallback(AbstractResource.WriteCallback writeCallback)
Sets the AbstractResource.WriteCallback . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractResource.ResourceResponse()
Method Detail |
---|
public void setError(Integer errorCode)
errorCode
- error codepublic void setError(Integer errorCode, String errorMessage)
errorCode
- error codeerrorMessage
- error messagepublic Integer getErrorCode()
null
public void setStatusCode(Integer statusCode)
statusCode
- status codepublic Integer getStatusCode()
null
public String getErrorMessage()
null
public void setFileName(String fileName)
fileName
- file namepublic String getFileName()
public void setContentDisposition(ContentDisposition contentDisposition)
contentDisposition
- content disposition (attachment or inline)ContentDisposition
public ContentDisposition getContentDisposition()
public void setContentType(String contentType)
contentType
- content type (also known as mime type)public String getContentType()
public void setTextEncoding(String textEncoding)
textEncoding
- character encoding of text bodyprotected String getTextEncoding()
public void setContentLength(long contentLength)
contentLength
- length of response bodypublic long getContentLength()
public void setLastModified(Time lastModified)
If-Modified-Since
to determine if the actuall data really needs to be sent
to client.
lastModified
- last modification timestamppublic Time getLastModified()
public boolean dataNeedsToBeWritten(IResource.Attributes attributes)
If-Modified-Since
request header and compares it to lastModified property.
In order for this method to work setLastModified(Time)
has to be called first.
attributes
- request attributes
true
if the resource data does need to be written,
false
otherwise.public void disableCaching()
public void setCacheDurationToMaximum()
public void setCacheDuration(Duration duration)
duration
- caching duration in secondspublic Duration getCacheDuration()
IResourceSettings.setDefaultCacheDuration(org.apache.wicket.util.time.Duration)
,
IResourceSettings.getDefaultCacheDuration()
public WebResponse.CacheScope getCacheScope()
getCacheDuration()
,
setCacheDuration(org.apache.wicket.util.time.Duration)
,
WebResponse.CacheScope
public void setCacheScope(WebResponse.CacheScope scope)
scope
- scope for cachinggetCacheDuration()
,
setCacheDuration(org.apache.wicket.util.time.Duration)
,
WebResponse.CacheScope
public void setWriteCallback(AbstractResource.WriteCallback writeCallback)
AbstractResource.WriteCallback
. The callback is responsible for generating the response
data.
It is necessary to set the AbstractResource.WriteCallback
if
dataNeedsToBeWritten(org.apache.wicket.request.resource.IResource.Attributes)
returns true
and setError(Integer)
has not been called.
writeCallback
- write callbackpublic AbstractResource.WriteCallback getWriteCallback()
public HttpHeaderCollection getHeaders()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |