Implements interfaces:
THttpRequest class
THttpRequest provides storage and access scheme for user request sent via HTTP. It also encapsulates a uniform way to parse and construct URLs.
User post data can be retrieved from THttpRequest by using it like an associative array. For example, to test if a user supplies a variable named 'param1', you can use,
To get the value of 'param1', use,
- if(isset($request['param1'])) ...
- // equivalent to:
- // if($request->contains('param1')) ...
To traverse the user post data, use
- $value=$request['param1'];
- // equivalent to:
- // $value=$request->itemAt('param1');
Note, POST and GET variables are merged together in THttpRequest. If a variable name appears in both POST and GET data, then POST data takes precedence.
- foreach($request as $name=>$value) ...
To construct a URL that can be recognized by Prado, use constructUrl(). The format of the recognizable URLs is determined according to UrlManager. By default, the following two formats are recognized:
The first format is called 'Get' while the second 'Path', which is specified via UrlFormat. For advanced users who want to use their own URL formats, they can write customized URL management modules and install the managers as application modules and set UrlManager.
- /index.php?ServiceID=ServiceParameter&Name1=Value1&Name2=Value2
- /index.php/ServiceID,ServiceParameter/Name1,Value1/Name2,Value2
The ServiceID in the above URLs is as defined in the application configuration (e.g. the default page service's service ID is 'page'). As a consequence, your GET variable names should not conflict with the service IDs that your application supports.
THttpRequest also provides the cookies sent by the user, user information such as his browser capabilities, accepted languages, etc.
By default, THttpRequest is registered with TApplication as the request module. It can be accessed via TApplication::getRequest().
Located in /Web/THttpRequest.php (line 71)
TComponent | --TApplicationComponent | --THttpRequest
Adds an item into the request.
Note, if the specified key already exists, the old value will be overwritten.
Removes all items in the request.
Constructs a URL that can be recognized by PRADO.
The actual construction work is done by the URL manager module. This method may append session information to the generated URL if needed. You may provide your own URL manager module by setting UrlManager to provide your own URL scheme.
Note, the constructed URL does not contain the protocol and hostname part. You may obtain an absolute URL by prepending the constructed URL with BaseUrl.
Returns the number of items in the request.
This method is required by Countable interface.
Returns an iterator for traversing the items in the list.
This method is required by the interface IteratorAggregate.
Returns a list of user preferred languages.
The languages are returned as an array. Each array element represents a single language preference. The languages are ordered according to user preferences. The first language is the most preferred.
Initializes the module.
This method is required by IModule and is invoked by application.
Returns the item with the specified key.
This method is exactly the same as offsetGet.
Returns whether there is an element at the specified offset.
This method is required by the interface ArrayAccess.
Returns the element at the specified offset.
This method is required by the interface ArrayAccess.
Sets the element at the specified offset.
This method is required by the interface ArrayAccess.
Unsets the element at the specified offset.
This method is required by the interface ArrayAccess.
Parses the request URL and returns an array of input parameters (excluding GET variables).
You may override this method to support customized URL format.
Removes an item from the request by its key.
Resolves the requested service.
This method implements a URL-based service resolution. A URL in the format of /index.php?sp=serviceID.serviceParameter will be resolved with the serviceID and the serviceParameter. You may override this method to provide your own way of service resolution.
Sets the requested service ID.
Sets the requested service parameter.
Sets the format of URLs constructed and interpretted by the request module.
A Get URL format is like index.php?name1=value1&name2=value2 while a Path URL format is like index.php/name1,value1/name2,value. Changing the UrlFormat will affect constructUrl and how GET variables are parsed.
Sets the URL manager module.
By default, TUrlManager is used for managing URLs. You may specify a different module for URL managing tasks by loading it as an application module and setting this property with the module ID.
Strips slashes from input data.
This method is applied when magic quotes is enabled.
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:09 -0400 by phpDocumentor 1.3.0RC4