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,

  1. <service id="json" class="System.Services.TJsonService">
  2. <json id="get_article" class="Path.To.JsonResponseClass1" .../>
  3. <json id="register_rating" class="Path.To.JsonResponseClass2" .../>
  4. </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

  1. index.php?json=get_article

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 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 Mon, 21 Apr 2008 11:35:22 -0400 by phpDocumentor 1.3.0RC4