wicket.request.target.resource
Class ResourceStreamRequestTarget

java.lang.Object
  extended by wicket.request.target.resource.ResourceStreamRequestTarget
All Implemented Interfaces:
IRequestTarget

public class ResourceStreamRequestTarget
extends java.lang.Object
implements IRequestTarget

Request target that responds by sending it's resources stream.

Author:
Eelco Hillenius

Constructor Summary
ResourceStreamRequestTarget(IResourceStream resourceStream)
          Construct.
ResourceStreamRequestTarget(IResourceStream resourceStream, java.lang.String responseType)
          Deprecated. Will be removed in 2.0. Response type can be determined from resource stream
 
Method Summary
protected  void configure(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 alled on 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()
           
 java.lang.Object getLock(RequestCycle requestCycle)
          Gets the lock to be used for synchronization.
 IResourceStream getResourceStream()
          Gets the resource stream for the response.
 java.lang.String getResponseType()
          Deprecated. Will be removed in 2.0. Response type can be determined by looking at the resource stream
 int hashCode()
           
 void respond(RequestCycle requestCycle)
          Responds by sending the contents of the resource stream.
 void 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 responseType)
Deprecated. Will be removed in 2.0. Response type can be determined from resource stream

Construct.

Parameters:
resourceStream - the resource stream for the response
responseType - the response type, eg 'text/html'
Method Detail

detach

public void detach(RequestCycle requestCycle)
Description copied from interface: IRequestTarget
This method is alled on 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(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.

getLock

public java.lang.Object getLock(RequestCycle requestCycle)
Description copied from interface: IRequestTarget
Gets the lock to be used for synchronization.

Specified by:
getLock in interface IRequestTarget
Parameters:
requestCycle - the current request cycle
Returns:
Any lock to be used to synchronize this target or null if no synchronization is needed.
See Also:
IRequestTarget.getLock(RequestCycle)

getResourceStream

public final IResourceStream getResourceStream()
Gets the resource stream for the response.

Returns:
the resource stream for the response

getResponseType

public final java.lang.String getResponseType()
Deprecated. Will be removed in 2.0. Response type can be determined by looking at the resource stream

Gets the response type, eg 'text/html'.

Returns:
the response type, eg 'text/html'

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(wicket.RequestCycle)

setFileName

public void setFileName(java.lang.String fileName)
Parameters:
fileName - Optional filename, used to set the content disposition header. Only meaningful when using with web requests.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

configure

protected void configure(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:
response - the response
resourceStream - the resource stream that will be rendered


Copyright © 2004-2007 Wicket developers. All Rights Reserved.