Class DefaultFaceletFactory
java.lang.Object
org.apache.myfaces.view.facelets.FaceletFactory
org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory
Default FaceletFactory implementation.
- Version:
- $Id$
- Author:
- Jacob Hookom
-
Field Summary
FieldsFields inherited from class org.apache.myfaces.view.facelets.FaceletFactory
LAST_RESOURCE_RESOLVED -
Constructor Summary
ConstructorsConstructorDescriptionDefaultFaceletFactory(Compiler compiler) DefaultFaceletFactory(Compiler compiler, long refreshPeriod) -
Method Summary
Modifier and TypeMethodDescriptionprotected String_removeFirst(String string, String toRemove) Removes the first appearance of toRemove in string.Compile a component tag on the fly.Compiler this factory usesgetCompositeComponentMetadataFacelet(FacesContext facesContext, String uri) Works in the same way as getFacelet(String uri), but redirect to getViewMetadataFacelet(URL url)Create a Facelet used to create composite component metadata from the passed URL.getFacelet(FacesContext facesContext, String uri) Return a Facelet instance as specified by the file at the passed URI.getFacelet(FaceletContext ctx, URL url) Create a Facelet from the passed URL, but take into account the context.getFacelet(URL url) Create a Facelet from the passed URL.longgetViewMetadataFacelet(FacesContext facesContext, String uri) Works in the same way as getFacelet(String uri), but redirect to getViewMetadataFacelet(URL url)Create a Facelet used to create view metadata from the passed URL.protected booleanneedsToBeRefreshed(org.apache.myfaces.view.facelets.impl.DefaultFacelet facelet) Template method for determining if the Facelet needs to be refreshed.resolveURL(FacesContext context, URL source, String path) Resolves a path to a URL, validating scheme, traversal, and extension.Methods inherited from class org.apache.myfaces.view.facelets.FaceletFactory
getInstance, setInstance
-
Field Details
-
log
-
-
Constructor Details
-
DefaultFaceletFactory
- Throws:
IOException
-
DefaultFaceletFactory
-
-
Method Details
-
getCompiler
Compiler this factory uses- Returns:
- final Compiler instance
-
getFacelet
public Facelet getFacelet(FacesContext facesContext, String uri) throws IOException, FaceletException, FacesException, jakarta.el.ELException Description copied from class:FaceletFactoryReturn a Facelet instance as specified by the file at the passed URI.- Specified by:
getFaceletin classFaceletFactory- Returns:
- Throws:
IOExceptionFaceletExceptionFacesExceptionjakarta.el.ELException
-
getFacelet
public Facelet getFacelet(URL url) throws IOException, FaceletException, FacesException, jakarta.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:
getFaceletin classFaceletFactory- Parameters:
url- source url- Returns:
- Facelet instance
- Throws:
IOExceptionFaceletExceptionFacesExceptionjakarta.el.ELException
-
getFacelet
public Facelet getFacelet(FaceletContext ctx, URL url) throws IOException, FaceletException, FacesException, jakarta.el.ELException Description copied from class:FaceletFactoryCreate 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:
getFaceletin classFaceletFactoryurl- source url- Returns:
- Facelet instance
- Throws:
IOExceptionFaceletExceptionFacesExceptionjakarta.el.ELException
-
getRefreshPeriod
public long getRefreshPeriod() -
resolveURL
Resolves a path to a URL, validating scheme, traversal, and extension. Absolute paths (starting with '/') are resolved via ExternalContext; relative paths are resolved against the source URL.- Parameters:
context- FacesContextsource- base URL for relative resolutionpath- path to resolve- Returns:
- resolved URL
- Throws:
IOException- if path is invalid or not found
-
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
Works in the same way as getFacelet(String uri), but redirect to getViewMetadataFacelet(URL url)- Specified by:
getViewMetadataFaceletin classFaceletFactory- Returns:
- Throws:
IOException- Since:
- 2.0
-
getViewMetadataFacelet
public Facelet getViewMetadataFacelet(URL url) throws IOException, FaceletException, FacesException, jakarta.el.ELException Description copied from class:FaceletFactoryCreate 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:
getViewMetadataFaceletin classFaceletFactory- Parameters:
url- source url- Returns:
- Facelet instance
- Throws:
IOExceptionFaceletExceptionFacesExceptionjakarta.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:
getCompositeComponentMetadataFaceletin classFaceletFactory- Returns:
- Throws:
IOException- Since:
- 2.0.1
-
getCompositeComponentMetadataFacelet
public Facelet getCompositeComponentMetadataFacelet(URL url) throws IOException, FaceletException, FacesException, jakarta.el.ELException Description copied from class:FaceletFactoryCreate 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:
getCompositeComponentMetadataFaceletin classFaceletFactory- Parameters:
url- source url- Returns:
- Facelet instance
- Throws:
IOExceptionFaceletExceptionFacesExceptionjakarta.el.ELException- Since:
- 2.0.1
-
compileComponentFacelet
public Facelet compileComponentFacelet(String taglibURI, String tagName, Map<String, Object> attributes) Description copied from class:FaceletFactoryCompile a component tag on the fly.- Specified by:
compileComponentFaceletin classFaceletFactory- Returns:
-
_removeFirst
Removes the first appearance of toRemove in string. Works just like string.replaceFirst(toRemove, ""), except that toRemove is not treated as a regex (which could cause problems with filenames).- Parameters:
string-toRemove-- Returns:
-