org.jvoicexml.xml.ccxml
Class Fetch

java.lang.Object
  extended by org.jvoicexml.xml.XmlNode
      extended by org.jvoicexml.xml.ccxml.CcxmlNode
          extended by org.jvoicexml.xml.ccxml.Fetch
All Implemented Interfaces:
XmlWritable, Node

public final class Fetch
extends CcxmlNode

<fetch> is used to asynchronously fetch content identified by the attributes of the <fetch>. The fetched content may either be a CCXML document, or script content. Content that has been acquired using <fetch> is accessible through other elements defined by CCXML. Execution returns from the element immediately, and the CCXML application can continue on while the platform works to fetch the identified resource. When the fetch request has been completed, an event is generated against the session that initiated the fetch. The event is one of fetch.done, which indicates that the identified content was fetched successfully, or error.fetch, indicative of a failure to fetch the requested content. Note that even if content is successfully fetched, errors in processing fetched content (for instance, a CCXML document with a syntax error) may result in an error.fetch being thrown. The fetch request is local to the session that initiated the <fetch>, and is referenced through a unique identifier generated by the CCXML platform. The application may obtain the unique identifier for a fetch request by providing an ECMAScript left-hand-side expression in the fetchid attribute when the fetch is performed. The fetch identifier can also be obtained as a property of the fetch.done event. The application uses the fetch identifier in any CCXML elements that reference fetched content, currently <goto> and <script>. Fetched content has a lifetime that is limited to that of the document in which it is fetched. Therefore, following a transition to a new CCXML document using <goto>, content fetched in the scope of the current document is no longer accessible. Note that this should not be taken to preclude platform-level optimizations or caching of resources that are fetched multiple times. The use of <fetch> to obtain content does not compel the application to make use of that content. However, it is wasteful of system resources to fetch resources that are not used. Platforms are responsible for clearing out unused fetch resources, and may impose limits on the resources that can be fetched by a single session.

Version:
$Revision: 1.4 $

Copyright © 2005 JVoiceXML group - http://jvoicexml.sourceforge.net/

Author:
Steve Doyle

Field Summary
static String ATTRIBUTE_ENCTYPE
          An ECMAScript expression which returns a character string that indicates the media encoding type of the submitted document (when the value of the method is "post").
static String ATTRIBUTE_FETCHID
          An ECMAScript left hand side expression evaluating to a previously defined variable.
static String ATTRIBUTE_MAXAGE
          The character string returned is interpreted as a time interval.
static String ATTRIBUTE_MAXSTALE
          The character string returned is interpreted as a time interval.
static String ATTRIBUTE_METHOD
          An ECMAScript expression which returns a character string that indicates the HTTP method to use.
static String ATTRIBUTE_NAMELIST
          A list of zero or more whitespace separated CCXML variable names.
protected static ArrayList<String> ATTRIBUTE_NAMES
          Supported attribute names for this node.
static String ATTRIBUTE_NEXT
          An ECMAScript expression which returns the URI of the resource to be fetched.
static String ATTRIBUTE_TIMEOUT
          The character string returned is interpreted as a time interval.
static String ATTRIBUTE_TYPE
          An ECMAScript expression which returns a character string that specifies the MIME type of the fetched content.
private static Set<String> CHILD_TAGS
          Valid child tags for this node.
static String TAG_NAME
          Name of the tag.
 
Fields inherited from class org.jvoicexml.xml.XmlNode
node
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
Fetch()
          Construct a new fetch object without a node.
Fetch(Node node)
          Construct a new fetch object.
 
Method Summary
protected  boolean canContainChild(String tagName)
          Can the specified sub-tag be contained within this node?
 Collection<String> getAttributeNames()
          Returns a collection of permitted attribute names for the node.
 String getEnctype()
          Retrieve the enctype attribute.
 String getFetchid()
          Retrieve the fetchid attribute.
 String getMaxage()
          Retrieve the maxage attribute.
 String getMaxstale()
          Retrieve the maxstale attribute.
 String getMethod()
          Retrieve the method attribute.
 String getNamelist()
          Retrieve the namelist attribute.
 String getNext()
          Retrieve the next attribute.
 String getTagName()
          Get the name of the tag for the derived node.
 String getTimeout()
          Retrieve the timeout attribute.
 String getType()
          Retrieve the type attribute.
 XmlNode newInstance(Node n)
          Create a new instance for the given node.
 void setEnctype(String enctype)
          Set the enctype attribute.
 void setFetchid(String fetchid)
          Set the fetchid attribute.
 void setMaxage(String maxage)
          Set the maxage attribute.
 void setMaxstale(String maxstale)
          Set the maxstale attribute.
 void setMethod(String method)
          Set the method attribute.
 void setNamelist(String namelist)
          Set the namelist attribute.
 void setNext(String next)
          Set the next attribute.
 void setTimeout(String timeout)
          Set the timeout attribute.
 void setType(String type)
          Set the type attribute.
 
Methods inherited from class org.jvoicexml.xml.ccxml.CcxmlNode
getChildNodes, getFirstChild, getLastChild, getNextSibling, getParentNode, getPreviousSibling
 
Methods inherited from class org.jvoicexml.xml.XmlNode
addChild, appendChild, cloneNode, compareDocumentPosition, getAttribute, getAttributes, getBaseURI, getChildNodes, getFeature, getLocalName, getNamespaceURI, getNode, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getPrefix, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setAttribute, setNodeValue, setPrefix, setTextContent, setUserData, toString, writeChildrenXml, writeXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TAG_NAME

public static final String TAG_NAME
Name of the tag.

See Also:
Constant Field Values

ATTRIBUTE_ENCTYPE

public static final String ATTRIBUTE_ENCTYPE
An ECMAScript expression which returns a character string that indicates the media encoding type of the submitted document (when the value of the method is "post").

See Also:
Constant Field Values

ATTRIBUTE_FETCHID

public static final String ATTRIBUTE_FETCHID
An ECMAScript left hand side expression evaluating to a previously defined variable. The value of the attribute will receive an internally generated unique string identifier to be associated with the completion event. This identifier can be tested by the fetch completion event handler to distinguish among several outstanding fetch requests. If this attribute is not specified, the fetch identifier can be acquired from the fetch completion event. Every fetch request will receive a unique fetch identifier, even if the request if for the same URL.

See Also:
Constant Field Values

ATTRIBUTE_MAXAGE

public static final String ATTRIBUTE_MAXAGE
The character string returned is interpreted as a time interval. This indicates that the document is willing to use content whose age is no greater than the specified time in seconds (cf. 'max-age' in HTTP 1.1 [RFC2616]). The document is not willing to use stale content, unless maxstale is also provided.

See Also:
Constant Field Values

ATTRIBUTE_MAXSTALE

public static final String ATTRIBUTE_MAXSTALE
The character string returned is interpreted as a time interval. This indicates that the document is willing to use content that has exceeded its expiration time (cf. 'max-age' in HTTP 1.1 [RFC2616]). If maxstale is assigned a value, then the document is willing to accept content that has exceeded its expiration time by no more than the specified number of seconds.

See Also:
Constant Field Values

ATTRIBUTE_METHOD

public static final String ATTRIBUTE_METHOD
An ECMAScript expression which returns a character string that indicates the HTTP method to use.

See Also:
Constant Field Values

ATTRIBUTE_NAMELIST

public static final String ATTRIBUTE_NAMELIST
A list of zero or more whitespace separated CCXML variable names. These variables will be submitted to the server, with the same qualification as used in the namelist. When an ECMAscript variable is submitted to the server, its value is first converted into a string before being submitted. If the variable is an ECMAScript Object, the mechanism by which it is submitted is not currently defined. Instead of submitting ECMAScript Objects directly, the application developer may explicitly submit the properties of an Object. e.g. "date.month date.year".

See Also:
Constant Field Values

ATTRIBUTE_NEXT

public static final String ATTRIBUTE_NEXT
An ECMAScript expression which returns the URI of the resource to be fetched.

See Also:
Constant Field Values

ATTRIBUTE_TIMEOUT

public static final String ATTRIBUTE_TIMEOUT
The character string returned is interpreted as a time interval. This interval begins when the fetch is executed. The fetch will fail if not completed at the end of this interval. A failed fetch will return the error.fetch event.

See Also:
Constant Field Values

ATTRIBUTE_TYPE

public static final String ATTRIBUTE_TYPE
An ECMAScript expression which returns a character string that specifies the MIME type of the fetched content.

See Also:
Constant Field Values

ATTRIBUTE_NAMES

protected static final ArrayList<String> ATTRIBUTE_NAMES
Supported attribute names for this node.


