|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.renderkit.html.util.MyFacesResourceLoader
public class MyFacesResourceLoader
A ResourceLoader capable of fetching resources from the classpath, but only for classes under package org.apache.myfaces.custom.
Field Summary | |
---|---|
protected static org.apache.commons.logging.Log |
log
|
Constructor Summary | |
---|---|
MyFacesResourceLoader()
|
Method Summary | |
---|---|
protected void |
defineCaching(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String resource,
long lastModified)
Output http headers telling the browser (and possibly intermediate caches) how to cache this data. |
protected void |
defineContentHeaders(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String resource,
int contentLength,
java.lang.String contentEncoding)
Output http headers indicating the mime-type of the content being served. |
protected java.lang.Class |
loadComponentClass(java.lang.String componentClass)
|
void |
serveResource(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String resourceUri)
Given a URI of form "{partial.class.name}/{resourceName}", locate the specified file within the current classpath and write it to the response object. |
protected void |
validateCustomComponent(java.lang.Class myfacesCustomComponent)
|
protected void |
writeResource(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.io.InputStream in)
Copy the content of the specified input stream to the servlet response. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.commons.logging.Log log
Constructor Detail |
---|
public MyFacesResourceLoader()
Method Detail |
---|
public void serveResource(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String resourceUri) throws java.io.IOException
The partial class name has "org.apache.myfaces.custom." prepended to it to form the fully qualified classname. This class object is loaded, and Class.getResourceAsStream is called on it, passing a uri of "resource/" + {resourceName}.
The data written to the response stream includes http headers which define the mime content-type; this is deduced from the filename suffix of the resource.
serveResource
in interface ResourceLoader
context
- TODOrequest
- the requestresponse
- the response to write the resource content toresourceUri
- contains the uri part after the uri which
is used to identify the resource loader
java.io.IOException
ResourceLoader.serveResource(javax.servlet.ServletContext,
javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String)
protected void writeResource(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.io.InputStream in) throws java.io.IOException
java.io.IOException
protected void defineCaching(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String resource, long lastModified)
The expiry time in this header info is set to 7 days. This is not a problem as the overall URI contains a "cache key" that changes whenever the webapp is redeployed (see AddResource.getCacheKey), meaning that all browsers will effectively reload files on webapp redeploy.
protected void defineContentHeaders(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String resource, int contentLength, java.lang.String contentEncoding)
protected java.lang.Class loadComponentClass(java.lang.String componentClass) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
protected void validateCustomComponent(java.lang.Class myfacesCustomComponent)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |