com.liferay.faces.util.application
Class FilteredResourceBase

java.lang.Object
  extended by javax.faces.application.ViewResource
      extended by javax.faces.application.Resource
          extended by javax.faces.application.ResourceWrapper
              extended by com.liferay.faces.util.application.FilteredResourceBase
All Implemented Interfaces:
javax.faces.FacesWrapper<javax.faces.application.Resource>

public abstract class FilteredResourceBase
extends javax.faces.application.ResourceWrapper

This class provides an extension point that allows developers to filter the text of a wrapped JSF resource.

Author:
Kyle Stiemann

Field Summary
 
Fields inherited from class javax.faces.application.Resource
COMPONENT_RESOURCE_KEY
 
Constructor Summary
FilteredResourceBase()
           
 
Method Summary
protected abstract  String filter(String resourceText)
          This is an abstract method that allows developers to filter the contents of a resource (typically via String.replace(char, char) etc.) before it is written to the response.
protected  int getBufferSize()
          Returns the character buffer size used to convert the wrapped resource's InputStream to a string.
 String getContentType()
          Since this method is not supplied by the ResourceWrapper class it has to be implemented here.
protected  String getEncoding()
          Returns the encoding of the wrapped resource's InputStream.
 InputStream getInputStream()
           
 String getLibraryName()
          Since this method is not supplied by the ResourceWrapper class it has to be implemented here.
 String getResourceName()
          Since this method is not supplied by the ResourceWrapper class it has to be implemented here.
 void setContentType(String contentType)
          Since this method is not supplied by the ResourceWrapper class it has to be implemented here.
 void setLibraryName(String libraryName)
          Since this method is not supplied by the ResourceWrapper class it has to be implemented here.
 void setResourceName(String resourceName)
          Since this method is not supplied by the ResourceWrapper class it has to be implemented here.
 String toString()
          Since this method is not supplied by the ResourceWrapper class it has to be implemented here.
 
Methods inherited from class javax.faces.application.ResourceWrapper
getRequestPath, getResponseHeaders, getURL, getWrapped, userAgentNeedsUpdate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilteredResourceBase

public FilteredResourceBase()
Method Detail

getContentType

public String getContentType()
Since this method is not supplied by the ResourceWrapper class it has to be implemented here.

Overrides:
getContentType in class javax.faces.application.ResourceWrapper

getInputStream

public InputStream getInputStream()
                           throws IOException
Overrides:
getInputStream in class javax.faces.application.ResourceWrapper
Throws:
IOException

getLibraryName

public String getLibraryName()
Since this method is not supplied by the ResourceWrapper class it has to be implemented here.

Overrides:
getLibraryName in class javax.faces.application.ResourceWrapper

getResourceName

public String getResourceName()
Since this method is not supplied by the ResourceWrapper class it has to be implemented here.

Overrides:
getResourceName in class javax.faces.application.ResourceWrapper

setContentType

public void setContentType(String contentType)
Since this method is not supplied by the ResourceWrapper class it has to be implemented here.

Overrides:
setContentType in class javax.faces.application.ResourceWrapper

setLibraryName

public void setLibraryName(String libraryName)
Since this method is not supplied by the ResourceWrapper class it has to be implemented here.

Overrides:
setLibraryName in class javax.faces.application.ResourceWrapper

setResourceName

public void setResourceName(String resourceName)
Since this method is not supplied by the ResourceWrapper class it has to be implemented here.

Overrides:
setResourceName in class javax.faces.application.ResourceWrapper

toString

public String toString()
Since this method is not supplied by the ResourceWrapper class it has to be implemented here.

Overrides:
toString in class javax.faces.application.Resource

filter

protected abstract String filter(String resourceText)
This is an abstract method that allows developers to filter the contents of a resource (typically via String.replace(char, char) etc.) before it is written to the response.

Parameters:
resourceText - The string containing the text content of the resource.
Returns:
the filtered contents of the resource.

getBufferSize

protected int getBufferSize()
Returns the character buffer size used to convert the wrapped resource's InputStream to a string. Override this method to provide a different buffer size than the default (1024).


getEncoding

protected String getEncoding()
Returns the encoding of the wrapped resource's InputStream. If the Content-Encoding request header is not specified, the encoding returned from this method is used to read the InputStream. Override this method to provide a different encoding than the default ("UTF-8").



Copyright © 2019 Liferay, Inc.. All rights reserved.