net.sf.tacos.ajax
Interface AjaxWebRequest

All Known Implementing Classes:
AjaxWebRequestImpl

public interface AjaxWebRequest

Represents a threaded ajax request to tapestry. This class can be thought of as similar to a HttpServletRequest or WebRequest in that it relates directly to the incoming http request.

Because the foundation of all of the current library work being done with ajax seems to be uniformly based off of prototype, this particular instance will represent all of the logic contained within the prototype core request. See:http://prototype.conio.net/

Author:
jkuhnert

Field Summary
static String AJAX_REQUEST
          IRequestCycle stored attribute
static String AJAX_REQUEST_TYPE
          Value of REQUEST_TYPE_HEADER that represents ajax requests
static String PROTOTYPE_VERSION_HEADER
          Key in Http header for Prototype library version
static String REQUEST_TYPE_HEADER
          Key in Http headers for request type
 
Method Summary
 void addDeferredScript(String id, org.apache.tapestry.IScript script, Map parms)
          Adds a script to be executed when the component specified by the IFormComponent with a component id matching id.
 void addPostProcessScript(String input)
          In whatever form the ResponseBuilder associated with this request supports it, the script specified will be executed just after the content replacement on the client, before normal javascript is executed.
 void addPreProcessScript(String script)
          In whatever form the ResponseBuilder associated with this request supports it, the script specified will be executed first on the client before anything else.
 void addStatusResponse(String status)
          Sets the returned response status text, if configured in the AjaxDirectLink or AjaxForm components.
 void addUpdateComponent(String id)
          Adds a component to be refreshed on this request.
 void clearDeferredScripts(String id)
          Clears all previously stored deferred scripts for the specified component id.
 boolean containsComponentId(String id)
          Checks if this request contains the specified component id.
 List getDeferredScripts(String id)
          Gets a List of scripts to be executed by the specified component when rendering, the List returned, if not null, will contain a list of Map objects with the IScript and Map parameters for the script.
 String getFocusElement()
          Gets an element to focus after rendering the ajax response.
 ResponseBuilder getResponseBuilder()
          The class responsible for invoking and rendering the responses received from components.
 String getType()
          The type of ajax request made, which should be AJAX_REQUEST_TYPE in all cases for now.
 SortedSet getUpdateComponents()
          List of unique component id's that will have their contents refreshed on this request.
 String getVersion()
          The version of the ajax client library that was used to invoke the ajax cycle.
 boolean isDirectUpdate()
          Whether or not this request expects components to be updated directly, without requiring that the entire page be rendered.
 boolean isProcessScripts()
          Whether or not the client call has requested that the server process scripts.
 boolean isValidRequest()
          For instances where an ajax request link was setup, but the client invocation of that link could not create a valid ajax request for one reason or another.
 boolean isWidgetVisible(String id)
          Checks if the client-side widget with a unique id matching the specified string is visible already.
 void removeUpdateComponent(String id)
          Removes the specifiec component from this partial render.
 void setDirectUpdate(boolean direct)
          Sets whether or not this request should directly update components.
 void setFocusElement(String id)
          Sets an element id to focus after rendering the ajax response.
 void setProcessScripts(boolean value)
          Sets whether or not should process javascript.
 void setResponseBuilder(ResponseBuilder invoker)
          Sets the response builder.
 void setType(String type)
          Sets the type of ajax request.
 void setVersion(String version)
          Sets the request version.
 void setVisibleWidgets(List ids)
          Sets the list of currently visible dojo widgets.
 

Field Detail

REQUEST_TYPE_HEADER

static final String REQUEST_TYPE_HEADER
Key in Http headers for request type

See Also:
Constant Field Values

AJAX_REQUEST_TYPE

static final String AJAX_REQUEST_TYPE
Value of REQUEST_TYPE_HEADER that represents ajax requests

See Also:
Constant Field Values

PROTOTYPE_VERSION_HEADER

static final String PROTOTYPE_VERSION_HEADER
Key in Http header for Prototype library version

See Also:
Constant Field Values

AJAX_REQUEST

static final String AJAX_REQUEST
IRequestCycle stored attribute

See Also:
Constant Field Values
Method Detail

getType

