ePages 6.11.0 - DE_EPAGES/WebInterface/API/FakeRequest.pm

Package DE_EPAGES::WebInterface::API::FakeRequest

Similates a web request to the application server without actually transmitting it over a TCP/IP connection. This object instanciates a fake application server and processes the HTTP request locally.

Example
my $FakeRequest = DE_EPAGES::WebInterface::API::FakeRequest->new;
my $Request = HTTP::Request->new( 'GET', '/epages/DemoShop.sf' );
$Request->header( 'Host' => 'www.meinshop.de' );
my $Response = $FakeRequest->request( $Request );
if( !$Response->is_success ) {
    die $Response->status_line;
}
else {
    print $Response->content;
}

Functions

get
lookupPoolDB
new
post
request

get

Simulates a GET request.

Syntax
$Response = $FakeRequest->get( $URL );
$Response = $FakeRequest->get( $URL, $aHeaders );
Example
$Response = $FakeRequest->get( 'http://www.meinshop.de/epages/DemoShop.sf' );
Input
$URL (string)
request URL
$aHeaders (ref.array)
(optional) additional HTTP headers (key1, value1, key2, value2,...)
Return
$Response (object)
HTTP::Response

lookupPoolDB

Looks up the request URL in the PoolDB and adds the headers X-ePages-Site, X-ePages-Store and X-ePages-Pool.

Syntax
$FakeRequest->lookupPoolDB( $Request );
Input
$Request (object)
HTTP::Request

new

Creates a FakeRequest object.

Syntax
$FakeRequest = DE_EPAGES::WebInterface::API::FakeRequest->new();

post

Simulates a POST request.

Syntax
$Response = $FakeRequest->post( $URL, $Content );
$Response = $FakeRequest->post( $URL, $Content, $ContentType );
$Response = $FakeRequest->post( $URL, $Content, $ContentType, $aHeaders );
Input
$URL (string)
request URL
$Content (string)
request content
$ContentType (string)
(optional) content type (default: application/x-www-form-urlencoded)
$aHeaders (ref.array)
(optional) additional HTTP headers (key1, value1, key2, value2,...)
Return
$Response (object)
HTTP::Response

request

Simulates a request.

Syntax
$Response = $FakeRequest->request( $Request );
Input
$Request (object)
HTTP::Request
Return
$Response (object)
HTTP::Response

Package DE_EPAGES::WebInterface::API::FakeRequest::AppServer

Package DE_EPAGES::WebInterface::API::FakeRequest::MessageCenter

Package DE_EPAGES::WebInterface::API::FakeRequest::MonitorThread