## Class TJsonService

Description

TJsonService class provides to end-users javascript content response in JSON format.

TJsonService manages a set of TJsonResponse, each representing specific response with javascript content. The service parameter, referring to the ID of the service, specifies which javascript content to be provided to end-users.

To use TJsonService, configure it in application configuration as follows,

      <service id="json" class="System.Web.Services.TJsonService">
        <json id="get_article" class="Path.To.JsonResponseClass1" .../>
        <json id="register_rating" class="Path.To.JsonResponseClass2" .../>
      </service>

where each JSON response is specified via a &lt;json&gt; element. Initial property values can be configured in a &lt;json&gt; element.

To retrieve the JSON content provided by "get_article", use the URL

    index.php?json=get_article

- since: 3.1
- version: $Id: TJsonService.php 2574 2008-11-30 23:09:51Z carlgmathisen $
- author: Wei Zhuo <weizhuo[at]gmail[dot]com>

Located in /Web/Services/TJsonService.php (line 40)

    TComponent
       |
       --TApplicationComponent
          |
          --TService
             |
             --TJsonService

Method Summary
void createJsonResponse (mixed $service, mixed $properties, mixed $config)
void init (TXmlElement $xml)
void loadJsonServices (TXmlElement $xml)
void run ()
Methods
createJsonResponse (line 102)

Renders content provided by TJsonResponse::getJsonContent() as javascript in JSON format.

- access: protected

void createJsonResponse (mixed $service, mixed $properties, mixed $config)
init (line 52)

Initializes this module.

This method is required by the IModule interface.

- access: public

void init (TXmlElement $xml)

- TXmlElement $xml: configuration for this module, can be null

Redefinition of:

TService::init()
  Initializes the service and attaches run to the RunService event of application.

loadJsonServices (line 61)

Load the service definitions.

- access: protected

void loadJsonServices (TXmlElement $xml)

- TXmlElement $xml: configuration for this module, can be null

run (line 76)

Runs the service.

This method is invoked by application automatically.

- access: public

void run ()

Redefinition of:

TService::run()
  Runs the service.

#### Inherited Methods

Inherited From TService

> TService::getEnabled()
> TService::getID()
> TService::init()
> TService::run()
> TService::setEnabled()
> TService::setID()

Inherited From TApplicationComponent

> TApplicationComponent::getApplication()
> TApplicationComponent::getRequest()
> TApplicationComponent::getResponse()
> TApplicationComponent::getService()
> TApplicationComponent::getSession()
> TApplicationComponent::getUser()
> TApplicationComponent::publishAsset()
> TApplicationComponent::publishFilePath()

Inherited From TComponent

> TComponent::addParsedObject()
> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::createdOnTemplate()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Documentation generated on Sun, 11 Jan 2009 20:22:54 -0500 by phpDocumentor 1.3.0RC4