|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.renderkit.html.util.NonBufferingAddResource
public class NonBufferingAddResource
Field Summary | |
---|---|
protected String |
_contextPath
|
protected org.apache.commons.logging.Log |
log
|
protected static String |
PATH_SEPARATOR
|
Fields inherited from interface org.apache.myfaces.renderkit.html.util.AddResource |
---|
BODY_END, BODY_ONLOAD, HEADER_BEGIN |
Constructor Summary | |
---|---|
NonBufferingAddResource()
|
Method Summary | |
---|---|
void |
addInlineScriptAtPosition(javax.faces.context.FacesContext context,
ResourcePosition position,
String inlineScript)
Adds the given Inline Script at the specified document position. |
void |
addInlineStyleAtPosition(javax.faces.context.FacesContext context,
ResourcePosition position,
String inlineStyle)
Adds the given Inline Style at the specified document position. |
void |
addJavaScriptAtPosition(javax.faces.context.FacesContext context,
ResourcePosition position,
Class myfacesCustomComponent,
String resourceName)
Insert a [script src="url"] entry into the document header at the specified document position. |
void |
addJavaScriptAtPosition(javax.faces.context.FacesContext context,
ResourcePosition position,
Class myfacesCustomComponent,
String resourceName,
boolean defer)
Insert a [script src="url"] entry into the document header at the specified document position. |
void |
addJavaScriptAtPosition(javax.faces.context.FacesContext context,
ResourcePosition position,
ResourceHandler resourceHandler)
Adds the given Javascript resource to the document header at the specified document positioy by supplying a resourcehandler instance. |
void |
addJavaScriptAtPosition(javax.faces.context.FacesContext context,
ResourcePosition position,
ResourceHandler resourceHandler,
boolean defer)
Adds the given Javascript resource at the specified document position. |
void |
addJavaScriptAtPosition(javax.faces.context.FacesContext context,
ResourcePosition position,
String uri)
Insert a [script src="url"] entry into the document header at the specified document position. |
void |
addJavaScriptAtPosition(javax.faces.context.FacesContext context,
ResourcePosition position,
String uri,
boolean defer)
Adds the given Javascript resource at the specified document position. |
void |
addJavaScriptAtPositionPlain(javax.faces.context.FacesContext context,
ResourcePosition position,
Class myfacesCustomComponent,
String resourceName)
Adds the given Javascript resource at the specified document position. |
void |
addJavaScriptHere(javax.faces.context.FacesContext context,
Class myfacesCustomComponent,
String resourceName)
Insert a [script src="url"] entry at the current location in the response. |
void |
addJavaScriptHere(javax.faces.context.FacesContext context,
ResourceHandler resourceHandler)
Insert a [script src="url"] entry at the current location in the response. |
void |
addJavaScriptHere(javax.faces.context.FacesContext context,
String uri)
Insert a [script src="url"] entry at the current location in the response. |
void |
addJavaScriptHerePlain(javax.faces.context.FacesContext context,
String uri)
Insert a [script src="url"] entry at the current location in the response. In constrast to the other methods this will not encode the url. |
void |
addJavaScriptToBodyTag(javax.faces.context.FacesContext context,
String javascriptEventName,
String addedJavaScript)
Deprecated. |
void |
addResourceHere(javax.faces.context.FacesContext context,
ResourceHandler resourceHandler)
|
void |
addStyleSheet(javax.faces.context.FacesContext context,
ResourcePosition position,
Class myfacesCustomComponent,
String resourceName)
Adds the given Style Sheet at the specified document position. |
void |
addStyleSheet(javax.faces.context.FacesContext context,
ResourcePosition position,
ResourceHandler resourceHandler)
Adds the given Style Sheet at the specified document position. |
void |
addStyleSheet(javax.faces.context.FacesContext context,
ResourcePosition position,
String uri)
Adds the given Style Sheet at the specified document position. |
protected long |
getCacheKey(javax.faces.context.FacesContext context)
Return a value used in the {cacheKey} part of a generated URL for a resource reference. |
protected String |
getResourceUri(javax.faces.context.FacesContext context,
Class resourceLoader,
boolean withContextPath)
Get the Path used to retrieve an resource. |
String |
getResourceUri(javax.faces.context.FacesContext context,
Class myfacesCustomComponent,
String resource)
|
String |
getResourceUri(javax.faces.context.FacesContext context,
Class myfacesCustomComponent,
String resource,
boolean withContextPath)
Return a URI that can be embedded into an HTML page to reference a resource from a Tomahawk jarfile. |
String |
getResourceUri(javax.faces.context.FacesContext context,
ResourceHandler resourceHandler)
Get the Path used to retrieve an resource. |
String |
getResourceUri(javax.faces.context.FacesContext context,
ResourceHandler resourceHandler,
boolean withContextPath)
Get the Path used to retrieve an resource. |
String |
getResourceUri(javax.faces.context.FacesContext context,
String uri)
Get the Path used to retrieve an resource. |
String |
getResourceUri(javax.faces.context.FacesContext context,
String uri,
boolean withContextPath)
Get the Path used to retrieve an resource. |
boolean |
hasHeaderBeginInfos()
check there is something to write to the header |
boolean |
isResourceUri(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpServletRequest request)
|
void |
parseResponse(javax.servlet.http.HttpServletRequest request,
String bufferedResponse,
javax.servlet.http.HttpServletResponse response)
Parses the response to mark the positions where code will be inserted |
boolean |
requiresBuffer()
return true if you require the complete response buffered |
void |
responseFinished()
called when the response has finished |
void |
responseStarted()
called when the response start |
void |
serveResource(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
void |
setContextPath(String contextPath)
the context path for the web-app. You can set the context path only once, every subsequent set will throw an SecurityException |
protected void |
validateResourceHandler(ResourceHandler resourceHandler)
Verify that the resource handler is acceptable. |
protected void |
validateResourceLoader(Class resourceloader)
Given a Class object, verify that the instances of that class implement the ResourceLoader interface. |
protected static void |
writeInlineScript(javax.faces.context.ResponseWriter writer,
String inlineScript)
|
protected static void |
writeInlineStylesheet(javax.faces.context.ResponseWriter writer,
String inlineStyle)
|
protected static void |
writeJavaScriptReference(javax.faces.context.FacesContext context,
String resourceUri,
boolean encoding,
boolean defer)
|
protected static void |
writeJavaScriptReference(javax.servlet.http.HttpServletResponse response,
javax.faces.context.ResponseWriter writer,
String resourceUri,
boolean encoding,
boolean defer)
|
void |
writeMyFacesJavascriptBeforeBodyEnd(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Writes the javascript code necessary for myfaces in every page, just befode the closing </body> tag |
void |
writeResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Writes the response |
protected static void |
writeStyleReference(javax.faces.context.FacesContext context,
String resourceUri)
|
protected static void |
writeStyleReference(javax.servlet.http.HttpServletResponse response,
javax.faces.context.ResponseWriter writer,
String resourceUri)
|
void |
writeWithFullHeader(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Add the resources to the <head> of the page. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String PATH_SEPARATOR
protected String _contextPath
protected org.apache.commons.logging.Log log
Constructor Detail |
---|
public NonBufferingAddResource()
Method Detail |
---|
public void setContextPath(String contextPath)
setContextPath
in interface AddResource
public void addJavaScriptHere(javax.faces.context.FacesContext context, Class myfacesCustomComponent, String resourceName) throws IOException
addJavaScriptHere
in interface AddResource
IOException
public void addJavaScriptHere(javax.faces.context.FacesContext context, String uri) throws IOException
addJavaScriptHere
in interface AddResource
uri
- is the location of the desired resource, relative to the base
directory of the webapp (ie its contextPath).
IOException
protected static void writeJavaScriptReference(javax.faces.context.FacesContext context, String resourceUri, boolean encoding, boolean defer) throws IOException
IOException
protected static void writeJavaScriptReference(javax.servlet.http.HttpServletResponse response, javax.faces.context.ResponseWriter writer, String resourceUri, boolean encoding, boolean defer) throws IOException
IOException
protected static void writeStyleReference(javax.faces.context.FacesContext context, String resourceUri) throws IOException
IOException
protected static void writeStyleReference(javax.servlet.http.HttpServletResponse response, javax.faces.context.ResponseWriter writer, String resourceUri) throws IOException
IOException
protected static void writeInlineScript(javax.faces.context.ResponseWriter writer, String inlineScript) throws IOException
IOException
protected static void writeInlineStylesheet(javax.faces.context.ResponseWriter writer, String inlineStyle) throws IOException
IOException
public void addJavaScriptHerePlain(javax.faces.context.FacesContext context, String uri) throws IOException
AddResource
addJavaScriptHerePlain
in interface AddResource
uri
- is the location of the desired resource, relative to the base
directory of the webapp (ie its contextPath).
IOException
public void addJavaScriptHere(javax.faces.context.FacesContext context, ResourceHandler resourceHandler) throws IOException
addJavaScriptHere
in interface AddResource
context
- The current faces-contextresourceHandler
- is an object which specifies exactly how to build the url
that is emitted into the script tag. Code which needs to generate URLs in ways
that this class does not support by default can implement a custom ResourceHandler.
IOException
public void addResourceHere(javax.faces.context.FacesContext context, ResourceHandler resourceHandler) throws IOException
addResourceHere
in interface AddResource
IOException
protected void validateResourceHandler(ResourceHandler resourceHandler)
resourceHandler
- handler to checkprotected void validateResourceLoader(Class resourceloader)
resourceloader
- loader to checkpublic void addJavaScriptAtPosition(javax.faces.context.FacesContext context, ResourcePosition position, ResourceHandler resourceHandler)
AddResource
Use this method to have full control about building the reference url to identify the resource and to customize how the resource is written to the response. In most cases, however, one of the convenience methods on this class can be used without requiring a custom ResourceHandler to be provided.
If the script has already been referenced, it's added only once.
Note that this method queues the javascript for insertion, and that the script is inserted into the buffered response by the ExtensionsFilter after the page is complete.
addJavaScriptAtPosition
in interface AddResource
public void addJavaScriptAtPosition(javax.faces.context.FacesContext context, ResourcePosition position, Class myfacesCustomComponent, String resourceName)
AddResource
The resource is expected to be in the classpath, at the same location as the specified component + "/resource".
Example: when customComponent is class example.Widget, and resourceName is script.js, the resource will be retrieved from "example/Widget/resource/script.js" in the classpath.
addJavaScriptAtPosition
in interface AddResource
public void addJavaScriptAtPosition(javax.faces.context.FacesContext context, ResourcePosition position, Class myfacesCustomComponent, String resourceName, boolean defer)
AddResource
addJavaScriptAtPosition
in interface AddResource
defer
- specifies whether the html attribute "defer" is set on the
generated script tag. If this is true then the browser will continue
processing the html page without waiting for the specified script to
load and be run.public void addJavaScriptAtPosition(javax.faces.context.FacesContext context, ResourcePosition position, String uri)
AddResource
addJavaScriptAtPosition
in interface AddResource
uri
- is the location of the desired resource, relative to the base
directory of the webapp (ie its contextPath).public void addJavaScriptAtPosition(javax.faces.context.FacesContext context, ResourcePosition position, String uri, boolean defer)
AddResource
addJavaScriptAtPosition
in interface AddResource
public void addJavaScriptToBodyTag(javax.faces.context.FacesContext context, String javascriptEventName, String addedJavaScript)
addJavaScriptToBodyTag
in interface AddResource
context
- javascriptEventName
- addedJavaScript
- public void addJavaScriptAtPosition(javax.faces.context.FacesContext context, ResourcePosition position, ResourceHandler resourceHandler, boolean defer)
AddResource
addJavaScriptAtPosition
in interface AddResource
public void addJavaScriptAtPositionPlain(javax.faces.context.FacesContext context, ResourcePosition position, Class myfacesCustomComponent, String resourceName)
AddResource
addJavaScriptAtPositionPlain
in interface AddResource
public void addStyleSheet(javax.faces.context.FacesContext context, ResourcePosition position, Class myfacesCustomComponent, String resourceName)
AddResource
addStyleSheet
in interface AddResource
public void addStyleSheet(javax.faces.context.FacesContext context, ResourcePosition position, String uri)
AddResource
addStyleSheet
in interface AddResource
public void addStyleSheet(javax.faces.context.FacesContext context, ResourcePosition position, ResourceHandler resourceHandler)
AddResource
addStyleSheet
in interface AddResource
public void addInlineStyleAtPosition(javax.faces.context.FacesContext context, ResourcePosition position, String inlineStyle)
AddResource
addInlineStyleAtPosition
in interface AddResource
public void addInlineScriptAtPosition(javax.faces.context.FacesContext context, ResourcePosition position, String inlineScript)
AddResource
addInlineScriptAtPosition
in interface AddResource
public String getResourceUri(javax.faces.context.FacesContext context, Class myfacesCustomComponent, String resource, boolean withContextPath)
AddResource
This method is intended for internal use by the Tomahawk project only, and will not serve resources for other projects (unless a custom AddResource implementation has been configured). Non-tomahawk code should use the variants that take an explicit ResourceHandler class.
Parameter myfacesCustomComponent is a tomahawk class that the resource is associated with. The resource is then expected to be in the classpath in the same package as the specified class (or a subpackage).
Parameter resource is a path relative to the .class file of the specified myfacesCustomComponent class. Param withContextPath controls whether the webapp name is prefixed to the generated url.
getResourceUri
in interface AddResource
public String getResourceUri(javax.faces.context.FacesContext context, Class myfacesCustomComponent, String resource)
getResourceUri
in interface AddResource
public String getResourceUri(javax.faces.context.FacesContext context, ResourceHandler resourceHandler)
getResourceUri
in interface AddResource
public String getResourceUri(javax.faces.context.FacesContext context, ResourceHandler resourceHandler, boolean withContextPath)
getResourceUri
in interface AddResource
public String getResourceUri(javax.faces.context.FacesContext context, String uri)
getResourceUri
in interface AddResource
public String getResourceUri(javax.faces.context.FacesContext context, String uri, boolean withContextPath)
getResourceUri
in interface AddResource
protected String getResourceUri(javax.faces.context.FacesContext context, Class resourceLoader, boolean withContextPath)
context
- current faces-contextresourceLoader
- resourceLoaderwithContextPath
- use the context-path of the web-app when accessing the resources
protected long getCacheKey(javax.faces.context.FacesContext context)
context
- the current faces-context
public boolean isResourceUri(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request)
isResourceUri
in interface AddResource
public void serveResource(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
serveResource
in interface AddResource
IOException
public void parseResponse(javax.servlet.http.HttpServletRequest request, String bufferedResponse, javax.servlet.http.HttpServletResponse response) throws IOException
AddResource
parseResponse
in interface AddResource
IOException
public void writeMyFacesJavascriptBeforeBodyEnd(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
AddResource
writeMyFacesJavascriptBeforeBodyEnd
in interface AddResource
IOException
public void writeWithFullHeader(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
AddResource
writeWithFullHeader
in interface AddResource
IOException
public void writeResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
AddResource
writeResponse
in interface AddResource
IOException
public boolean requiresBuffer()
AddResource
requiresBuffer
in interface AddResource
public void responseStarted()
AddResource
responseStarted
in interface AddResource
public void responseFinished()
AddResource
responseFinished
in interface AddResource
public boolean hasHeaderBeginInfos()
AddResource
hasHeaderBeginInfos
in interface AddResource
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |