org.jboss.solder.servlet.resource
Class WebResourceLocator

java.lang.Object
  extended by org.jboss.solder.servlet.resource.WebResourceLocator

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.

Author:
Christian Kaltepoth
See Also:
WebResourceLocationProvider

Constructor Summary
WebResourceLocator()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebResourceLocator

public WebResourceLocator()
Method Detail

getWebResource

public InputStream getWebResource(String path)
Returns the resource located at the named path as an InputStream object. The path must begin with a / and is interpreted as relative to the current context root.

Parameters:
path - The path of the resource (e.g. "/WEB-INF/web.xml")
Returns:
the InputStream or null if the resource could not be located

getWebResourceUrl

public URL getWebResourceUrl(String path)
Returns the 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.

Parameters:
path - The path of the resource (e.g. "/WEB-INF/web.xml")
Returns:
the URL or null if the resource could not be located


Copyright © 2008-2011 Seam Framework. All Rights Reserved.