| java.lang.Object org.zkoss.web.util.resource.ClassWebResource
ClassWebResource | public class ClassWebResource (Code) | | Used to access resouces located in class path and under /web.
It doesn't work alone. Rather, it is a helper for servlet, such as
ZK's update servlet or
ClassWebServlet .
Typical use:
- Declares a member in the servlet to
serve the request for the resource located in class path.
- Invoke
ClassWebResource.getInstance to init the member when
Servlet.init() is called.
- Calling
ClassWebResource.service when a request is receive.
author: tomyeh |
Field Summary | |
final public static String | PATH_PREFIX The prefix of path of web resources ("/web"). |
Method Summary | |
public Extendlet | addExtendlet(String ext, Extendlet extlet) Adds an Extendlet (aka., resource processor) to process
the resource of the specified extension. | public String[] | getCompress() Returns the extension that shall be compressed if the browser
supports the compression encoding (accept-encoding). | public Extendlet | getExtendlet(String ext) Returns the Extendlet (aka., resource processor) of the
specified extension, or null if not associated yet.
Parameters: ext - the extension, e.g, "js" and "css". | final public static ClassWebResource | getInstance(ServletContext ctx, String mappingURI) Returns the instance (singlton in the whole app) for
handling resources located in class path. | public static URL | getResource(String uri) Returns the URL of the resource of the specified URI by searching
the class path (with
ClassWebResource.PATH_PREFIX ). | public static InputStream | getResourceAsStream(String uri) Returns the resource in a stream of the specified URI by searching
the class path (with
ClassWebResource.PATH_PREFIX ). | public Extendlet | removeExtendlet(String ext) Removes the Extendlet (aka., resource processor)
for the specified extension.
Parameters: ext - the extension, e.g, "js" and "css". | public void | service(HttpServletRequest request, HttpServletResponse response) Process the request by retrieving the path from the path info. | public void | service(HttpServletRequest request, HttpServletResponse response, String path) Process the request with the specified path. | public void | setCompress(String[] exts) Sets the extension that shall be compressed if the browser
supports the compression encoding (accept-encoding). |
PATH_PREFIX | final public static String PATH_PREFIX(Code) | | The prefix of path of web resources ("/web").
|
addExtendlet | public Extendlet addExtendlet(String ext, Extendlet extlet)(Code) | | Adds an Extendlet (aka., resource processor) to process
the resource of the specified extension.
Parameters: ext - the extension, e.g, "js" and "css". Parameters: extlet - the Extendlet (aka., resouce processor) to add the previous Extendlet, or null if not associated before. since: 2.4.1 |
getCompress | public String[] getCompress()(Code) | | Returns the extension that shall be compressed if the browser
supports the compression encoding (accept-encoding).
Default: null (no compression at all).
since: 2.4.1 |
getExtendlet | public Extendlet getExtendlet(String ext)(Code) | | Returns the Extendlet (aka., resource processor) of the
specified extension, or null if not associated yet.
Parameters: ext - the extension, e.g, "js" and "css". the Extendlet (aka., resource processor),or null if not associated yet. since: 2.4.1 |
removeExtendlet | public Extendlet removeExtendlet(String ext)(Code) | | Removes the Extendlet (aka., resource processor)
for the specified extension.
Parameters: ext - the extension, e.g, "js" and "css". the previous Extendlet, or null if no Extendletwas associated with the specified extension. since: 2.4.1 |
setCompress | public void setCompress(String[] exts)(Code) | | Sets the extension that shall be compressed if the browser
supports the compression encoding (accept-encoding).
Default: null (no compression at all).
Parameters: exts - an array of extensions, e.g., {"js", "css"}.If null or zero-length, it means no compression at all. since: 2.4.1 |
|
|