Package eu.webtoolkit.jwt
Class WCspErrorLogger
java.lang.Object
eu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WResource
eu.webtoolkit.jwt.WCspErrorLogger
An object which can be rendered in the HTTP protocol.
Usage
Besides the main page, other objects may be rendered as additional resources, for example documents or images. Classes such asWAnchor or
WImage can use a resource instead of a URL to provide their contents.
Whenever the resource has changed, you should call the setChanged() method.
setChanged() will make sure that the browser will use a new version of the
resource by generating a new URL, and emits the dataChanged() signal to make
those that refer to the resource aware that they should update their
references to the new URL.
You can help the browser to start a suitable helper application to handle the
resource, or suggest to the user a suitable filename for saving the resource,
by setting an appropriate file name using WResource.suggestFileName(String).
To serve resources that you create on the fly, you need to specialize this
class and reimplement handleRequest(WebRequest, WebResponse).
Concurrency issues
Because of the nature of the web, a resource may be requested one time or multiple times at the discretion of the browser, and therefore your resource should in general not have any side-effects except for what is needed to render its own contents. Unlike event notifications to a JWt application, resource requests are not serialized, but are handled concurrently. Therefore you are not allowed to access or modify widget state from within the resource, unless you provide your own locking mechanism for it.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WResource
WResource.DispositionTypeNested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a CSP error logger.WCspErrorLogger(int maxReportSize) Construct a CSP error logger with the given maximum report size. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidhandleRequest(WebRequest request, WebResponse response) Handles a request.protected voidMethods inherited from class eu.webtoolkit.jwt.WResource
dataChanged, dataExceeded, dataReceived, generateUrl, getAlternativeBotUrl, getBotResource, getBotResourceId, getDispositionType, getInternalPath, getSuggestedFileName, getUrl, getVersion, incrementVersion, isAllowAutoRemoval, isInvalidAfterChanged, setAllowAutoRemoval, setAlternativeBotUrl, setBotResourceId, setChanged, setDispositionType, setInternalPath, setInvalidAfterChanged, setTakesUpdateLock, setUploadProgress, suggestFileName, suggestFileName, takesUpdateLock, useCustomBotResourceId, write, write, writeToMemoryMethods inherited from class eu.webtoolkit.jwt.WObject
getId, getObjectName, remove, resendFormData, setFormData, setObjectName, tr
-
Constructor Details
-
WCspErrorLogger
public WCspErrorLogger()Construct a CSP error logger. -
WCspErrorLogger
public WCspErrorLogger(int maxReportSize) Construct a CSP error logger with the given maximum report size.
-
-
Method Details
-
handleRequest
Description copied from class:WResourceHandles 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:
handleRequestin classWResource- Parameters:
request- The request informationresponse- The response object- Throws:
IOException
-
logReport
-