|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tapestry.engine.AbstractService org.apache.tapestry.asset.AssetService
public class AssetService
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!
Constructor Summary | |
---|---|
AssetService()
|
Method Summary | |
---|---|
ILink |
getLink(IRequestCycle cycle,
IComponent component,
Object[] parameters)
Builds a ILink for a PrivateAsset . |
String |
getName()
Returns the name of the service. |
void |
service(IEngineServiceView engine,
IRequestCycle cycle,
ResponseOutputStream output)
Retrieves a resource from the classpath and returns it to the client in a binary output stream. |
Methods inherited from class org.apache.tapestry.engine.AbstractService |
---|
constructLink, getParameters, getServiceContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AssetService()
Method Detail |
---|
public ILink getLink(IRequestCycle cycle, IComponent component, Object[] parameters)
ILink
for a PrivateAsset
.
A single parameter is expected, the resource path of the asset (which is expected to start with a leading slash).
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.
HttpServletResponse.encodeURL(java.lang.String)
.public String getName()
IEngineService
public void service(IEngineServiceView engine, IRequestCycle cycle, ResponseOutputStream output) throws IOException
TBD: Security issues. Hackers can download .class files.
engine
- a view of the IEngine
with additional methods needed by servicescycle
- the incoming requestoutput
- stream to which output should ultimately be directed
IOException
IEngine.service(org.apache.tapestry.request.RequestContext)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |