bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
http::url Class Reference

Parse a URL into the protocol, host, path and query parts. More...

#include <url_impl.h>

Inheritance diagram for http::url:
Inheritance graph
Collaboration diagram for http::url:
Collaboration graph

Public Types

using kvp_map_t = std::map<std::string, std::vector<std::string>>
 

Public Member Functions

virtual std::string dump ()
 
virtual std::string host () const
 
virtual std::time_t ingest_time () const
 
virtual bool is_expired ()
 
virtual bool is_trusted () const
 
urloperator= (const url &rhs)=delete
 
virtual std::string path () const
 
virtual std::string protocol () const
 
virtual std::string query () const
 
virtual std::string query_parameter_value (const std::string &key) const
 Get the value of a query string key.
 
virtual const std::vector< std::string > & query_parameter_values (const std::string &key) const
 Get the vector of query string values for a given key.
 
virtual size_t query_parameter_values_size (const std::string &key) const
 Return the number of query string values for a given key .
 
virtual void set_ingest_time (const std::time_t &itime)
 
virtual std::string str () const
 
 url (const http::url &src_url)=default
 
 url (const std::shared_ptr< http::url > &source_url)
 
 url (const std::shared_ptr< http::url > &source_url, bool trusted)
 
 url (std::string url_s, bool trusted=false)
 

Friends

class HttpUrlTest
 

Detailed Description

Parse a URL into the protocol, host, path and query parts.

Note
This class also manages time and time-based expiration using KVP info that AWS puts in the query string of the URL.

Definition at line 44 of file url_impl.h.

Member Typedef Documentation

◆ kvp_map_t

using http::url::kvp_map_t = std::map<std::string, std::vector<std::string>>

Definition at line 46 of file url_impl.h.

Constructor & Destructor Documentation

◆ url() [1/3]

http::url::url ( std::string url_s,
bool trusted = false )
inlineexplicit

Definition at line 66 of file url_impl.h.

◆ url() [2/3]

http::url::url ( const std::shared_ptr< http::url > & source_url)
inlineexplicit

Definition at line 75 of file url_impl.h.

◆ url() [3/3]

http::url::url ( const std::shared_ptr< http::url > & source_url,
bool trusted )
inline

Definition at line 86 of file url_impl.h.

Member Function Documentation

◆ dump()

string http::url::dump ( )
virtual

Returns a string representation of the URL and its bits.

Returns
the representation mentioned above.

Reimplemented in http::EffectiveUrl.

Definition at line 295 of file url_impl.cc.

◆ host()

virtual std::string http::url::host ( ) const
inlinevirtual

Definition at line 105 of file url_impl.h.

◆ ingest_time()

virtual std::time_t http::url::ingest_time ( ) const
inlinevirtual

Definition at line 111 of file url_impl.h.

◆ is_expired()

bool http::url::is_expired ( )
virtual
Returns
True if the URL appears within the REFRESH_THRESHOLD of the expires time read from one of CLOUDFRONT_EXPIRES_HEADER_KEY or AMS_EXPIRES_HEADER_KEY.

Reimplemented in http::EffectiveUrl.

Definition at line 212 of file url_impl.cc.

◆ is_trusted()

virtual bool http::url::is_trusted ( ) const
inlinevirtual

Definition at line 124 of file url_impl.h.

◆ path()

virtual std::string http::url::path ( ) const
inlinevirtual

Definition at line 107 of file url_impl.h.

◆ protocol()

virtual std::string http::url::protocol ( ) const
inlinevirtual

Definition at line 103 of file url_impl.h.

◆ query()

virtual std::string http::url::query ( ) const
inlinevirtual

Definition at line 109 of file url_impl.h.

◆ query_parameter_value()

string http::url::query_parameter_value ( const std::string & key) const
virtual

Get the value of a query string key.

Parameters
keyKey for the KVP query params
Returns
The associated value for the key or an empty string if the key is not found.

Definition at line 167 of file url_impl.cc.

◆ query_parameter_values()

const vector< string > & http::url::query_parameter_values ( const std::string & key) const
virtual

Get the vector of query string values for a given key.

Parameters
keyKey for the KVP query params
Returns
Return a const reference to a string of values. Throws BESInternalError if the key is not found.
See also
query_parameter_values_size() to test if the key is present.

Definition at line 198 of file url_impl.cc.

◆ query_parameter_values_size()

size_t http::url::query_parameter_values_size ( const std::string & key) const
virtual

Return the number of query string values for a given key .

Parameters
keyKey for the KVP query params
Returns
Return the number of values or zero if the key is not found.

Definition at line 183 of file url_impl.cc.

◆ set_ingest_time()

virtual void http::url::set_ingest_time ( const std::time_t & itime)
inlinevirtual

Definition at line 115 of file url_impl.h.

◆ str()

virtual std::string http::url::str ( ) const
inlinevirtual

Definition at line 101 of file url_impl.h.

Friends And Related Symbol Documentation

◆ HttpUrlTest

friend class HttpUrlTest
friend

Definition at line 61 of file url_impl.h.


The documentation for this class was generated from the following files: