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
Constructors Constructor Description ResourceStreamRequestHandler(IResourceStream resourceStream)
Construct.ResourceStreamRequestHandler(IResourceStream resourceStream, String fileName)
Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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
equals(Object obj)
Duration
getCacheDuration()
ContentDisposition
getContentDisposition()
String
getFileName()
ResourceStreamLogData
getLogData()
Returns the collected log data for this request handler and should never throw an exception.IResourceStream
getResourceStream()
Gets the resource stream for the response.int
hashCode()
void
respond(IRequestCycle requestCycle)
Responds by sending the contents of the resource stream.ResourceStreamRequestHandler
setCacheDuration(Duration cacheDuration)
ResourceStreamRequestHandler
setContentDisposition(ContentDisposition contentDisposition)
ResourceStreamRequestHandler
setFileName(String fileName)
String
toString()
-
-
-
Constructor Detail
-
ResourceStreamRequestHandler
public ResourceStreamRequestHandler(IResourceStream resourceStream)
Construct.- Parameters:
resourceStream
- the resource stream for the response
-
ResourceStreamRequestHandler
public ResourceStreamRequestHandler(IResourceStream resourceStream, String fileName)
Construct.- Parameters:
resourceStream
- the resource stream for the responsefileName
-
-
-
Method Detail
-
detach
public void detach(IRequestCycle requestCycle)
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
public ResourceStreamLogData 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
public final String getFileName()
- Returns:
- Optional filename, used to set the content disposition header. Only meaningful when using with web requests.
-
getResourceStream
public final IResourceStream getResourceStream()
Gets the resource stream for the response.- Returns:
- the resource stream for the response
-
respond
public void respond(IRequestCycle requestCycle)
Responds by sending the contents of the resource stream.- Specified by:
respond
in interfaceIRequestHandler
- Parameters:
requestCycle
- the current request cycle- See Also:
IRequestHandler.respond(org.apache.wicket.request.IRequestCycle)
-
configure
protected void configure(ResourceStreamResource resource)
Configures the ResourceStreamResource used by this request handler- Parameters:
resource
- the resource to configure
-
setFileName
public final ResourceStreamRequestHandler setFileName(String fileName)
- Parameters:
fileName
- Optional filename, used to set the content disposition header. Only meaningful when using with web requests.- Returns:
- The this.
-
toString
public String toString()
- Overrides:
toString
in classObject
- See Also:
Object.toString()
-
getContentDisposition
public final ContentDisposition getContentDisposition()
- Returns:
- ContentDisposition
-
setContentDisposition
public final ResourceStreamRequestHandler setContentDisposition(ContentDisposition contentDisposition)
- Parameters:
contentDisposition
-- Returns:
- this
-
getCacheDuration
public Duration getCacheDuration()
- Returns:
- the duration for which the resource will be cached by the browser
-
setCacheDuration
public ResourceStreamRequestHandler setCacheDuration(Duration cacheDuration)
- Parameters:
cacheDuration
- the duration for which the resource will be cached by the browser- Returns:
- this component
-
-