PhpExt : Data [ class tree ] [ index ] [ all elements ]

Class: PhpExt_Data_ScriptTagProxy

Source Location: /PhpExt/Data/ScriptTagProxy.php

Class PhpExt_Data_ScriptTagProxy

Class Overview

An implementation of Ext.data.DataProxy that reads a data object from a URL which may be in a domain other than the originating domain of the running page.

Note that if you are retrieving data from a page that is in a domain that is NOT the same as the originating domain of the running page, you must use this class, rather than HttpProxy.

The content passed back from a server resource requested by a ScriptTagProxy is executable JavaScript source code that is used as the source inside a <script> tag.

In order for the browser to process the returned data, the server must wrap the data object with a call to a callback function, the name of which is passed as a parameter by the ScriptTagProxy. Below is a Java example for a servlet which returns data for either a ScriptTagProxy, or an HttpProxy depending on whether the callback name was passed:

  1.  boolean scriptTag false;
  2.  String cb request.getParameter("callback");
  3.  if (cb != null{
  4.      scriptTag true;
  5.      response.setContentType("text/javascript");
  6.  else {
  7.      response.setContentType("application/x-json");
  8.  }
  9.  Writer out response.getWriter();
  10.  if (scriptTag{
  11.      out.write(cb "(");
  12.  }
  13.  out.print(dataBlock.toJsonString());
  14.  if (scriptTag{
  15.      out.write(");");
  16.  }

Located in /PhpExt/Data/ScriptTagProxy.php [line 46]

PhpExt_Object
   |
   --PhpExt_Observable
      |
      --PhpExt_Data_DataProxy
         |
         --PhpExt_Data_ScriptTagProxy

Methods

[ Top ]
Method Summary
PhpExt_Data_ScriptTagProxy   __construct()  
string   getCallbackParam()   (Optional) The name of the parameter to pass to the server which tells the server the name of the callback function set up by the load call to process the returned data object. Defaults to "callback".
boolean   getNoCache()   (Optional) Defaults to true. Disable cacheing by adding a unique parameter name to the request.
integer   getTimeout()   (Optional) The number of milliseconds to wait for a response. Defaults to 30 seconds.
string   getUrl()   The URL from which to request the data object.
PhpExt_Data_ScriptTagProxy   setCallbackParam()   <p>(Optional) The name of the parameter to pass to the server which tells the server the name of the callback function set up by the load call to process the returned data object. Defaults to "callback".</p> <p>The server-side processing must read this parameter value, and generate javascript output which calls this named function passing the data object as its only parameter.</p>
PhpExt_Data_ScriptTagProxy   setNoCache()   (Optional) Defaults to true. Disable cacheing by adding a unique parameter name to the request.
PhpExt_Data_ScriptTagProxy   setTimeout()   (Optional) The number of milliseconds to wait for a response. Defaults to 30 seconds.
PhpExt_Data_ScriptTagProxy   setUrl()   The URL from which to request the data object.

[ Top ]
Methods
Constructor __construct  [line 127]

  PhpExt_Data_ScriptTagProxy __construct( string $url  )

Parameters:
string   $url:  The URL from which to request the data object.

API Tags:
Access:  public


Redefinition of:
PhpExt_Data_DataProxy::__construct()

[ Top ]
getCallbackParam  [line 66]

  string getCallbackParam( )

(Optional) The name of the parameter to pass to the server which tells the server the name of the callback function set up by the load call to process the returned data object. Defaults to "callback".

The server-side processing must read this parameter value, and generate javascript output which calls this named function passing the data object as its only parameter.


API Tags:
Access:  public


[ Top ]
getNoCache  [line 84]

  boolean getNoCache( )

(Optional) Defaults to true. Disable cacheing by adding a unique parameter name to the request.


API Tags:
Access:  public


[ Top ]
getTimeout  [line 102]

  integer getTimeout( )

(Optional) The number of milliseconds to wait for a response. Defaults to 30 seconds.


API Tags:
Access:  public


[ Top ]
getUrl  [line 120]

  string getUrl( )

The URL from which to request the data object.


API Tags:
Access:  public


[ Top ]
setCallbackParam  [line 56]

  PhpExt_Data_ScriptTagProxy setCallbackParam( string $value  )

<p>(Optional) The name of the parameter to pass to the server which tells the server the name of the callback function set up by the load call to process the returned data object. Defaults to "callback".</p> <p>The server-side processing must read this parameter value, and generate javascript output which calls this named function passing the data object as its only parameter.</p>

Parameters:
string   $value: 

API Tags:
Access:  public


[ Top ]
setNoCache  [line 76]

  PhpExt_Data_ScriptTagProxy setNoCache( boolean $value  )

(Optional) Defaults to true. Disable cacheing by adding a unique parameter name to the request.

Parameters:
boolean   $value: 

API Tags:
Access:  public


[ Top ]
setTimeout  [line 94]

  PhpExt_Data_ScriptTagProxy setTimeout( integer $value  )

(Optional) The number of milliseconds to wait for a response. Defaults to 30 seconds.

Parameters:
integer   $value: 

API Tags:
Access:  public


[ Top ]
setUrl  [line 112]

  PhpExt_Data_ScriptTagProxy setUrl( string $value  )

The URL from which to request the data object.

Parameters:
string   $value: 

API Tags:
Access:  public


[ Top ]

Documentation generated on Fri, 08 Aug 2008 15:59:06 -0500 by phpDocumentor 1.4.0