|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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(IRequestCycle)
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!
Field Summary | |
---|---|
static java.lang.String |
DIGEST
Query parameter that stores the digest for the file; this is used to authenticate that the client is allowed to access the file. |
static java.lang.String |
PATH
Query parameter that stores the path to the resource (with a leading slash). |
Constructor Summary | |
---|---|
AssetService()
|
Method Summary | |
---|---|
ILink |
getLink(IRequestCycle cycle,
java.lang.Object parameter)
Builds a ILink for a PrivateAsset . |
java.lang.String |
getName()
Returns the name of the service. |
void |
service(IRequestCycle cycle)
Retrieves a resource from the classpath and returns it to the client in a binary output stream. |
void |
setAssetExternalizer(AssetExternalizer assetExternalizer)
|
void |
setClassResolver(org.apache.hivemind.ClassResolver classResolver)
|
void |
setContext(WebContext context)
|
void |
setDigestSource(ResourceDigestSource md5Source)
|
void |
setExceptionReporter(RequestExceptionReporter exceptionReporter)
|
void |
setLinkFactory(LinkFactory linkFactory)
|
void |
setRequest(WebRequest request)
|
void |
setResponse(WebResponse response)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PATH
public static final java.lang.String DIGEST
Constructor Detail |
---|
public AssetService()
Method Detail |
---|
public ILink getLink(IRequestCycle cycle, java.lang.Object parameter)
ILink
for a PrivateAsset
.
A single parameter is expected, the resource path of the asset (which is expected to start with a leading slash).
getLink
in interface IEngineService
cycle
- Defines the request cycle being processed.parameter
- An object that provide any additional information needed by the service. Each
service implementation will expect that an object of the proper type be passed in.
In some cases, a simple String will do; in others, a specific object (possibly
implementing an interface) will be required.
HttpServletResponse.encodeURL(java.lang.String)
.public java.lang.String getName()
IEngineService
getName
in interface IEngineService
public void service(IRequestCycle cycle) throws java.io.IOException
TBD: Security issues. Hackers can download .class files.
service
in interface IEngineService
cycle
- the incoming request
java.io.IOException
org.apache.tapestry.IEngine#service(org.apache.tapestry.request.RequestContext)
public void setExceptionReporter(RequestExceptionReporter exceptionReporter)
public void setAssetExternalizer(AssetExternalizer assetExternalizer)
public void setLinkFactory(LinkFactory linkFactory)
public void setClassResolver(org.apache.hivemind.ClassResolver classResolver)
public void setContext(WebContext context)
public void setResponse(WebResponse response)
public void setDigestSource(ResourceDigestSource md5Source)
public void setRequest(WebRequest request)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |