Class PHRUTS_HttpServiceRequest

Description

Defines an object to provide HTTP client request information to a service.

A PHRUTS_HttpServiceRequest object provides data including parameters names and values, and attributes.

  • author: John WILDENAUER <jwilde@users.sourceforge.net> (PHP4 port of Struts)
  • author: Olivier HENRY <oliv.henry@gmail.com> (PHP5 port of Struts)
  • version: $Id: PHRUTS_HttpServiceRequest.php,v 1.3 2008/05/21 16:50:27 ohenry Exp $
  • copyright: Copyright PHruts 2008

Located in /connector/PHRUTS_HttpServiceRequest.php (line 36)


	
			
Class Constant Summary
 BASIC_AUTH = 'BASIC'
 CLIENT_CERT_AUTH = 'CLIENT_CERT'
 DIGEST_AUTH = 'DIGEST'
 FORM_AUTH = 'FORM'
Variable Summary
Method Summary
PHRUTS_HttpServiceRequest __construct ()
void __destruct ()
object getAttribute (string $name)
string getAuthType ()
string getContentType ()
array getCookies ()
string getHeader (string $name)
array getHeaderNames ()
string getMethod ()
string getParameter (string $name)
string getProtocol ()
string getQueryString ()
string getRemoteAddr ()
integer getRemotePort ()
string getRemoteUser ()
string getRequestURI ()
string getRequestURL ()
string getScheme ()
string getServerName ()
integer getServerPort ()
PHRUTS_HttpSession getSession ([boolean $create = true])
boolean isSecure ()
boolean isUserInRole (string $role)
void removeAttribute (string $name)
void setAttribute (string $name, object $object)
Variables
array $attributes = array() (line 59)

The attributes associated with this request, keyed by attribute name.

  • access: protected
array $cookies = array() (line 73)

The set of cookies associated with this request.

  • access: protected
PHRUTS_Locale $locale = null (line 66)

Preferred PHRUTS_Locale that the client will accept content in.

  • access: protected
PHRUTS_HttpSession $session = null (line 80)

Current PHRUTS_HttpSession associated with this request.

  • access: protected
Methods
Constructor __construct (line 82)
  • access: public
PHRUTS_HttpServiceRequest __construct ()
Destructor __destruct (line 500)
  • todo: Comment the method.
  • access: public
void __destruct ()
getAttribute (line 105)

Returns the value of the named attribute as an object, or null if no attribute of the given name exists.

  • access: public
object getAttribute (string $name)
  • string $name: A string specifying the name of the attribute
getAttributeNames (line 123)

Returns an array containing the names of the attributes available to this request.

This method returns an empty array if the request has no attributes available to it.

  • access: public
array getAttributeNames ()
getAuthType (line 274)

Returns the name of the authentication scheme used to protect the service.

If the service is not authenticated null is returned.

Same as the value of the CGI variable AUTH_TYPE.

  • return: One of the constant members BASIC_AUTH, FORM_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH or null if the request was not authenticated.
  • access: public
string getAuthType ()
getContentType (line 396)

Returns the MIME type of the body of the request, or null if the type is not known.

Same as the value of the CGI variable CONTENT_TYPE.

  • access: public
string getContentType ()
getCookies (line 445)

Returns an array containing all of the Cookie objects the client sent with this request.

This method returns null if no cookies were sent.

  • return: An array of all the Cookies included with this request, or null if the request has no cookies
  • access: public
array getCookies ()
getHeader (line 167)

Returns the value of the specified request header as a string.

The header name is case sensitive. You can use this method with any request header.

  • return: A string containing the value of the requested header, or null if the request does not have a header of that name
  • access: public
string getHeader (string $name)
  • string $name: A string specifying the header name
getHeaderNames (line 183)

Returns an array of all the header names this request contains.

If the request has no headers, this method returns an empty enumeration.

  • access: public
array getHeaderNames ()
getLocale (line 489)

Returns the preferred PHRUTS_Locale that the client will accept content in, based on the Accept-Language header.

If the client request doesn't provide an Accept-Language header, this method returns the default locale for the server.

  • access: public
PHRUTS_Locale getLocale ()
getMethod (line 325)

Returns the name of the HTTP method with which this request was made, for exemple, GET, POST or PUT.

Same as the value of the CGI variable REQUEST_METHOD.

  • access: public
string getMethod ()
getParameter (line 415)

Returns the value of a request parameter as a string or null if the parameter does not exist.

Request parameters are extra information sent with the request. The parameters are contained in the query string or posted form data.

  • return: A string representing the value of the parameter
  • access: public
string getParameter (string $name)
  • string $name: A string specifying the name of the parameter
getParameterNames (line 432)

Returns an array of string containing the names of the parameters contained in this request.

If the request has no parameters, the method returns an empty array.

  • access: public
array getParameterNames ()
getProtocol (line 196)

Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion.

For example "HTTP/1.1". The value returned is the same as the value of the CGI variable SERVER_PROTOCOL.

  • access: public
string getProtocol ()
getQueryString (line 353)

Returns the query string that is contained in the request URL after the path.

This method returns null if the URL does not have a query string. Same as the value of the CGI variable QUERY_STRING.

  • access: public
string getQueryString ()
getRemoteAddr (line 251)

Returns the Internet Protocol (IP) address of the client or last proxy that sent the request.

Same as the value of the CGI variable REMOTE_ADDR.

  • access: public
string getRemoteAddr ()
getRemotePort (line 261)

Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.

  • access: public
integer getRemotePort ()
getRemoteUser (line 293)

Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.

Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Same as the value of the CGI variable REMOTE_USER.

  • access: public
string getRemoteUser ()
getRequestURI (line 340)

Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request.

For example:

  • "GET /some/path.php HTTP/1.1" : "/some/path.php"
  • "GET http://foo.bar/a/b.php?x=y HTTP/1.1" : "/a/b.php"

  • access: public
string getRequestURI ()
getRequestURL (line 372)

Reconstructs the URL the client used to make the request.

The returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters. This method is useful for creating redirect messages and for reporting errors.

  • return: String containing the reconstructed URL
  • access: public
string getRequestURL ()
getScheme (line 206)

Returns the name of the scheme used to make this request: "http" or "https".

  • access: public
string getScheme ()
getServerName (line 230)

Returns the host name of the server to which the request was sent.

  • access: public
string getServerName ()
getServerPort (line 239)

Returns the port number to which this request was sent.

  • access: public
integer getServerPort ()
getSession (line 465)

Returns the current PHRUTS_HttpSession associated with this request or, if there is no current session and create is true, returns a new session.

If create is false and the request has no valid PHRUTS_HttpSession this method returns null.

To make sur the session is properly maintained, you must call this method before the response is committed.

  • access: public
PHRUTS_HttpSession getSession ([boolean $create = true])
  • boolean $create: True to create a new session for this request if necessary; false to return null if there's no current session
isSecure (line 220)

Returns a boolean indicating whether this request was made using a secure channel (HTTPS).

  • access: public
boolean isSecure ()
isUserInRole (line 313)

Returns a boolean indicating whether the authenticated user is included in the specified logical "role".

Roles and role membership can be defined using deployment descriptors. If the user has not been authenticated, the method returns false.

  • todo: Implements the method.
  • access: public
boolean isUserInRole (string $role)
  • string $role
removeAttribute (line 152)

Removes an attribute from this request.

  • access: public
void removeAttribute (string $name)
  • string $name: A string specifying the name of the attribute to remove
setAttribute (line 137)

Stores an attribute in this request.

Attributes are reset between requests.

If the object passed in is null, the effect is the same as calling removeAttribute.

  • access: public
void setAttribute (string $name, object $object)
  • string $name: A string specifying the name of the attribute
  • object $object: The object to be stored
Class Constants
BASIC_AUTH = 'BASIC' (line 40)

String identifier for Basic authentication.

CLIENT_CERT_AUTH = 'CLIENT_CERT' (line 48)

String identifier for Client Certificate authentication.

DIGEST_AUTH = 'DIGEST' (line 52)

String identifier for Digest authentication.

FORM_AUTH = 'FORM' (line 44)

String identifier for Form authentication.

Documentation generated on Sat, 31 May 2008 15:46:07 +0200 by phpDocumentor 1.4.1