AJAX
[ class tree: AJAX ] [ index: AJAX ] [ all elements ]

Class: HTML_AJAX_Server

Source Location: /HTML_AJAX-0.1.4/AJAX/Server.php

Class Overview


Class for creating an external AJAX server


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2005 Joshua Eichorn

Variables

Methods


Child classes:

TestServer
Class for creating an external AJAX server

Inherited Variables

Inherited Methods


Class Details

[line 45]
Class for creating an external AJAX server

Can be used in 2 different modes, registerClass mode where you create an instance of the server and add the classes that will be registered and then run handle request

Or you can extend it and add init{className} methods for each class you want to export

Client js generation is exposed through 2 _GET params client and stub Setting the _GET param client to `all` will give you all the js classes needed Setting the _GET param stub to `all` will give you stubs of all registered classes, you can also set it too just 1 class



[ Top ]


Class Variables

$ajax =

[line 58]

HTML_AJAX instance

Type:   HTML_AJAX


[ Top ]

$cacheOptions = array(
        'httpCacheClient'       => true, 
        'ClientCacheRule'       => 'file',
        'ClientCacheExpects'    => 'files',
        'httpCacheStub'         => true, 
        'StubCacheRule'         => 'api', 
        'StubCacheExpects'      => 'classes', 
        )

[line 93]

An array of options that tell the server howto Cache output

The rules are functions that make etag hash used to see if the client needs to download updated content If you extend this class you can make your own rule function the naming convention is _cacheRule{RuleName}


1 array(
2 'httpCacheClient' => true, // send 304 headers for responses to ?client=* requests
3 'ClientCacheRule' => 'File', // create a hash from file names and modified times, options: file|content
4 'ClientCacheExpects'=> 'files', // what type of content to send to the hash function, options: files|classes|content
5 'httpCacheStub' => true, // send 304 headers for responses to ?stub=* requests
6 'StubCacheRule' => 'Api', // create a hash from the exposed api, options: api|content
7 'StubCacheExpects'=> 'classes', // what type of content to send to the hash function, options: files|classes|content
8 )

  • Access: public

Type:   array


[ Top ]

$clientJsLocation =  false

[line 71]

Location on filesystem of client javascript library
  • Var: if false the default pear data dir location is used

Type:   false|string


[ Top ]

$initMethods =  false

[line 65]

Set to true if your extending the server to add init{className methods}
  • Access: public

Type:   boolean


[ Top ]

$javascriptLibraries = array(
        'all'       =>  'HTML_AJAX.js',
        'html_ajax' =>  'HTML_AJAX.js',
        'html_ajax_lite'=>  'HTML_AJAX_lite.js',
        'json'      =>  'JSON.js',
        'request'   =>  'Request.js',
        'main'      =>  'Main.js',
        'httpclient'=>  'HttpClient.js',
        'dispatcher'=>  'Dispatcher.js'
    )

[line 110]

Javascript library names and there path

the return of $this->clientJsLocation(), is appended before running readfile on them

  • Access: public

Type:   array


[ Top ]

$options =  true

[line 52]

Client options array if set to true the code looks at _GET

Type:   bool|array


[ Top ]



Method Detail

HTML_AJAX_Server (Constructor)   [line 126]

HTML_AJAX_Server HTML_AJAX_Server( )

Constructor creates the HTML_AJAX instance

[ Top ]

clientJsLocation   [line 307]

string clientJsLocation( )

Get the location of the client js To override the default pear datadir location set $this->clientJsLocation

[ Top ]

generateClient   [line 165]

void generateClient( )

Generate client js
  • Todo: this is going to need tests to cover all the options

[ Top ]

handleRequest   [line 137]

string handleRequest( )

Handle a client request, either generating a client or having HTML_AJAX handle the request
  • Return: generated client or ajax response

[ Top ]

registerClass   [line 155]

void registerClass( mixed &$instance, [mixed $exportedName = false], [mixed $exportedMethods = false])

Register method passthrough to HTML_AJAX
  • See: HTML_AJAX::registerClass for docs

[ Top ]


Documentation generated on Fri, 19 Aug 2005 16:00:16 -0400 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.