org.apache.myfaces.view.facelets.util
Class Resource

java.lang.Object
  extended by org.apache.myfaces.view.facelets.util.Resource

public final class Resource
extends Object

Author:
Roland Huss

Field Summary
protected static Logger log
           
 
Constructor Summary
Resource()
           
 
Method Summary
static URL getResourceUrl(FacesContext ctx, String path)
          Get an URL of an internal resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final Logger log
Constructor Detail

Resource

public Resource()
Method Detail

getResourceUrl

public static URL getResourceUrl(FacesContext ctx,
                                 String path)
                          throws MalformedURLException
Get an URL of an internal resource. First, ExternalContext.getResource(String) is checked for an non-null URL return value. In the case of a null return value (as it is the case for Weblogic 8.1 for a packed war), a URL with a special URL handler is constructed, which can be used for opening a serlvet resource later. Internally, this special URL handler will call ServletContext.getResourceAsStream(String) when an inputstream is requested. This works even on Weblogic 8.1

Parameters:
ctx - the faces context from which to retrieve the resource
path - an URL path
Returns:
an url representing the URL and on which getInputStream() can be called to get the resource
Throws:
MalformedURLException


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.