Package eu.webtoolkit.jwt
Class WFileResource
java.lang.Object
eu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WResource
eu.webtoolkit.jwt.WFileResource
A resource which streams data from a local file.
To update the resource, either use setFileName() to point it to a
new file, or trigger the WResource.dataChanged()
signal when only the
file contents has changed, but not the filename.
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WResource
WResource.DispositionType
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
Constructor Summary
ConstructorDescriptionWFileResource
(String mimeType, String fileName) Creates a new resource with given mime-type for a file. -
Method Summary
Modifier and TypeMethodDescriptionReturns the file name.Returns the mime type.void
handleRequest
(WebRequest request, WebResponse response) Handles a request.void
setFileName
(String fileName) Changes the file name.void
setMimeType
(String mimeType) Changes the mime type.Methods inherited from class eu.webtoolkit.jwt.WResource
dataChanged, dataExceeded, dataReceived, generateUrl, getDispositionType, getInternalPath, getSuggestedFileName, getUrl, getVersion, incrementVersion, isInvalidAfterChanged, setChanged, setDispositionType, setInternalPath, setInvalidAfterChanged, setTakesUpdateLock, setUploadProgress, suggestFileName, suggestFileName, takesUpdateLock, write, write
Methods inherited from class eu.webtoolkit.jwt.WObject
getId, getObjectName, remove, setFormData, setObjectName, tr
-
Constructor Details
-
WFileResource
Creates a new resource with given mime-type for a file.- Parameters:
mimeType
- the mime type of the file.fileName
- the file name.
-
-
Method Details
-
setFileName
Changes the file name.This causes the resource to be refreshed in the browser by triggering
WResource.dataChanged()
.- Parameters:
fileName
- the new filename.
-
getFileName
Returns the file name.- Returns:
- the file name.
-
getMimeType
Returns the mime type.- Returns:
- the mime type.
-
setMimeType
Changes the mime type.This causes the resource to be refreshed in the browser by triggering
WResource.dataChanged()
.- Parameters:
mimeType
-
-
handleRequest
Description copied from class:WResource
Handles a request.Reimplement 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.
- Specified by:
handleRequest
in classWResource
- Parameters:
request
- The request informationresponse
- The response object
-