org.apache.wicket.request.target.resource
Class ResourceStreamRequestTarget

java.lang.Object
  extended by org.apache.wicket.request.target.resource.ResourceStreamRequestTarget
All Implemented Interfaces:
IRequestTarget
Direct Known Subclasses:
WebExternalResourceRequestTarget

public class ResourceStreamRequestTarget
extends java.lang.Object
implements IRequestTarget

Request target that responds by sending its resource stream.

Author:
Eelco Hillenius

Constructor Summary
ResourceStreamRequestTarget(IResourceStream resourceStream)
          Construct.
ResourceStreamRequestTarget(IResourceStream resourceStream, java.lang.String fileName)
          Construct.
 
Method Summary
protected  void configure(RequestCycle requestCycle, Response response, IResourceStream resourceStream)
          Configures the response, default by setting the content type and length and content disposition (in case the fileName property was set).
 void detach(RequestCycle 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(java.lang.Object obj)
           
 java.lang.String getFileName()
           
 IResourceStream getResourceStream()
          Gets the resource stream for the response.
 int hashCode()
           
 void respond(RequestCycle requestCycle)
          Responds by sending the contents of the resource stream.
 ResourceStreamRequestTarget setFileName(java.lang.String fileName)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResourceStreamRequestTarget

public ResourceStreamRequestTarget(IResourceStream resourceStream)
Construct.

Parameters:
resourceStream - the resource stream for the response

ResourceStreamRequestTarget

public ResourceStreamRequestTarget(IResourceStream resourceStream,
                                   java.lang.String fileName)
Construct.

Parameters:
resourceStream - the resource stream for the response
fileName -
Method Detail

detach

public void detach(RequestCycle requestCycle)
Description copied from interface: IRequestTarget
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 IRequestTarget
Parameters:
requestCycle - the current request cycle
See Also:
IRequestTarget.detach(org.apache.wicket.RequestCycle)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

getFileName

public java.lang.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

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

respond

public void respond(RequestCycle requestCycle)
Responds by sending the contents of the resource stream.

Specified by:
respond in interface IRequestTarget
Parameters:
requestCycle - the current request cycle
See Also:
IRequestTarget.respond(org.apache.wicket.RequestCycle)

setFileName

public ResourceStreamRequestTarget setFileName(java.lang.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 java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

configure

protected void configure(RequestCycle requestCycle,
                         Response response,
                         IResourceStream resourceStream)
Configures the response, default by setting the content type and length and content disposition (in case the fileName property was set).

Parameters:
requestCycle -
response - the response
resourceStream - the resource stream that will be rendered


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.