Package DE_EPAGES::RemoteSearch::API::Object::HTTPClient
HTTP communication adapter
All HTTP requests namely get, post, delete
have in commen:
- They apply default HTTP header to each request provided by new
- They throw an error 'REQUEST_FAILED' if HTTP::Response::is_success() is false
or the response don't arrive in a timely manner.
The Response time limit is defined by $Adapter->UserAgent->timeout($seconds), default timeout is 10 seconds.
Functions
delete
Construct and execute a HTTP::Request::Commen::DELETE using $URL and $hHeaders
Syntax |
my $HTTPResponse = $Adapter->delete($Path, $hHeader ); |
Example |
my $HTTPResponse = $Adapter->delete($Path, {'PriorityHeader' => true}); |
Input |
|
Return |
|
get
Construct and execute a HTTP::Request::Common::GET request using $URL and $hHeader
Syntax |
my $HTTPResponse = $Adapter->get($Path, $hHeaders ); |
Input |
|
Return |
|
new
creates a new remote adapter
Syntax |
my $Adapter = DE_EPAGES::RemoteSearch::API::Object::HTTPClient->new( %options ); |
Input |
|
Return |
|
ping
Checks if remote server is reachable via Net::Ping (ICMP). Timout limit is derieved from $self->userAgent->timeout().
Syntax |
$Adapter->ping($Hostname); |
Example |
eval { $Adapter->ping($Hostname); $Adapter->get($URL); }; |
Input |
|
Return |
|
post
Construct a HTTP::Request::Common::POST using $Content, $hHeaders and execute the request.
Syntax |
my $HTTPResponse = $Adapter->post($Path, $hHeader, $Content ); |
Example |
my $HTTPResponse = $Adapter->post($Path, {'PriorityHeader' => true}, 'Body of my POST...' ); |
Input |
|
Return |
|