public class ResourceHandlerImpl
extends javax.faces.application.ResourceHandler
ResourceHandler
.Modifier and Type | Field and Description |
---|---|
private long |
creationTime |
(package private) java.util.List<java.util.regex.Pattern> |
excludePatterns |
private static java.util.logging.Logger |
LOGGER |
(package private) ResourceManager |
manager |
private long |
maxAge |
private WebConfiguration |
webconfig |
Constructor and Description |
---|
ResourceHandlerImpl()
Creates a new instance of ResourceHandlerImpl
|
Modifier and Type | Method and Description |
---|---|
private java.nio.ByteBuffer |
allocateByteBuffer() |
javax.faces.application.Resource |
createResource(java.lang.String resourceName) |
javax.faces.application.Resource |
createResource(java.lang.String resourceName,
java.lang.String libraryName) |
javax.faces.application.Resource |
createResource(java.lang.String resourceName,
java.lang.String libraryName,
java.lang.String contentType) |
javax.faces.application.Resource |
createResourceFromId(java.lang.String resourceId) |
javax.faces.application.Resource |
createViewResource(javax.faces.context.FacesContext facesContext,
java.lang.String resourceName) |
private java.lang.String |
getContentType(javax.faces.context.FacesContext ctx,
java.lang.String resourceName) |
(package private) long |
getCreationTime()
This method is leveraged by
ResourceImpl to detemine if a resource
has been upated. |
java.lang.String |
getRendererTypeForResourceName(java.lang.String resourceName) |
(package private) WebConfiguration |
getWebConfig()
Utility method leveraged by ResourceImpl to reduce the cost of
looking up the WebConfiguration per-instance.
|
private void |
handleHeaders(javax.faces.context.FacesContext ctx,
javax.faces.application.Resource resource) |
void |
handleResourceRequest(javax.faces.context.FacesContext context) |
private void |
initExclusions(java.util.Map<java.lang.String,java.lang.Object> appMap)
Initialize the exclusions for this application.
|
private void |
initMaxAge() |
private boolean |
isExcluded(java.lang.String resourceId) |
boolean |
isResourceRequest(javax.faces.context.FacesContext context) |
boolean |
libraryExists(java.lang.String libraryName) |
private boolean |
libraryNameIsSafe(java.lang.String libraryName) |
private void |
logMissingResource(javax.faces.context.FacesContext ctx,
java.lang.String resourceName,
java.lang.String libraryName,
java.lang.Throwable t)
Log a message indicating a particular resource (reference by name and/or
library) could not be found.
|
private void |
logMissingResource(javax.faces.context.FacesContext ctx,
java.lang.String resourceId,
java.lang.Throwable t)
Log a message indicating a particular resource (reference by name and/or
library) could not be found.
|
private java.lang.String |
normalizeResourceRequest(javax.faces.context.FacesContext context)
Normalize the request path to exclude JSF invocation information.
|
private void |
send304(javax.faces.context.FacesContext ctx) |
private void |
send404(javax.faces.context.FacesContext ctx,
java.lang.String resourceName,
java.lang.String libraryName,
boolean logMessage) |
private void |
send404(javax.faces.context.FacesContext ctx,
java.lang.String resourceName,
java.lang.String libraryName,
java.lang.Throwable t,
boolean logMessage) |
(package private) void |
setCreationTime(long creationTime)
This method is here soley for the purpose of unit testing and will
not be invoked during normal runtime.
|
private static final java.util.logging.Logger LOGGER
ResourceManager manager
java.util.List<java.util.regex.Pattern> excludePatterns
private long creationTime
private long maxAge
private WebConfiguration webconfig
public ResourceHandlerImpl()
public javax.faces.application.Resource createResource(java.lang.String resourceName)
createResource
in class javax.faces.application.ResourceHandler
ResourceHandler.createResource(String)
public javax.faces.application.Resource createViewResource(javax.faces.context.FacesContext facesContext, java.lang.String resourceName)
createViewResource
in class javax.faces.application.ResourceHandler
public javax.faces.application.Resource createResourceFromId(java.lang.String resourceId)
createResourceFromId
in class javax.faces.application.ResourceHandler
ResourceHandler.createResourceFromId(String)
public javax.faces.application.Resource createResource(java.lang.String resourceName, java.lang.String libraryName)
createResource
in class javax.faces.application.ResourceHandler
ResourceHandler.createResource(String, String)
public javax.faces.application.Resource createResource(java.lang.String resourceName, java.lang.String libraryName, java.lang.String contentType)
createResource
in class javax.faces.application.ResourceHandler
ResourceHandler.createResource(String, String, String)
public boolean libraryExists(java.lang.String libraryName)
libraryExists
in class javax.faces.application.ResourceHandler
public boolean isResourceRequest(javax.faces.context.FacesContext context)
isResourceRequest
in class javax.faces.application.ResourceHandler
ResourceHandler.isResourceRequest(javax.faces.context.FacesContext)
public java.lang.String getRendererTypeForResourceName(java.lang.String resourceName)
getRendererTypeForResourceName
in class javax.faces.application.ResourceHandler
public void handleResourceRequest(javax.faces.context.FacesContext context) throws java.io.IOException
handleResourceRequest
in class javax.faces.application.ResourceHandler
java.io.IOException
ResourceHandler.handleResourceRequest(javax.faces.context.FacesContext)
private boolean libraryNameIsSafe(java.lang.String libraryName)
private void send404(javax.faces.context.FacesContext ctx, java.lang.String resourceName, java.lang.String libraryName, boolean logMessage)
private void send404(javax.faces.context.FacesContext ctx, java.lang.String resourceName, java.lang.String libraryName, java.lang.Throwable t, boolean logMessage)
private void send304(javax.faces.context.FacesContext ctx)
long getCreationTime()
ResourceImpl
to detemine if a resource
has been upated. In short, a resource has been updated if the timestamp
is newer than the timestamp of the ResourceHandler creation time.void setCreationTime(long creationTime)
creationTime
- the time in millisecondsWebConfiguration getWebConfig()
WebConfiguration
for this applicationprivate void logMissingResource(javax.faces.context.FacesContext ctx, java.lang.String resourceName, java.lang.String libraryName, java.lang.Throwable t)
ctx
- the FacesContext
for the current requestresourceName
- the resource namelibraryName
- the resource libraryt
- the exception caught when attempting to find the resourceprivate void logMissingResource(javax.faces.context.FacesContext ctx, java.lang.String resourceId, java.lang.Throwable t)
ctx
- the FacesContext
for the current requestresourceName
- the resource namelibraryName
- the resource libraryt
- the exception caught when attempting to find the resourceprivate java.lang.String getContentType(javax.faces.context.FacesContext ctx, java.lang.String resourceName)
resourceName
- the resource of interest. The resourceName in question
may consist of zero or more path elements such that resourceName could
be something like path1/path2/resource.jpg or resource.jpgprivate java.lang.String normalizeResourceRequest(javax.faces.context.FacesContext context)
context
- the FacesContext
for the current requestprivate boolean isExcluded(java.lang.String resourceId)
resourceId
- the normalized request path as returned by
normalizeResourceRequest(javax.faces.context.FacesContext)
true
if the request matces an excluded resource,
otherwise false
private void initExclusions(java.util.Map<java.lang.String,java.lang.Object> appMap)
private void initMaxAge()
private void handleHeaders(javax.faces.context.FacesContext ctx, javax.faces.application.Resource resource)
private java.nio.ByteBuffer allocateByteBuffer()
Copyright © 2002-2013 Oracle America, Inc. All Rights Reserved.