Module org.apache.wicket.core
Class ResourceStreamRequestHandler
java.lang.Object
org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler
- All Implemented Interfaces:
ILoggableRequestHandler
,IRequestHandler
- Direct Known Subclasses:
WebExternalResourceRequestHandler
public class ResourceStreamRequestHandler
extends Object
implements IRequestHandler, ILoggableRequestHandler
Request target that responds by sending its resource stream.
- Author:
- Eelco Hillenius
-
Constructor Summary
ConstructorsConstructorDescriptionResourceStreamRequestHandler
(IResourceStream resourceStream) Construct.ResourceStreamRequestHandler
(IResourceStream resourceStream, String fileName) Construct. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
configure
(ResourceStreamResource resource) Configures the ResourceStreamResource used by this request handlervoid
detach
(IRequestCycle requestCycle) This method is called at the end of a request cycle to indicate that processing is done and that cleaning up of the subject(s) of this target may be done.boolean
final ContentDisposition
final String
Returns the collected log data for this request handler and should never throw an exception.final IResourceStream
Gets the resource stream for the response.int
hashCode()
void
respond
(IRequestCycle requestCycle) Responds by sending the contents of the resource stream.setCacheDuration
(Duration cacheDuration) setContentDisposition
(ContentDisposition contentDisposition) setFileName
(String fileName) toString()
-
Constructor Details
-
ResourceStreamRequestHandler
Construct.- Parameters:
resourceStream
- the resource stream for the response
-
ResourceStreamRequestHandler
Construct.- Parameters:
resourceStream
- the resource stream for the responsefileName
-
-
-
Method Details
-
detach
Description copied from interface:IRequestHandler
This method is called at the end of a request cycle to indicate that processing is done and that cleaning up of the subject(s) of this target may be done.- Specified by:
detach
in interfaceIRequestHandler
- Parameters:
requestCycle
- the current request cycle
-
getLogData
Returns the collected log data for this request handler and should never throw an exception. This method is never called before the request handler is detached.- Specified by:
getLogData
in interfaceILoggableRequestHandler
- Returns:
- The collected log data.
-
getFileName
- Returns:
- Optional filename, used to set the content disposition header. Only meaningful when using with web requests.
-
getResourceStream
Gets the resource stream for the response.- Returns:
- the resource stream for the response
-
respond
Responds by sending the contents of the resource stream.- Specified by:
respond
in interfaceIRequestHandler
- Parameters:
requestCycle
- the current request cycle- See Also:
-
configure
Configures the ResourceStreamResource used by this request handler- Parameters:
resource
- the resource to configure
-
hashCode
-
equals
-
setFileName
- Parameters:
fileName
- Optional filename, used to set the content disposition header. Only meaningful when using with web requests.- Returns:
- The this.
-
toString
-
getContentDisposition
- Returns:
- ContentDisposition
-
setContentDisposition
public final ResourceStreamRequestHandler setContentDisposition(ContentDisposition contentDisposition) - Parameters:
contentDisposition
-- Returns:
- this
-
getCacheDuration
- Returns:
- the duration for which the resource will be cached by the browser
-
setCacheDuration
- Parameters:
cacheDuration
- the duration for which the resource will be cached by the browser- Returns:
- this component
-