|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AddResource
This interface defines methods necessary to render links to resources used by custom components. Mostly used to avoid having to include [script src="..."][/script] in the head of the pages before using a component.
Field Summary | |
---|---|
static ResourcePosition |
BODY_END
|
static ResourcePosition |
BODY_ONLOAD
|
static ResourcePosition |
HEADER_BEGIN
|
Method Summary | |
---|---|
void |
addInlineScriptAtPosition(javax.faces.context.FacesContext context,
ResourcePosition position,
java.lang.String inlineScript)
Adds the given Inline Script at the specified document position. |
void |
addInlineStyleAtPosition(javax.faces.context.FacesContext context,
ResourcePosition position,
java.lang.String inlineStyle)
Adds the given Inline Style at the specified document position. |
void |
addJavaScriptAtPosition(javax.faces.context.FacesContext context,
ResourcePosition position,
java.lang.Class myfacesCustomComponent,
java.lang.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,
java.lang.Class myfacesCustomComponent,
java.lang.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,
java.lang.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,
java.lang.String uri,
boolean defer)
Adds the given Javascript resource at the specified document position. |
void |
addJavaScriptAtPositionPlain(javax.faces.context.FacesContext context,
ResourcePosition position,
java.lang.Class myfacesCustomComponent,
java.lang.String resourceName)
Deprecated. just to help to workaround a dojo bug |
void |
addJavaScriptHere(javax.faces.context.FacesContext context,
java.lang.Class myfacesCustomComponent,
java.lang.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,
java.lang.String uri)
Insert a [script src="url"] entry at the current location in the response. |
void |
addJavaScriptHerePlain(javax.faces.context.FacesContext context,
java.lang.String uri)
Deprecated. just to help to workaround a dojo bug |
void |
addJavaScriptToBodyTag(javax.faces.context.FacesContext context,
java.lang.String javascriptEventName,
java.lang.String addedJavaScript)
|
void |
addResourceHere(javax.faces.context.FacesContext context,
ResourceHandler resourceHandler)
|
void |
addStyleSheet(javax.faces.context.FacesContext context,
ResourcePosition position,
java.lang.Class myfacesCustomComponent,
java.lang.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,
java.lang.String uri)
Adds the given Style Sheet at the specified document position. |
java.lang.String |
getResourceUri(javax.faces.context.FacesContext context,
java.lang.Class myfacesCustomComponent,
java.lang.String resource)
|
java.lang.String |
getResourceUri(javax.faces.context.FacesContext context,
java.lang.Class myfacesCustomComponent,
java.lang.String resource,
boolean withContextPath)
|
java.lang.String |
getResourceUri(javax.faces.context.FacesContext context,
ResourceHandler resourceHandler)
Get the Path used to retrieve an resource. |
java.lang.String |
getResourceUri(javax.faces.context.FacesContext context,
ResourceHandler resourceHandler,
boolean withContextPath)
Get the Path used to retrieve an resource. |
java.lang.String |
getResourceUri(javax.faces.context.FacesContext context,
java.lang.String uri)
Get the Path used to retrieve an resource. |
java.lang.String |
getResourceUri(javax.faces.context.FacesContext context,
java.lang.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,
java.lang.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(java.lang.String contextPath)
set the context path of the web-app |
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 |
void |
writeWithFullHeader(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Add the resources to the <head> of the page. |
Field Detail |
---|
static final ResourcePosition HEADER_BEGIN
static final ResourcePosition BODY_END
static final ResourcePosition BODY_ONLOAD
Method Detail |
---|
void setContextPath(java.lang.String contextPath)
void addJavaScriptHere(javax.faces.context.FacesContext context, java.lang.Class myfacesCustomComponent, java.lang.String resourceName) throws java.io.IOException
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.
java.io.IOException
void addJavaScriptHere(javax.faces.context.FacesContext context, java.lang.String uri) throws java.io.IOException
uri
- is the location of the desired resource, relative to the base
directory of the webapp (ie its contextPath).
java.io.IOException
void addJavaScriptHerePlain(javax.faces.context.FacesContext context, java.lang.String uri) throws java.io.IOException
uri
- is the location of the desired resource, relative to the base
directory of the webapp (ie its contextPath).
java.io.IOException
void addJavaScriptHere(javax.faces.context.FacesContext context, ResourceHandler resourceHandler) throws java.io.IOException
context
- resourceHandler
- 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.
java.io.IOException
void addResourceHere(javax.faces.context.FacesContext context, ResourceHandler resourceHandler) throws java.io.IOException
java.io.IOException
void addJavaScriptAtPosition(javax.faces.context.FacesContext context, ResourcePosition position, ResourceHandler resourceHandler)
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.
void addJavaScriptAtPosition(javax.faces.context.FacesContext context, ResourcePosition position, java.lang.Class myfacesCustomComponent, java.lang.String resourceName)
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.
void addJavaScriptAtPosition(javax.faces.context.FacesContext context, ResourcePosition position, java.lang.Class myfacesCustomComponent, java.lang.String resourceName, boolean defer)
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.void addJavaScriptAtPosition(javax.faces.context.FacesContext context, ResourcePosition position, java.lang.String uri)
uri
- is the location of the desired resource, relative to the base
directory of the webapp (ie its contextPath).void addJavaScriptAtPosition(javax.faces.context.FacesContext context, ResourcePosition position, java.lang.String uri, boolean defer)
void addJavaScriptToBodyTag(javax.faces.context.FacesContext context, java.lang.String javascriptEventName, java.lang.String addedJavaScript)
void addJavaScriptAtPosition(javax.faces.context.FacesContext context, ResourcePosition position, ResourceHandler resourceHandler, boolean defer)
void addJavaScriptAtPositionPlain(javax.faces.context.FacesContext context, ResourcePosition position, java.lang.Class myfacesCustomComponent, java.lang.String resourceName)
void addStyleSheet(javax.faces.context.FacesContext context, ResourcePosition position, java.lang.Class myfacesCustomComponent, java.lang.String resourceName)
void addStyleSheet(javax.faces.context.FacesContext context, ResourcePosition position, java.lang.String uri)
void addStyleSheet(javax.faces.context.FacesContext context, ResourcePosition position, ResourceHandler resourceHandler)
void addInlineStyleAtPosition(javax.faces.context.FacesContext context, ResourcePosition position, java.lang.String inlineStyle)
void addInlineScriptAtPosition(javax.faces.context.FacesContext context, ResourcePosition position, java.lang.String inlineScript)
java.lang.String getResourceUri(javax.faces.context.FacesContext context, java.lang.Class myfacesCustomComponent, java.lang.String resource, boolean withContextPath)
java.lang.String getResourceUri(javax.faces.context.FacesContext context, java.lang.Class myfacesCustomComponent, java.lang.String resource)
java.lang.String getResourceUri(javax.faces.context.FacesContext context, ResourceHandler resourceHandler)
java.lang.String getResourceUri(javax.faces.context.FacesContext context, ResourceHandler resourceHandler, boolean withContextPath)
java.lang.String getResourceUri(javax.faces.context.FacesContext context, java.lang.String uri)
java.lang.String getResourceUri(javax.faces.context.FacesContext context, java.lang.String uri, boolean withContextPath)
boolean isResourceUri(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request)
void serveResource(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
java.io.IOException
void parseResponse(javax.servlet.http.HttpServletRequest request, java.lang.String bufferedResponse, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
java.io.IOException
void writeMyFacesJavascriptBeforeBodyEnd(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
java.io.IOException
void writeWithFullHeader(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
java.io.IOException
void writeResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
java.io.IOException
boolean requiresBuffer()
void responseStarted()
void responseFinished()
boolean hasHeaderBeginInfos()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |