Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

CAS_ProxiedService_Http_Abstract Class Reference

Inheritance diagram for CAS_ProxiedService_Http_Abstract:
CAS_ProxiedService_Abstract CAS_ProxiedService_Http CAS_ProxiedService CAS_ProxiedService_Testable CAS_ProxiedService_Http_Get CAS_ProxiedService_Http_Post

List of all members.

Public Member Functions

 __construct (CAS_RequestInterface $requestHandler, CAS_CookieJar $cookieJar)
 getServiceUrl ()
 setUrl ($url)
 send ()
 getResponseHeaders ()
 getResponseStatusCode ()
 getResponseBody ()

Protected Member Functions

 makeRequest ($url)
 populateRequest (CAS_RequestInterface $request)
 hasBeenSent ()

Protected Attributes

 $_requestHandler

Private Member Functions

 getRedirectUrl (array $responseHeaders)

Private Attributes

 $_cookieJar
 $_url
 $_numRequests = 0
 $_responseHeaders = array()
 $_responseStatusCode = ''
 $_responseBody = ''

Detailed Description

This class implements common methods for ProxiedService implementations included with phpCAS.

Definition at line 42 of file Abstract.php.


Constructor & Destructor Documentation

CAS_ProxiedService_Http_Abstract::__construct ( CAS_RequestInterface requestHandler,
CAS_CookieJar cookieJar 
)

Constructor.

Parameters:
CAS_RequestInterface $requestHandler
CAS_CookieJar $cookieJar
Returns:
void

Definition at line 67 of file Abstract.php.


Member Function Documentation

CAS_ProxiedService_Http_Abstract::getRedirectUrl ( array $  responseHeaders  )  [private]

Answer a redirect URL if a redirect header is found, otherwise null.

Parameters:
array $responseHeaders
Returns:
string or null

Definition at line 246 of file Abstract.php.

CAS_ProxiedService_Http_Abstract::getResponseBody (  ) 

Answer the body of response.

Returns:
string
Exceptions:
CAS_OutOfSequenceException If called before the Request has been sent.

Implements CAS_ProxiedService_Http.

Definition at line 301 of file Abstract.php.

CAS_ProxiedService_Http_Abstract::getResponseHeaders (  ) 

Answer the headers of the response.

Returns:
array An array of header strings.
Exceptions:
CAS_OutOfSequenceException If called before the Request has been sent.

Implements CAS_ProxiedService_Http.

Definition at line 275 of file Abstract.php.

CAS_ProxiedService_Http_Abstract::getResponseStatusCode (  ) 

Answer HTTP status code of the response

Returns:
integer
Exceptions:
CAS_OutOfSequenceException If called before the Request has been sent.

Definition at line 288 of file Abstract.php.

CAS_ProxiedService_Http_Abstract::getServiceUrl (  ) 

Answer a service identifier (URL) for whom we should fetch a proxy ticket.

Returns:
string
Exceptions:
Exception If no service url is available.

Definition at line 84 of file Abstract.php.

Referenced by send().

CAS_ProxiedService_Http_Abstract::hasBeenSent (  )  [protected]

Answer true if our request has been sent yet.

Returns:
boolean

Definition at line 265 of file Abstract.php.

Referenced by send(), CAS_ProxiedService_Http_Post::setBody(), CAS_ProxiedService_Http_Post::setContentType(), and setUrl().

CAS_ProxiedService_Http_Abstract::makeRequest ( url  )  [protected]

Build and perform a request, following redirects

Parameters:
string $url
Returns:
void
Exceptions:
CAS_ProxyTicketException If there is a proxy-ticket failure. The code of the Exception will be one of: PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE PHPCAS_SERVICE_PT_FAILURE
CAS_ProxiedService_Exception If there is a failure sending the request to the target service.

Definition at line 190 of file Abstract.php.

References populateRequest(), and phpCAS::trace().

Referenced by send().

CAS_ProxiedService_Http_Abstract::populateRequest ( CAS_RequestInterface request  )  [abstract, protected]

Add any other parts of the request needed by concrete classes

Parameters:
CAS_RequestInterface $request
Returns:
void

Reimplemented in CAS_ProxiedService_Http_Get, and CAS_ProxiedService_Http_Post.

Referenced by makeRequest().

CAS_ProxiedService_Http_Abstract::send (  ) 

Perform the request.

Returns:
void
Exceptions:
CAS_OutOfSequenceException If called multiple times.
CAS_ProxyTicketException If there is a proxy-ticket failure. The code of the Exception will be one of: PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE PHPCAS_SERVICE_PT_FAILURE
CAS_ProxiedService_Exception If there is a failure sending the request to the target service.

Implements CAS_ProxiedService_Http.

Definition at line 127 of file Abstract.php.

References CAS_ProxiedService_Abstract::getProxyTicket(), getServiceUrl(), hasBeenSent(), CAS_ProxiedService_Abstract::initializeProxyTicket(), makeRequest(), phpCAS::traceBegin(), and phpCAS::traceEnd().

CAS_ProxiedService_Http_Abstract::setUrl ( url  ) 

Set the URL of the Request

Parameters:
string $url
Returns:
void
Exceptions:
CAS_OutOfSequenceException If called after the Request has been sent.

Implements CAS_ProxiedService_Http.

Definition at line 102 of file Abstract.php.

References hasBeenSent().


Member Data Documentation

CAS_CookieJar CAS_ProxiedService_Http_Abstract::$_cookieJar [private]

The storage mechanism for cookies set by the target service.

Definition at line 58 of file Abstract.php.

int CAS_ProxiedService_Http_Abstract::$_numRequests = 0 [private]

Indicator of the number of requests (including redirects performed.

Definition at line 155 of file Abstract.php.

CAS_RequestInterface CAS_ProxiedService_Http_Abstract::$_requestHandler [protected]

The HTTP request mechanism talking to the target service.

Definition at line 51 of file Abstract.php.

string CAS_ProxiedService_Http_Abstract::$_responseBody = '' [private]

The response headers.

Definition at line 176 of file Abstract.php.

array CAS_ProxiedService_Http_Abstract::$_responseHeaders = array() [private]

The response headers.

Definition at line 162 of file Abstract.php.

string CAS_ProxiedService_Http_Abstract::$_responseStatusCode = '' [private]

The response status code.

Definition at line 169 of file Abstract.php.

string CAS_ProxiedService_Http_Abstract::$_url [private]

The target service url.

Definition at line 76 of file Abstract.php.