PHP Class Jackalope\Transport\Jackrabbit\Request

Author: Christian Stocker ([email protected])
Author: David Buchmann ([email protected])
Author: Roland Schilter ([email protected])
Author: Jordi Boggiano ([email protected])
Author: Lukas Kahwe Smith ([email protected])
Author: Markus Schmucker ([email protected])
Afficher le fichier Open project: jackalope/jackalope-jackrabbit

Protected Properties

Свойство Type Description
$additionalHeaders
$body string Posted content for methods that require it
$client Client
$contentType string Request content-type
$credentials PHPCR\CredentialsInterface Set of credentials necessary to connect to the server or else.
$curl Jackalope\Transport\Jackrabbit\curl
$depth integer How far the request should go, default is 0
$errorHandlingMode boolean Whether we are in error handling mode to prevent infinite recursion
$lockToken string | FALSE The lock token active for this request otherwise FALSE for no locking
$method string Name of the request method to be used.
$uri array .
$versionChecked boolean Doing this once per php process is enough.

Méthodes publiques

Méthode Description
__construct ( Jackalope\FactoryInterface $factory, Client $client, Jackalope\Transport\Jackrabbit\curl $curl, string $method, string | array $uri ) Initiaties the NodeTypes request object.
addCurlOptions ( array $options ) Add curl-options for this request.
addHeader ( string $header ) add an additional http header
addUserData ( string $userData ) Add the user data header
execute ( boolean $getCurlObject = false, boolean $forceMultiple = false ) : string | Jackalope\Transport\Jackrabbit\curl | array Requests the data to be identified by a formerly prepared request.
executeDom ( boolean $forceMultiple = false ) : DOMDocument Loads the response into an DOMDocument.
executeJson ( boolean $forceMultiple = false ) : mixed Loads the server response as a json string.
forceHttpVersion10 ( ) Force curl to use HTTP version 1.0
setBody ( string $body ) Set the request body
setContentType ( string $contentType ) Set a different content type for this request. The default is text/xml in utf-8
setCredentials ( PHPCR\CredentialsInterface $creds = null ) Set the credentials for the request. Setting them to null will make a request without authentication header.
setDepth ( integer | string $depth ) Set the depth to which nodes should be fetched.
setLockToken ( string $lockToken ) Set the transaction lock token to be used with this request
setMethod ( string $method ) Set or update the HTTP method to be used in this request.
setUri ( string | array $uri )

Méthodes protégées

Méthode Description
getLongErrorString ( Jackalope\Transport\Jackrabbit\curl $curl, string $response ) : string returns a longer error string to be used in generic exceptions
getShortErrorString ( ) : string returns a shorter error string to be used in exceptions
handleError ( Jackalope\Transport\Jackrabbit\curl $curl, string $response, integer $httpCode ) Handles errors caused by singleRequest and multiRequest
multiRequest ( boolean $getCurlObject = false ) : array Requests the data for multiple requests
prepareCurl ( Jackalope\Transport\Jackrabbit\curl $curl, boolean $getCurlObject ) used by multiCurl with fresh curl instances
singleRequest ( boolean $getCurlObject ) : string | Jackalope\Transport\Jackrabbit\curl Requests the data for a single requests

Method Details

__construct() public méthode

Initiaties the NodeTypes request object.
public __construct ( Jackalope\FactoryInterface $factory, Client $client, Jackalope\Transport\Jackrabbit\curl $curl, string $method, string | array $uri )
$factory Jackalope\FactoryInterface Ignored for now, as this class does not create objects
$client Client The jackrabbit client instance
$curl Jackalope\Transport\Jackrabbit\curl The cURL object to use in this request
$method string the HTTP method to use, one of the class constants
$uri string | array the remote url for this request, including protocol, host name, workspace and path to the object to manipulate. May be an array of uri

addCurlOptions() public méthode

Add curl-options for this request.
public addCurlOptions ( array $options )
$options array

addHeader() public méthode

add an additional http header
public addHeader ( string $header )
$header string HTTP header

addUserData() public méthode

Add the user data header
public addUserData ( string $userData )
$userData string

execute() public méthode

Prepares the curl object, executes it and checks for transport level errors, throwing the appropriate exceptions.
public execute ( boolean $getCurlObject = false, boolean $forceMultiple = false ) : string | Jackalope\Transport\Jackrabbit\curl | array
$getCurlObject boolean wheter to return the curl object instead of the response
$forceMultiple boolean whether to force parallel requests or not
Résultat string | Jackalope\Transport\Jackrabbit\curl | array response string or the curl object.

executeDom() public méthode

Returns a DOMDocument from the backend or throws exception. Does error handling for both connection errors and dcr:exception response
public executeDom ( boolean $forceMultiple = false ) : DOMDocument
$forceMultiple boolean whether to force parallel requests or not
Résultat DOMDocument The loaded XML response text.

executeJson() public méthode

Returns a decoded json string from the backend or throws exception
public executeJson ( boolean $forceMultiple = false ) : mixed
$forceMultiple boolean whether to force parallel requests or not
Résultat mixed

forceHttpVersion10() public méthode

Force curl to use HTTP version 1.0
Deprecation: use addCurlOptions([CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0]) instead
public forceHttpVersion10 ( )

getLongErrorString() protected méthode

It returns a "nicely" formatted URI of the request plus the output of curl_getinfo plus the response body including its size
protected getLongErrorString ( Jackalope\Transport\Jackrabbit\curl $curl, string $response ) : string
$curl Jackalope\Transport\Jackrabbit\curl The curl object
$response string the response body
Résultat string the error message

getShortErrorString() protected méthode

It returns a "nicely" formatted URI of the request
protected getShortErrorString ( ) : string
Résultat string the error message

handleError() protected méthode

For transport level errors, tries to figure out what went wrong to throw the most appropriate exception.
protected handleError ( Jackalope\Transport\Jackrabbit\curl $curl, string $response, integer $httpCode )
$curl Jackalope\Transport\Jackrabbit\curl
$response string the response body
$httpCode integer the http response code

multiRequest() protected méthode

Requests the data for multiple requests
protected multiRequest ( boolean $getCurlObject = false ) : array
$getCurlObject boolean whether to return the curl object instead of the response
Résultat array of XML representations of responses or curl objects.

prepareCurl() protected méthode

used by multiCurl with fresh curl instances
protected prepareCurl ( Jackalope\Transport\Jackrabbit\curl $curl, boolean $getCurlObject )
$curl Jackalope\Transport\Jackrabbit\curl
$getCurlObject boolean whether to return the curl object instead of the response

setBody() public méthode

Set the request body
public setBody ( string $body )
$body string

setContentType() public méthode

Set a different content type for this request. The default is text/xml in utf-8
public setContentType ( string $contentType )
$contentType string

setCredentials() public méthode

Set the credentials for the request. Setting them to null will make a request without authentication header.
public setCredentials ( PHPCR\CredentialsInterface $creds = null )
$creds PHPCR\CredentialsInterface the credentials to use in the request.

setDepth() public méthode

To support more than 0, we need to implement more logic in parsing the response too.
public setDepth ( integer | string $depth )
$depth integer | string

setLockToken() public méthode

Set the transaction lock token to be used with this request
public setLockToken ( string $lockToken )
$lockToken string the transaction lock

setMethod() public méthode

Set or update the HTTP method to be used in this request.
public setMethod ( string $method )
$method string the HTTP method to use, one of the class constants

setUri() public méthode

public setUri ( string | array $uri )
$uri string | array the request target

singleRequest() protected méthode

Requests the data for a single requests
protected singleRequest ( boolean $getCurlObject ) : string | Jackalope\Transport\Jackrabbit\curl
$getCurlObject boolean whether to return the curl object instead of the response
Résultat string | Jackalope\Transport\Jackrabbit\curl XML representation of a response or curl object.

Property Details

$additionalHeaders protected_oe property

protected $additionalHeaders

$body protected_oe property

Posted content for methods that require it
protected string $body
Résultat string

$client protected_oe property

protected Client,Jackalope\Transport\Jackrabbit $client
Résultat Client

$contentType protected_oe property

Request content-type
protected string $contentType
Résultat string

$credentials protected_oe property

Set of credentials necessary to connect to the server or else.
protected CredentialsInterface,PHPCR $credentials
Résultat PHPCR\CredentialsInterface

$curl protected_oe property

protected curl,Jackalope\Transport\Jackrabbit $curl
Résultat Jackalope\Transport\Jackrabbit\curl

$depth protected_oe property

How far the request should go, default is 0
protected int $depth
Résultat integer

$errorHandlingMode protected_oe property

Whether we are in error handling mode to prevent infinite recursion
protected bool $errorHandlingMode
Résultat boolean

$lockToken protected_oe property

The lock token active for this request otherwise FALSE for no locking
protected string|FALSE $lockToken
Résultat string | FALSE

$method protected_oe property

Name of the request method to be used.
protected string $method
Résultat string

$uri protected_oe property

.
protected array $uri
Résultat array

$versionChecked protected_oe static_oe property

Doing this once per php process is enough.
protected static bool $versionChecked
Résultat boolean