org.apache.tapestry.asset
Class AssetService
java.lang.Object
|
+--org.apache.tapestry.engine.AbstractService
|
+--org.apache.tapestry.asset.AssetService
- All Implemented Interfaces:
- IEngineService
- public class AssetService
- extends AbstractService
A service for building URLs to and accessing IAsset
s.
Most of the work is deferred to the IAsset
instance.
The retrieval part is directly linked to PrivateAsset
.
The service responds to a URL that encodes the path of a resource
within the classpath. The
service(IEngineServiceView, IRequestCycle, ResponseOutputStream)
method reads the resource and streams it out.
TBD: Security issues. Should only be able to retrieve a
resource that was previously registerred in some way
... otherwise, hackers will be able to suck out the .class files
of the application!
- Version:
- $Id: AssetService.java,v 1.6 2003/09/04 15:39:18 ehatcher Exp $
- Author:
- Howard Lewis Ship
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AssetService
public AssetService()
getLink
public ILink getLink(IRequestCycle cycle,
IComponent component,
Object[] parameters)
- Builds a
ILink
for a PrivateAsset
.
A single parameter is expected, the resource path of the asset
(which is expected to start with a leading slash).
- Following copied from interface:
org.apache.tapestry.engine.IEngineService
- Parameters:
cycle
- Defines the request cycle being processed.component
- The component requesting the URL. Generally, the
service context is established from the component.parameters
- Additional parameters specific to the
component requesting the EngineServiceLink.- Returns:
- The URL for the service. The URL will have to be encoded
via
HttpServletResponse#encodeURL(java.lang.String)
.
getName
public String getName()
- Description copied from interface:
IEngineService
- Returns the name of the service.
service
public void service(IEngineServiceView engine,
IRequestCycle cycle,
ResponseOutputStream output)
throws ServletException,
IOException
- Retrieves a resource from the classpath and returns it to the
client in a binary output stream.
TBD: Security issues. Hackers can download .class files.
- Following copied from interface:
org.apache.tapestry.engine.IEngineService
- Parameters:
engine
- a view of the IEngine
with additional methods needed by servicescycle
- the incoming requestoutput
- stream to which output should ultimately be directed- See Also:
IEngine#service(RequestContext)