String getType()
The type of ajax request made, which should be AJAX_REQUEST_TYPE in all cases for now.

Returns:
The string found in header for REQUEST_TYPE_HEADER.

setType

void setType(String type)
Sets the type of ajax request.

Parameters:
type -

getVersion

String getVersion()
The version of the ajax client library that was used to invoke the ajax cycle.

Returns:
Currently the value of PROTOTYPE_VERSION_HEADER header.

setVersion

void setVersion(String version)
Sets the request version.

Parameters:
version -

isValidRequest

boolean isValidRequest()
For instances where an ajax request link was setup, but the client invocation of that link could not create a valid ajax request for one reason or another. If this is true the response will be rendered back to the client in text/html mode as a normal request.

Returns:

getUpdateComponents

SortedSet getUpdateComponents()
List of unique component id's that will have their contents refreshed on this request.

Returns:

addUpdateComponent

void addUpdateComponent(String id)
Adds a component to be refreshed on this request.

Parameters:
id -

removeUpdateComponent

void removeUpdateComponent(String id)
Removes the specifiec component from this partial render.

Parameters:
id -

isDirectUpdate

boolean isDirectUpdate()
Whether or not this request expects components to be updated directly, without requiring that the entire page be rendered.

Returns:
True if components are updated directly, false otherwise.

setDirectUpdate

void setDirectUpdate(boolean direct)
Sets whether or not this request should directly update components.

Parameters:
direct -

isProcessScripts

boolean isProcessScripts()
Whether or not the client call has requested that the server process scripts. ResponseContributors can use this knowledge in their response.

By default this value is always true, unless the client call has set it explicitly.

Returns:

setProcessScripts

void setProcessScripts(boolean value)
Sets whether or not should process javascript.

Parameters:
value -

getResponseBuilder

ResponseBuilder getResponseBuilder()
The class responsible for invoking and rendering the responses received from components.

Returns:

setResponseBuilder

void setResponseBuilder(ResponseBuilder invoker)
Sets the response builder.

Parameters:
invoker -

containsComponentId

boolean containsComponentId(String id)
Checks if this request contains the specified component id.

Parameters:
id - Id returned by invoking IComponent.getId().
Returns:
True if request contains update request for specified component.

addStatusResponse

void addStatusResponse(String status)
Sets the returned response status text, if configured in the AjaxDirectLink or AjaxForm components.

Parameters:
status -

addPreProcessScript

void addPreProcessScript(String script)
In whatever form the ResponseBuilder associated with this request supports it, the script specified will be executed first on the client before anything else.

Parameters:
script -

addPostProcessScript

void addPostProcessScript(String input)
In whatever form the ResponseBuilder associated with this request supports it, the script specified will be executed just after the content replacement on the client, before normal javascript is executed.

Parameters:
input -

setVisibleWidgets

void setVisibleWidgets(List ids)
Sets the list of currently visible dojo widgets.

Parameters:
ids - The list of ids generated from client side call to dojo.widget.manager.widgetids

isWidgetVisible

boolean isWidgetVisible(String id)
Checks if the client-side widget with a unique id matching the specified string is visible already.

Parameters:
id - The unqiue widget id to check visibility of
Returns:
True if the widget should already be visible

addDeferredScript

void addDeferredScript(String id,
                       org.apache.tapestry.IScript script,
                       Map parms)
Adds a script to be executed when the component specified by the IFormComponent with a component id matching id.

Parameters:
id - The component id of a valid IFormComponent
script - The javascript template to be executed
parms - Optional paramters to invoke script with

getDeferredScripts

List getDeferredScripts(String id)
Gets a List of scripts to be executed by the specified component when rendering, the List returned, if not null, will contain a list of Map objects with the IScript and Map parameters for the script.

Parameters:
id - The component id to get scripts for.
Returns:
A List of scripts, or null if none were found.

clearDeferredScripts

void clearDeferredScripts(String id)
Clears all previously stored deferred scripts for the specified component id.

Parameters:
id -

getFocusElement

String getFocusElement()
Gets an element to focus after rendering the ajax response.

Returns:
The element id to focus.

setFocusElement

void setFocusElement(String id)
Sets an element id to focus after rendering the ajax response.

Parameters:
id - the element id to focus.