|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WResource
eu.webtoolkit.jwt.WMemoryResource
public class WMemoryResource
A resource which streams data from memory.
This is suitable for relatively small resources, which still require some computation.
If creating the data requires computation which you would like to
post-pone until the resource is served, then you may want to
directly reimplement WResource instead and compute the data on the
fly while streaming.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WResource |
|---|
WResource.DispositionType |
| Constructor Summary | |
|---|---|
WMemoryResource()
Create a new resource. |
|
WMemoryResource(java.lang.String mimeType)
Create a new resource. |
|
| Method Summary | |
|---|---|
byte[] |
getData()
Returns the data. |
java.lang.String |
getMimeType()
Returns the mime type. |
protected void |
handleRequest(WebRequest request,
WebResponse response)
Handles a request. |
void |
setData(byte[] data)
Set data. |
void |
setMimeType(java.lang.String mimeType)
Changes the mime type. |
| Methods inherited from class eu.webtoolkit.jwt.WResource |
|---|
dataChanged, dataReceived, generateUrl, getDispositionType, getInternalPath, getSuggestedFileName, getUrl, setChanged, setDispositionType, setInternalPath, setUploadProgress, suggestFileName, suggestFileName, write, write |
| Methods inherited from class eu.webtoolkit.jwt.WObject |
|---|
addChild, getId, getObjectName, remove, setObjectName, tr |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WMemoryResource()
You must call setMimeType(String) and setData(byte[]) before using the resource.
public WMemoryResource(java.lang.String mimeType)
You must call setData(byte[]) before using the resource.
| Method Detail |
|---|
public void setData(byte[] data)
data - public java.lang.String getMimeType()
public void setMimeType(java.lang.String mimeType)
This causes the resource to be refreshed in the browser by triggering WResource.dataChanged().
mimeType - public byte[] getData()
protected void handleRequest(WebRequest request,
WebResponse response)
throws java.io.IOException
WResourceReimplement this method so that a proper response is generated for the given request. From the request object you can access request parameters and whether the request is a continuation request. In the response object, you should set the mime type and stream the output data.
handleRequest in class WResourcerequest - The request informationresponse - The response object
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||