|
||||||||||
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 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 String |
PATH
Query parameter that stores the path to the resource (with a leading slash). |
Constructor Summary | |
---|---|
AssetService()
|
Method Summary | |
---|---|
ILink |
getLink(boolean post,
Object parameter)
Builds a ILink for a PrivateAsset . |
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 |
setClassResolver(org.apache.hivemind.ClassResolver classResolver)
|
void |
setContext(WebContext context)
|
void |
setDigestSource(ResourceDigestSource md5Source)
|
void |
setExceptionReporter(RequestExceptionReporter exceptionReporter)
|
void |
setLinkFactory(LinkFactory linkFactory)
|
void |
setLog(Log log)
|
void |
setRequest(WebRequest request)
|
void |
setResponse(WebResponse response)
|
void |
setUnprotectedMatcher(ResourceMatcher matcher)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PATH
public static final String DIGEST
Constructor Detail |
---|
public AssetService()
Method Detail |
---|
public ILink getLink(boolean post, 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
post
- if true, then the link will be used for a post (not a get, i.e., for a HTML form);
this may affect what information is encoded into the linkparameter
- 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 String getName()
IEngineService
getName
in interface IEngineService
public void service(IRequestCycle cycle) throws IOException
service
in interface IEngineService
cycle
- the incoming request
IOException
public void setExceptionReporter(RequestExceptionReporter exceptionReporter)
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)
public void setUnprotectedMatcher(ResourceMatcher matcher)
public void setLog(Log log)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |