|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.tapestry.services.impl.DojoAjaxResponseBuilder
public class DojoAjaxResponseBuilder
Main class that handles dojo based ajax responses. These responses are wrapped by an xml document format that segments off invididual component/javascript response types into easy to manage xml elements that can then be interpreted and managed by running client-side javascript.
| Field Summary |
|---|
| Fields inherited from interface org.apache.tapestry.services.ResponseBuilder |
|---|
BODY_SCRIPT, CONTENT_TYPE, ELEMENT_TYPE, ENCODING_KEY, EXCEPTION_TYPE, INCLUDE_SCRIPT, INITIALIZATION_SCRIPT, SCRIPT_TYPE |
| Constructor Summary | |
|---|---|
DojoAjaxResponseBuilder(IRequestCycle cycle,
IMarkupWriter writer,
List parts)
Creates a builder with a pre-configured IMarkupWriter. |
|
DojoAjaxResponseBuilder(IRequestCycle cycle,
RequestLocaleManager localeManager,
MarkupWriterSource markupWriterSource,
WebResponse webResponse,
List errorPages)
Creates a new response builder with the required services it needs to render the response when renderResponse(IRequestCycle) is called. |
|
| Method Summary | |
|---|---|
void |
beginBodyScript(IMarkupWriter normalWriter,
IRequestCycle cycle)
Marks the beginning of the core body script. |
boolean |
contains(IComponent target)
Determines if the specified component is contained in the responses requested update parts. |
void |
endBodyScript(IMarkupWriter normalWriter,
IRequestCycle cycle)
Marks the end of the body block being called. |
IMarkupWriter |
getWriter()
Returns the IMarkupWriter associated with this response, it may or may not be a NullWriter instance depending on the response type or stage of the render cycle. |
IMarkupWriter |
getWriter(String id,
String type)
Gets a write that will output its content in a response
element with the given id and type. |
boolean |
isBodyScriptAllowed(IComponent target)
Determines if the specified component should have its javascript body added to the response. |
boolean |
isDynamic()
Implementors that manage content writes dynamically (ie DojoAjaxResponseBuilder) should
return true to denote that dynamic behaviour is on for a particular response. |
boolean |
isExternalScriptAllowed(IComponent target)
Determines if the specified component should have its javascript external resource scripts added to the response. |
boolean |
isImageInitializationAllowed(IComponent target)
Determines if the specified component should have any asset image URL references embedded in the response. |
boolean |
isInitializationScriptAllowed(IComponent target)
Determines if the specified component should have its javascript initialization added to the response. |
void |
render(IMarkupWriter writer,
IRender render,
IRequestCycle cycle)
Invoked to render a renderable object. |
void |
renderResponse(IRequestCycle cycle)
Renders the response to a client. |
void |
updateComponent(String id)
If the component identified by the specified id isn't already set to be updated, will add it to the response for updating. |
void |
writeBodyScript(IMarkupWriter normalWriter,
String script,
IRequestCycle cycle)
Called after ResponseBuilder.beginBodyScript(IMarkupWriter, IRequestCycle) to write the containing
body script. |
void |
writeExternalScript(IMarkupWriter normalWriter,
String url,
IRequestCycle cycle)
Invoked by PageRenderSupport to write external js package
includes. |
void |
writeImageInitializations(IMarkupWriter normalWriter,
String script,
String preloadName,
IRequestCycle cycle)
Intended to be written within the confines of the body script, should be invoked once just after ResponseBuilder.beginBodyScript(IMarkupWriter, IRequestCycle) is called
to include any image initializations. |
void |
writeInitializationScript(IMarkupWriter normalWriter,
String script)
Writes any javascript that should only execute after all other items on a page have completed rendering. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DojoAjaxResponseBuilder(IRequestCycle cycle,
IMarkupWriter writer,
List parts)
IMarkupWriter.
Currently only used for testing.
writer - The markup writer to render all "good" content to.parts - A set of string ids of the components that may have
their responses rendered.
public DojoAjaxResponseBuilder(IRequestCycle cycle,
RequestLocaleManager localeManager,
MarkupWriterSource markupWriterSource,
WebResponse webResponse,
List errorPages)
renderResponse(IRequestCycle) is called.
localeManager - Used to set the locale on the response.markupWriterSource - Creates IJSONWriter instance to be used.webResponse - Web response for output stream.| Method Detail |
|---|
public boolean isDynamic()
DojoAjaxResponseBuilder) should
return true to denote that dynamic behaviour is on for a particular response.
isDynamic in interface ResponseBuilder
public void renderResponse(IRequestCycle cycle)
throws IOException
renderResponse in interface ResponseBuildercycle - The main request cycle object for this request.
IOExceptionpublic void updateComponent(String id)
updateComponent in interface ResponseBuilderid - The IComponent id to update.public IMarkupWriter getWriter()
getWriter in interface ResponseBuilderpublic boolean isBodyScriptAllowed(IComponent target)
isBodyScriptAllowed in interface ResponseBuildertarget - The component to allow/disallow body script content from.
public boolean isExternalScriptAllowed(IComponent target)
isExternalScriptAllowed in interface ResponseBuildertarget - The component to check for inclusion/exclusion.
public boolean isInitializationScriptAllowed(IComponent target)
isInitializationScriptAllowed in interface ResponseBuildertarget - The component to allow/disallow initialization script content from.
public boolean isImageInitializationAllowed(IComponent target)
isImageInitializationAllowed in interface ResponseBuildertarget - The component to allow/disallow image initialization script content from.
public void beginBodyScript(IMarkupWriter normalWriter,
IRequestCycle cycle)
beginBodyScript in interface ResponseBuildernormalWriter - The markup writer to use, this may be ignored or swapped
out for a different writer depending on the implementation being used.cycle - The associated request.
public void endBodyScript(IMarkupWriter normalWriter,
IRequestCycle cycle)
ResponseBuilder.beginBodyScript(IMarkupWriter, IRequestCycle) was previously
called.
endBodyScript in interface ResponseBuildernormalWriter - The markup writer to use, this may be ignored or swapped
out for a different writer depending on the implementation being used.cycle - The associated request.
public void writeBodyScript(IMarkupWriter normalWriter,
String script,
IRequestCycle cycle)
ResponseBuilder.beginBodyScript(IMarkupWriter, IRequestCycle) to write the containing
body script. This method may not be called at all if there is no js body
to write into the response.
writeBodyScript in interface ResponseBuildernormalWriter - The markup writer to use, this may be ignored or swapped
out for a different writer depending on the implementation being used.script - The script to write into the body response.cycle - The associated request.
public void writeExternalScript(IMarkupWriter normalWriter,
String url,
IRequestCycle cycle)
PageRenderSupport to write external js package
includes. This method will be invoked for each external script requesting
inclusion in the response.
These will typically be written out as
.
writeExternalScript in interface ResponseBuildernormalWriter - The markup writer to use, this may be ignored or swapped
out for a different writer depending on the implementation being used.url - The absolute url to the .js package to be included.cycle - The associated request.
public void writeImageInitializations(IMarkupWriter normalWriter,
String script,
String preloadName,
IRequestCycle cycle)
ResponseBuilder.beginBodyScript(IMarkupWriter, IRequestCycle) is called
to include any image initializations. This method should only be called if
there are actually images that need pre-initialization. Ie in many instances
it will not be called at all.
writeImageInitializations in interface ResponseBuildernormalWriter - The markup writer to use, this may be ignored or swapped
out for a different writer depending on the implementation being used.script - The non null value of the script images to include.preloadName - The global variable name to give to the preloaded images array.cycle - The associated request.
public void writeInitializationScript(IMarkupWriter normalWriter,
String script)
window.onload
event, but will vary depending on the implementation of the builder being used.
This method will ~only~ be called if there is any queued intialization script
to write.
writeInitializationScript in interface ResponseBuildernormalWriter - The markup writer to use, this may be ignored or swapped
out for a different writer depending on the implementation being used.script - The initialzation script to write.
public void render(IMarkupWriter writer,
IRender render,
IRequestCycle cycle)
render in interface ResponseBuilderwriter - The markup writer to use, this may be ignored or swapped
out for a different writer depending on the implementation being used.render - The renderable object to rendercycle - Render request cycle
public IMarkupWriter getWriter(String id,
String type)
response
element with the given id and type.
getWriter in interface ResponseBuilderid - The response element id to give writer.type - Optional - If specified will give the response element a type
attribute.
IMarkupWriter instance to write content to.public boolean contains(IComponent target)
contains in interface ResponseBuildertarget - The component to check for.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||