public class WebResourceLocator extends Object
A utility for classes that need to access web resources.
This class provides a way to obtain the location of web resources without using the ServletContext. This is
especially interesting for extensions that are executed very early in the CDI startup process because the
ServletContext may not be available in this stage.
The class makes use of the WebResourceLocationProvider SPI to actually find the resources. This allows to write
custom implementations optimized for specific environments.
WebResourceLocationProvider| Constructor and Description |
|---|
WebResourceLocator() |
| Modifier and Type | Method and Description |
|---|---|
InputStream |
getWebResource(String path)
Returns the resource located at the named path as an
InputStream object. |
URL |
getWebResourceUrl(String path)
Returns the
URL for the resource located at the named path. |
public InputStream getWebResource(String path)
InputStream object. The path must begin with a
/ and is interpreted as relative to the current context root.path - The path of the resource (e.g. "/WEB-INF/web.xml")InputStream or null if the resource could not be locatedpublic URL getWebResourceUrl(String path)
URL for the resource located at the named path. The path must begin with a
/ and is interpreted as relative to the current context root.path - The path of the resource (e.g. "/WEB-INF/web.xml")URL or null if the resource could not be locatedCopyright © 2012 Seam Framework. All Rights Reserved.