- 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:
IActiveControl
IBindable
ICache
ICacheDependency
ICallbackEventHandler
IDataRenderer
IModule
IRenderable
IService
IStatePersister
IStyleable
ITextWriter
IUser
Prado
PradoBase
TApplication
TApplicationComponent
TApplicationConfiguration
TApplicationMode
TApplicationStatePersister
TComponent
TComponentReflection
TDraggableConstraint
TDropContainerEventParameter
TEnumerable
TEventParameter
TModule
TPropertyValue
TReflectionClass
TService
TShellApplication

Keyword

# Class TApplicationComponent

    TComponent
       |
       --TApplicationComponent

#### Direct Known Sub-classes:

TClientScriptManager , TControlAdapter , TCallbackClientScript , TTheme , TDataGridColumn , TTemplate , TControl , THtmlWriter , THttpResponseAdapter , TSoapServer , TJsonResponse , THttpRequest , THttpSession , TLogRoute , TService , TModule

TApplicationComponent class

TApplicationComponent is the base class for all components that are application-related, such as controls, modules, services, etc.

TApplicationComponent mainly defines a few properties that are shortcuts to some commonly used methods. The Application property gives the application instance that this component belongs to; Service gives the current running service; Request, Response and Session return the request and response modules, respectively; And User gives the current user instance.

Besides, TApplicationComponent defines two shortcut methods for publishing private files: publishAsset and publishFilePath.

Since: 3.0
Author: Qiang Xue <qiang.xue@gmail.com>

Method Summary
TApplication | getApplication ()
THttpRequest | getRequest ()
THttpResponse | getResponse ()
IService | getService ()
THttpSession | getSession ()
IUser | getUser ()
string | publishAsset ( string $assetPath, string $className) Publishes a private asset and gets its URL.
string | publishFilePath ( string $fullPath) Publishes a file or directory and returns its URL.

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

## getApplication

public TApplication getApplication | ()

Output
TApplication | current application instance
Exception

## getRequest

public THttpRequest getRequest | ()

Output
THttpRequest | the current user request
Exception

## getResponse

public THttpResponse getResponse | ()

Output
THttpResponse | the response
Exception

## getService

public IService getService | ()

Output
IService | the current service
Exception

## getSession

public THttpSession getSession | ()

Output
THttpSession | user session
Exception

## getUser

public IUser getUser | ()

Output
IUser | information about the current user
Exception

## publishAsset

public string publishAsset | (string $assetPath , string $className )

Publishes a private asset and gets its URL.

This method will publish a private asset (file or directory) and gets the URL to the asset. Note, if the asset refers to a directory, all contents under that directory will be published. Also note, it is recommended that you supply a class name as the second parameter to the method (e.g. publishAsset($assetPath,__CLASS__) ). By doing so, you avoid the issue that child classes may not work properly because the asset path will be relative to the directory containing the child class file.

Input
string | $assetPath | path of the asset that is relative to the directory containing the specified class file.
string | $className | name of the class whose containing directory will be prepend to the asset path. If null, it means get_class($this).
Output
string | URL to the asset path.
Exception

## publishFilePath

public string publishFilePath | (string $fullPath )

Publishes a file or directory and returns its URL.

Input
string | $fullPath | absolute path of the file or directory to be published
Output
string | URL to the published file or directory
Exception