- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml
Classes:
IFeedContentProvider
TFeedService
TJsonResponse
TJsonService
TPageConfiguration
TPageService
TSoapServer
TSoapService

Keyword

# Class TJsonService

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

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
Author: Wei Zhuo <weizhuo[at]gmail[dot]com>

Method Summary
protected void | createJsonResponse ( mixed $service, mixed $properties, mixed $config) Renders content provided by TJsonResponse::getJsonContent() as javascript in JSON format.
void | init ( TXmlElement $xml) Initializes this module.
protected void | loadJsonServices ( TXmlElement $xml) Load the service definitions.
void | run () Runs the service.

Methods Inherited From TService
TService::getEnabled(), TService::getID(), TService::init(), TService::run(), TService::setEnabled(), TService::setID()

Methods Inherited From TApplicationComponent
TApplicationComponent::getApplication(), TApplicationComponent::getRequest(), TApplicationComponent::getResponse(), TApplicationComponent::getService(), TApplicationComponent::getSession(), TApplicationComponent::getUser(), TApplicationComponent::publishAsset(), TApplicationComponent::publishFilePath()

Methods 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()

Method Details

## createJsonResponse

protected void createJsonResponse | (mixed $service , mixed $properties , mixed $config )

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

Input
mixed | $service |
mixed | $properties |
mixed | $config |
Output
Exception

## init

public void init | (TXmlElement $xml )

Initializes this module.

This method is required by the IModule interface.

Input
TXmlElement | $xml | configuration for this module, can be null
Output
Exception

## loadJsonServices

protected void loadJsonServices | (TXmlElement $xml )

Load the service definitions.

Input
TXmlElement | $xml | configuration for this module, can be null
Output
Exception

## run

public void run | ()

Runs the service.

This method is invoked by application automatically.

Output
Exception