URL: Uniform Resource Locator
https://en.m.wikipedia.org/wiki/URL
-
URI_SCHEME_MAP(XX)
-
XX(name, str, port)
Common URI scheme strings.
-
class Url
- #include <Url.h>
Class to manage URL instance.
Note
The various URL components are stored in un-escaped format for ease of editing. Unless otherwise indicated, methods act on un-escaped text. Methods used to obtain escaped versions are clearly marked. Any attached fragment (marked bv ‘#’) in the URL is discarded
Public Functions
-
inline Url(const String &urlString)
Construct a URL object from a regular escaped string.
- Parameters:
urlString – Escaped URL
-
inline Url(const char *urlString)
Construct a URL object from a regular null-terminated escaped string.
- Parameters:
urlString – Escaped URL
-
Url &operator=(String urlString)
Copy assignment operator.
Note
urlString is modified by so no point in passing const reference
- Parameters:
urlString – Escaped URL
-
inline Url &operator=(const char *urlString)
Copy assignment operator, for C-style strings.
- Parameters:
urlString – Escaped URL
-
String getScheme() const
Get the applicable scheme, using the default if not specified The returned string is always lowercase.
-
inline int getPort() const
Obtain the actual port number to be used.
Note
If not specified, the default scheme port is returned
- Return values:
int –
-
String getHostWithPort() const
Get hostname+port part of URL string.
Note
Neither of these is subject to escaping
- Return values:
String –
-
String getPathWithQuery() const
Get path with any query parameters attached.
Note
Both path and query values are escaped
- Return values:
String –
-
void debugPrintTo(Print &p) const
Printable output for debugging.
- Parameters:
p –
-
inline const String &getQueryParameter(const String &name, const String &defaultValue = nullptr) const
Get a query parameter.
- Parameters:
name – Name of parameter
defaultValue – Optional default value to use if requested parameter not present
- Return values:
String& – Accessing
Query
directly risks adding the value if it doesn’t exist. This method isconst
so is guaranteed read-only.
Public Members
-
int Port = 0
Undefined by default.
-
inline Url(const String &urlString)