CHILD_TAGS

private static final Set<String> CHILD_TAGS
Valid child tags for this node.

Constructor Detail

Fetch

public Fetch()
Construct a new fetch object without a node.

This is necessary for the node factory.

See Also:
VoiceXmlNodeFactory

Fetch

Fetch(Node node)
Construct a new fetch object.

Parameters:
node - The encapsulated node.
Method Detail

getTagName

public String getTagName()
Get the name of the tag for the derived node.

Specified by:
getTagName in class XmlNode
Returns:
name of the tag.

newInstance

public XmlNode newInstance(Node n)
Create a new instance for the given node.

Specified by:
newInstance in class XmlNode
Parameters:
n - The node to encapsulate.
Returns:
The new instance.

getEnctype

public String getEnctype()
Retrieve the enctype attribute.

Returns:
Value of the enctype attribute.
See Also:
ATTRIBUTE_ENCTYPE

setEnctype

public void setEnctype(String enctype)
Set the enctype attribute.

Parameters:
enctype - Value of the enctype attribute.
See Also:
ATTRIBUTE_ENCTYPE

getFetchid

public String getFetchid()
Retrieve the fetchid attribute.

Returns:
Value of the fetchid attribute.
See Also:
ATTRIBUTE_FETCHID

setFetchid

public void setFetchid(String fetchid)
Set the fetchid attribute.

Parameters:
fetchid - Value of the fetchid attribute.
See Also:
ATTRIBUTE_FETCHID

getMaxage

public String getMaxage()
Retrieve the maxage attribute.

Returns:
Value of the maxage attribute.
See Also:
ATTRIBUTE_MAXAGE

setMaxage

public void setMaxage(String maxage)
Set the maxage attribute.

Parameters:
maxage - Value of the maxage attribute.
See Also:
ATTRIBUTE_MAXAGE

getMaxstale

public String getMaxstale()
Retrieve the maxstale attribute.

Returns:
Value of the maxstale attribute.
See Also:
ATTRIBUTE_MAXSTALE

setMaxstale

public void setMaxstale(String maxstale)
Set the maxstale attribute.

Parameters:
maxstale - Value of the maxstale attribute.
See Also:
ATTRIBUTE_MAXSTALE

getMethod

public String getMethod()
Retrieve the method attribute.

Returns:
Value of the method attribute.
See Also:
ATTRIBUTE_METHOD

setMethod

public void setMethod(String method)
Set the method attribute.

Parameters:
method - Value of the method attribute.
See Also:
ATTRIBUTE_METHOD

getNamelist

public String getNamelist()
Retrieve the namelist attribute.

Returns:
Value of the namelist attribute.
See Also:
ATTRIBUTE_NAMELIST

setNamelist

public void setNamelist(String namelist)
Set the namelist attribute.

Parameters:
namelist - Value of the namelist attribute.
See Also:
ATTRIBUTE_NAMELIST

getNext

public String getNext()
Retrieve the next attribute.

Returns:
Value of the next attribute.
See Also:
ATTRIBUTE_NEXT

setNext

public void setNext(String next)
Set the next attribute.

Parameters:
next - Value of the next attribute.
See Also:
ATTRIBUTE_NEXT

getTimeout

public String getTimeout()
Retrieve the timeout attribute.

Returns:
Value of the timeout attribute.
See Also:
ATTRIBUTE_TIMEOUT

setTimeout

public void setTimeout(String timeout)
Set the timeout attribute.

Parameters:
timeout - Value of the timeout attribute.
See Also:
ATTRIBUTE_TIMEOUT

getType

public String getType()
Retrieve the type attribute.

Returns:
Value of the type attribute.
See Also:
ATTRIBUTE_TYPE

setType

public void setType(String type)
Set the type attribute.

Parameters:
type - Value of the type attribute.
See Also:
ATTRIBUTE_TYPE

canContainChild

protected boolean canContainChild(String tagName)
Can the specified sub-tag be contained within this node?

Specified by:
canContainChild in class XmlNode
Parameters:
tagName - Name of child.
Returns:
True if the sub-tag is allowed on this node.

getAttributeNames

public Collection<String> getAttributeNames()
Returns a collection of permitted attribute names for the node.

Overrides:
getAttributeNames in class XmlNode
Returns:
A collection of attribute names that are allowed for the node


Copyright © 2005 JVoiceXML group.