com.primix.tapestry.asset
Class AssetService
java.lang.Object
|
+--com.primix.tapestry.engine.AbstractService
|
+--com.primix.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(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.7 2001/08/07 20:12:27 hship Exp $
- Author:
- Howard Ship
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AssetService
public AssetService(IEngine engine)
buildGesture
public Gesture buildGesture(IRequestCycle cycle,
IComponent component,
java.lang.String[] parameters)
- Builds a
Gesture
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:
com.primix.tapestry.IEngineService
- Parameters:
cycle
- Defines the request cycle being processed.component
- The component requesting the URL.parameters
- Additional parameters specific to the
component requesting the Gesture.
getName
public java.lang.String getName()
- Description copied from interface:
IEngineService
- Returns the name of the service.
service
public boolean service(IRequestCycle cycle,
ResponseOutputStream output)
throws ServletException,
java.io.IOException,
RequestCycleException
- 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.
TBD: Error handling. What to do if an IOException is
thrown, or the resource doesn't exist? Typically, we're
downloading an image file and there's no way to communicate
the error back to the client web browser.
- Following copied from interface:
com.primix.tapestry.IEngineService
- See Also:
IEngine.service(RequestContext)