|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.tapestry.services.impl.DefaultResponseBuilder
public class DefaultResponseBuilder
Manages normal html responses for tapestry request/response cycles.
| 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 | |
|---|---|
DefaultResponseBuilder(IMarkupWriter writer)
Used in testing only. |
|
DefaultResponseBuilder(RequestLocaleManager localeManager,
MarkupWriterSource markupWriterSource,
WebResponse webResponse)
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 writer,
IRequestCycle cycle)
Marks the beginning of the core body script. |
boolean |
contains(IComponent target)
Checks if the rendered response contains a particular component. |
void |
endBodyScript(IMarkupWriter writer,
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 writer,
String script,
IRequestCycle cycle)
Called after ResponseBuilder.beginBodyScript(IMarkupWriter, IRequestCycle) to write the containing
body script. |
void |
writeExternalScript(IMarkupWriter writer,
String url,
IRequestCycle cycle)
Invoked by PageRenderSupport to write external js package
includes. |
void |
writeImageInitializations(IMarkupWriter writer,
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 writer,
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 DefaultResponseBuilder(IMarkupWriter writer)
writer -
public DefaultResponseBuilder(RequestLocaleManager localeManager,
MarkupWriterSource markupWriterSource,
WebResponse webResponse)
renderResponse(IRequestCycle) is called.
localeManager - Used to set the locale on the response.markupWriterSource - Creates IMarkupWriter 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.
IOException
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 cyclepublic void updateComponent(String id)
updateComponent in interface ResponseBuilderid - The IComponent id to update.public boolean contains(IComponent target)
contains in interface ResponseBuildertarget - The component to check containment of.
public IMarkupWriter getWriter()
getWriter in interface ResponseBuilder
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 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 writer,
IRequestCycle cycle)
beginBodyScript 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.cycle - The associated request.
public void endBodyScript(IMarkupWriter writer,
IRequestCycle cycle)
ResponseBuilder.beginBodyScript(IMarkupWriter, IRequestCycle) was previously
called.
endBodyScript 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.cycle - The associated request.
public void writeBodyScript(IMarkupWriter writer,
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 ResponseBuilderwriter - 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 writer,
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 ResponseBuilderwriter - 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 writer,
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 ResponseBuilderwriter - 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 writer,
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 ResponseBuilderwriter - 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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||