Class Url
- java.lang.Object
-
- co.elastic.apm.agent.impl.context.Url
-
- All Implemented Interfaces:
Recyclable
public class Url extends java.lang.Object implements Recyclable
A complete URL, with scheme, host, port, path and query string.
-
-
Constructor Summary
Constructors Constructor Description Url()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidcopyFrom(Url other)voidfillFrom(java.lang.CharSequence uriString)Deprecated.voidfillFrom(java.net.URI uri)Fills all attributes of Url fromURIinstance, also updates fullvoidfillFrom(java.net.URL url)Fills all attributes of Url fromURLinstance, also updates fulljava.lang.StringBuildergetFull()The full, possibly agent-assembled URL of the request, e.g https://example.com:443/search?q=elasticsearch#top.java.lang.StringgetHostname()The hostname of the request, e.g.java.lang.StringgetPathname()The path of the request, e.g.intgetPort()The port of the request, e.g.java.lang.StringgetProtocol()The protocol of the request, e.g.java.lang.StringgetSearch()The search describes the query string of the request.booleanhasContent()voidparseAndFillFromFull()Parses the full property as URL and populates individual propertiesvoidresetState()resets pooled object state so it can be reusedUrlwithFull(java.lang.CharSequence value)Sets the full URL from an arbitrary string.UrlwithHostname(java.lang.String hostname)The hostname of the request, e.g.UrlwithPathname(java.lang.String pathname)The path of the request, e.g.UrlwithPort(int port)The port of the request, e.g.UrlwithProtocol(java.lang.String protocol)The protocol of the request, e.g.UrlwithSearch(java.lang.String search)The search describes the query string of the request.
-
-
-
Method Detail
-
getProtocol
@Nullable public java.lang.String getProtocol()
The protocol of the request, e.g. 'https:'.
-
withProtocol
public Url withProtocol(@Nullable java.lang.String protocol)
The protocol of the request, e.g. 'https:'.
-
getFull
public java.lang.StringBuilder getFull()
The full, possibly agent-assembled URL of the request, e.g https://example.com:443/search?q=elasticsearch#top.
-
withFull
public Url withFull(java.lang.CharSequence value)
Sets the full URL from an arbitrary string. The value is only parsed if the URL might contain user credentials for sanitizing, otherwise it's copied as-is without allocation.- Parameters:
value- full URL- Returns:
- this
-
getHostname
@Nullable public java.lang.String getHostname()
The hostname of the request, e.g. 'example.com'.
-
withHostname
public Url withHostname(@Nullable java.lang.String hostname)
The hostname of the request, e.g. 'example.com'.
-
getPort
public int getPort()
The port of the request, e.g. 443
-
withPort
public Url withPort(int port)
The port of the request, e.g. 443
-
getPathname
@Nullable public java.lang.String getPathname()
The path of the request, e.g. '/search'
-
withPathname
public Url withPathname(@Nullable java.lang.String pathname)
The path of the request, e.g. '/search'
-
getSearch
@Nullable public java.lang.String getSearch()
The search describes the query string of the request. It is expected to have values delimited by ampersands.
-
withSearch
public Url withSearch(@Nullable java.lang.String search)
The search describes the query string of the request. It is expected to have values delimited by ampersands.
-
fillFrom
public void fillFrom(java.net.URI uri)
Fills all attributes of Url fromURIinstance, also updates full- Parameters:
uri- URI
-
fillFrom
public void fillFrom(java.net.URL url)
Fills all attributes of Url fromURLinstance, also updates full- Parameters:
url- URL
-
fillFrom
@Deprecated public void fillFrom(java.lang.CharSequence uriString)
Deprecated.
-
parseAndFillFromFull
public void parseAndFillFromFull()
Parses the full property as URL and populates individual properties
-
resetState
public void resetState()
Description copied from interface:Recyclableresets pooled object state so it can be reused- Specified by:
resetStatein interfaceRecyclable
-
copyFrom
public void copyFrom(Url other)
-
hasContent
public boolean hasContent()
-
-