org.apache.wicket.request.handler.resource
Class ResourceStreamRequestHandler

java.lang.Object
  extended by 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
ResourceStreamRequestHandler(IResourceStream resourceStream)
          Construct.
ResourceStreamRequestHandler(IResourceStream resourceStream, String fileName)
          Construct.
 
Method Summary
 void 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()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

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 response
fileName -
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 interface IRequestHandler
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 interface ILoggableRequestHandler
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 interface IRequestHandler
Parameters:
requestCycle - the current request cycle
See Also:
IRequestHandler.respond(org.apache.wicket.request.IRequestCycle)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

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 class Object
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


Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.