org.apache.myfaces.view.facelets.impl
Class DefaultFaceletFactory

java.lang.Object
  extended by org.apache.myfaces.view.facelets.FaceletFactory
      extended by org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory

public final class DefaultFaceletFactory
extends FaceletFactory

Default FaceletFactory implementation.

Version:
$Id: DefaultFaceletFactory.java 1522674 2013-09-12 17:31:24Z lu4242 $
Author:
Jacob Hookom

Field Summary
protected  Logger log
           
 
Fields inherited from class org.apache.myfaces.view.facelets.FaceletFactory
LAST_RESOURCE_RESOLVED
 
Constructor Summary
DefaultFaceletFactory(Compiler compiler, ResourceResolver resolver)
           
DefaultFaceletFactory(Compiler compiler, ResourceResolver resolver, long refreshPeriod)
           
 
Method Summary
 Facelet compileComponentFacelet(String taglibURI, String tagName, Map<String,Object> attributes)
          Compile a component tag on the fly.
 Compiler getCompiler()
          Compiler this factory uses
 Facelet getCompositeComponentMetadataFacelet(FacesContext facesContext, String uri)
          Works in the same way as getFacelet(String uri), but redirect to getViewMetadataFacelet(URL url)
 Facelet getCompositeComponentMetadataFacelet(URL url)
          Create a Facelet used to create composite component metadata from the passed URL.
 Facelet getFacelet(FaceletContext ctx, URL url)
          Create a Facelet from the passed URL, but take into account the context.
 Facelet getFacelet(FacesContext facesContext, String uri)
          Return a Facelet instance as specified by the file at the passed URI.
 Facelet getFacelet(URL url)
          Create a Facelet from the passed URL.
 long getRefreshPeriod()
           
 Facelet getViewMetadataFacelet(FacesContext facesContext, String uri)
          Works in the same way as getFacelet(String uri), but redirect to getViewMetadataFacelet(URL url)
 Facelet getViewMetadataFacelet(URL url)
          Create a Facelet used to create view metadata from the passed URL.
protected  boolean needsToBeRefreshed(org.apache.myfaces.view.facelets.impl.DefaultFacelet facelet)
          Template method for determining if the Facelet needs to be refreshed.
 URL resolveURL(FacesContext context, URL source, String path)
          Resolves a path based on the passed URL.
 
Methods inherited from class org.apache.myfaces.view.facelets.FaceletFactory
getInstance, setInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final Logger log
Constructor Detail

DefaultFaceletFactory

public DefaultFaceletFactory(Compiler compiler,
                             ResourceResolver resolver)
                      throws IOException
Throws:
IOException

DefaultFaceletFactory

public DefaultFaceletFactory(Compiler compiler,
                             ResourceResolver resolver,
                             long refreshPeriod)
Method Detail

getCompiler

public Compiler getCompiler()
Compiler this factory uses

Returns:
final Compiler instance

getFacelet

public Facelet getFacelet(FacesContext facesContext,
                          String uri)
                   throws IOException,
                          FaceletException,
                          FacesException,
                          javax.el.ELException
Description copied from class: FaceletFactory
Return a Facelet instance as specified by the file at the passed URI.

Specified by:
getFacelet in class FaceletFactory
Returns:
Throws:
IOException
FaceletException
FacesException
javax.el.ELException

getFacelet

public Facelet getFacelet(URL url)
                   throws IOException,
                          FaceletException,
                          FacesException,
                          javax.el.ELException
Create a Facelet from the passed URL. This method checks if the cached Facelet needs to be refreshed before returning. If so, uses the passed URL to build a new instance;

Specified by:
getFacelet in class FaceletFactory
Parameters:
url - source url
Returns:
Facelet instance
Throws:
IOException
FaceletException
FacesException
javax.el.ELException

getFacelet

public Facelet getFacelet(FaceletContext ctx,
                          URL url)
                   throws IOException,
                          FaceletException,
                          FacesException,
                          javax.el.ELException
Description copied from class: FaceletFactory
Create a Facelet from the passed URL, but take into account the context. This method is useful in cases where the facelet instance must replace the one in the cache based on the context, instead take the one from the cache, like for example when the EL expression cache is used.

Specified by:
getFacelet in class FaceletFactory
url - source url
Returns:
Facelet instance
Throws:
IOException
FaceletException
FacesException
javax.el.ELException

getRefreshPeriod

public long getRefreshPeriod()

resolveURL

public URL resolveURL(FacesContext context,
                      URL source,
                      String path)
               throws IOException
Resolves a path based on the passed URL. If the path starts with '/', then resolve the path against javax.faces.context.ExternalContext#getResource(java.lang.String). Otherwise create a new URL via URL(URL, String).

Parameters:
source - base to resolve from
path - relative path to the source
Returns:
resolved URL
Throws:
IOException

needsToBeRefreshed

protected boolean needsToBeRefreshed(org.apache.myfaces.view.facelets.impl.DefaultFacelet facelet)
Template method for determining if the Facelet needs to be refreshed.

Parameters:
facelet - Facelet that could have expired
Returns:
true if it needs to be refreshed

getViewMetadataFacelet

public Facelet getViewMetadataFacelet(FacesContext facesContext,
                                      String uri)
                               throws IOException
Works in the same way as getFacelet(String uri), but redirect to getViewMetadataFacelet(URL url)

Specified by:
getViewMetadataFacelet in class FaceletFactory
Returns:
Throws:
IOException
Since:
2.0

getViewMetadataFacelet

public Facelet getViewMetadataFacelet(URL url)
                               throws IOException,
                                      FaceletException,
                                      FacesException,
                                      javax.el.ELException
Description copied from class: FaceletFactory
Create a Facelet used to create view metadata from the passed URL. This method checks if the cached Facelet needs to be refreshed before returning. If so, uses the passed URL to build a new instance;

Specified by:
getViewMetadataFacelet in class FaceletFactory
Parameters:
url - source url
Returns:
Facelet instance
Throws:
IOException
FaceletException
FacesException
javax.el.ELException
Since:
2.0

getCompositeComponentMetadataFacelet

public Facelet getCompositeComponentMetadataFacelet(FacesContext facesContext,
                                                    String uri)
                                             throws IOException
Works in the same way as getFacelet(String uri), but redirect to getViewMetadataFacelet(URL url)

Specified by:
getCompositeComponentMetadataFacelet in class FaceletFactory
Returns:
Throws:
IOException
Since:
2.0.1

getCompositeComponentMetadataFacelet

public Facelet getCompositeComponentMetadataFacelet(URL url)
                                             throws IOException,
                                                    FaceletException,
                                                    FacesException,
                                                    javax.el.ELException
Description copied from class: FaceletFactory
Create a Facelet used to create composite component metadata from the passed URL. This method checks if the cached Facelet needs to be refreshed before returning. If so, uses the passed URL to build a new instance.

Specified by:
getCompositeComponentMetadataFacelet in class FaceletFactory
Parameters:
url - source url
Returns:
Facelet instance
Throws:
IOException
FaceletException
FacesException
javax.el.ELException
Since:
2.0.1

compileComponentFacelet

public Facelet compileComponentFacelet(String taglibURI,
                                       String tagName,
                                       Map<String,Object> attributes)
Description copied from class: FaceletFactory
Compile a component tag on the fly.

Specified by:
compileComponentFacelet in class FaceletFactory
Returns:


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