atscppapi  1.0.9
C++ wrapper for Apache Traffic Server API
 All Classes Files Functions Enumerations Enumerator Macros
Public Member Functions | List of all members
atscppapi::Url Class Reference

This class contains all properties of a Url. More...

#include "Url.h"

Inherits atscppapi::noncopyable.

Public Member Functions

const std::string & getUrlString () const
 
const std::string & getPath () const
 
const std::string & getQuery () const
 
const std::string & getScheme () const
 
const std::string & getHost () const
 
uint16_t getPort () const
 
void setPath (const std::string &)
 
void setQuery (const std::string &)
 
void setScheme (const std::string &)
 
void setHost (const std::string &)
 
void setPort (const uint16_t)
 
void reset ()
 

Detailed Description

This class contains all properties of a Url.

You can use a Url object to get and set any property of a url.

Warning
Url objects should never be constructed by the user. If a user needs to create an unbound Url then they should create a Request object using Request::Request(string) which will construct a Url object for them and it can be retrieved via Request::getUrl(). A full example of this is available in examples/detachedrequest/.

Member Function Documentation

const std::string & Url::getHost ( ) const
Returns
The host only of the url, this might be www.linkedin.com
const std::string & Url::getPath ( ) const
Returns
The path only portion of the url, such as /profile/view
uint16_t Url::getPort ( ) const
Returns
The port only portion of the url, this will likely be 80 or 443.
const std::string & Url::getQuery ( ) const
Returns
The query only portion of the url, which might be id=1234
const std::string & Url::getScheme ( ) const
Returns
The scheme of the url, this will be either http or https.
const std::string & Url::getUrlString ( ) const
Returns
The full url as a string, such a url might be http://www.linkedin.com/profile/view?id=2941
void Url::reset ( )

This method allows you to reset the url, this will force the Url to fully re-read all cached values. If this method is used on a Detached Requests' Url object it will completely destroy the values.

Note
This method should rarely be used.
void Url::setHost ( const std::string &  host)

Set the host of the url

Parameters
hostthis might be something such as www.linkedin.com or www.apache.org
void Url::setPath ( const std::string &  path)

Set the path of the url.

Parameters
paththe path portion of the url to set, this might be something like /foo/bar
void Url::setPort ( const uint16_t  port)

Set the port portion of the url.

Parameters
portthis is a uint16_t which represents the port (in host order, there is no need to conver to network order). You might use a value such as 80 or 8080.
void Url::setQuery ( const std::string &  query)

Set the query param of the url.

Parameters
querythe query portion of the url, this might be something like foo=bar&blah=baz.
void Url::setScheme ( const std::string &  scheme)

Set the scheme of the url

Parameters
schemethis might be either http or https.

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