bes Updated for version 3.20.13
|
#include <RemoteResource.h>
Public Member Functions | |
rapidjson::Document | get_as_json () |
get_as_json() This function returns the cached resource parsed into a JSON document. | |
std::string | get_http_response_header (const std::string header_name) |
std::string | get_response_as_string () |
std::string | getCacheFileName () |
std::vector< std::string > * | getResponseHeaders () |
std::string | getType () |
RemoteResource (std::shared_ptr< http::url > target_url, const std::string &uid="", long long expires_interval=HttpCache::getCacheExpiresTime()) | |
void | retrieveResource () |
void | retrieveResource (const std::map< std::string, std::string > &content_filters) |
virtual | ~RemoteResource () |
Friends | |
class | RemoteResourceTest |
This class encapsulates a remote resource available via HTTP GET. It will retrieve the content of the resource and place it in a local disk cache for rapid (subsequent) access. It can be configure to use a proxy server for the outgoing requests.
Definition at line 55 of file RemoteResource.h.
|
inlineprotected |
Definition at line 145 of file RemoteResource.h.
http::RemoteResource::RemoteResource | ( | std::shared_ptr< http::url > | target_url, |
const std::string & | uid = "" , |
||
long long | expires_interval = HttpCache::getCacheExpiresTime() |
||
) |
Definition at line 68 of file RemoteResource.cc.
|
virtual |
Releases any memory resources and also any existing cache file locks for the cached resource. ( Closes the file descriptor opened when retrieveResource() was called.)
Definition at line 207 of file RemoteResource.cc.
rapidjson::Document http::RemoteResource::get_as_json | ( | ) |
get_as_json() This function returns the cached resource parsed into a JSON document.
target_url | The URL to dereference. @TODO Move this to ../curl_utils.cc (Requires moving the rapidjson lib too) |
Definition at line 712 of file RemoteResource.cc.
std::string http::RemoteResource::get_http_response_header | ( | const std::string | header_name | ) |
Returns the value of the requested HTTP response header. Evaluation is case-insensitive. If the requested header_name is not found the empty string is returned.
Definition at line 609 of file RemoteResource.cc.
std::string http::RemoteResource::get_response_as_string | ( | ) |
Returns cache file content in a string..
Definition at line 675 of file RemoteResource.cc.
std::string http::RemoteResource::getCacheFileName | ( | ) |
Returns the (read-locked) cache file name on the local system in which the content of the remote resource is stored. Deleting of the instance of this class will release the read-lock.
Definition at line 229 of file RemoteResource.cc.
vector< string > * http::RemoteResource::getResponseHeaders | ( | ) |
Returns a std::vector of HTTP headers received along with the response from the request for the remote resource..
Definition at line 722 of file RemoteResource.cc.
|
inline |
Returns the DAP type std::string of the RemoteHttpResource
Definition at line 165 of file RemoteResource.h.
void http::RemoteResource::retrieveResource | ( | ) |
This method will check the cache for the resource. If it's not there then it will lock the cache and retrieve the remote resource content using HTTP GET.
When this method returns the RemoteResource object is fully initialized and the cache file name for the resource is available along with an open file descriptor for the (now read-locked) cache file.
Definition at line 244 of file RemoteResource.cc.
void http::RemoteResource::retrieveResource | ( | const std::map< std::string, std::string > & | content_filters | ) |
This method will check the cache for the resource. If it's not there then it will lock the cache and retrieve the remote resource content using HTTP GET.
When this method returns the RemoteHttpResource object is fully initialized and the cache file name for the resource is available along with an open file descriptor for the (now read-locked) cache file.
uid | |
template_key | |
replace_value |
Definition at line 260 of file RemoteResource.cc.
|
friend |
Definition at line 57 of file RemoteResource.h.