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.Web.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.

PHP configuration style:

  1.   'services' => array(
  2.     'get_article' => array(
  3.      'class' => 'Path.To.JsonResponseClass1',
  4.      'properties' => array(
  5.        ...
  6.         )
  7.     )
  8.   )

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 54)

TComponent
   |
   --TApplicationComponent
      |
      --TService
         |
         --TJsonService
Method Summary
void createJsonResponse ( $service,  $properties,  $config)
void init (mixed $xml)
void loadJsonServices (mixed $config)
void run ()
Methods
createJsonResponse (line 146)

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

  • access: protected
void createJsonResponse ( $service,  $properties,  $config)
  • $service
  • $properties
  • $config
init (line 66)

Initializes this module.

This method is required by the IModule interface.

  • access: public
void init (mixed $xml)
  • mixed $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 75)

Load the service definitions.

  • access: protected
void loadJsonServices (mixed $config)
  • mixed $config: configuration for this module, can be null
run (line 101)

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::__call()
TComponent::__get()
TComponent::__set()
TComponent::__sleep()
TComponent::__wakeup()

Documentation generated on Mon, 25 Jun 2012 14:38:33 +0200 by phpDocumentor 1.4.3