Package org.refcodes.net
Class UrlImpl
- java.lang.Object
-
- org.refcodes.net.UrlImpl
-
- All Implemented Interfaces:
org.refcodes.mixin.CredentialsAccessor
,org.refcodes.mixin.Dumpable
,org.refcodes.mixin.IdentityAccessor
,org.refcodes.mixin.PathAccessor
,org.refcodes.mixin.PortAccessor
,org.refcodes.mixin.SecretAccessor
,FragmentAccessor
,HostAccessor
,IpAddressAccessor
,QueryFieldsAccessor
,SchemeAccessor
,Url
public class UrlImpl extends java.lang.Object implements Url
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.CredentialsAccessor
org.refcodes.mixin.CredentialsAccessor.CredentialsBuilder<B extends org.refcodes.mixin.CredentialsAccessor.CredentialsBuilder<B>>, org.refcodes.mixin.CredentialsAccessor.CredentialsMutator, org.refcodes.mixin.CredentialsAccessor.CredentialsProperty
-
Nested classes/interfaces inherited from interface org.refcodes.net.FragmentAccessor
FragmentAccessor.FragmentBuilder<B extends FragmentAccessor.FragmentBuilder<?>>, FragmentAccessor.FragmentMutator, FragmentAccessor.FragmentProperty
-
Nested classes/interfaces inherited from interface org.refcodes.net.HostAccessor
HostAccessor.HostBuilder<B extends HostAccessor.HostBuilder<?>>, HostAccessor.HostMutator, HostAccessor.HostProperty
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.IdentityAccessor
org.refcodes.mixin.IdentityAccessor.IdentityBuilder<B extends org.refcodes.mixin.IdentityAccessor.IdentityBuilder<B>>, org.refcodes.mixin.IdentityAccessor.IdentityMutator, org.refcodes.mixin.IdentityAccessor.IdentityProperty
-
Nested classes/interfaces inherited from interface org.refcodes.net.IpAddressAccessor
IpAddressAccessor.IpAddressBuilder<B extends IpAddressAccessor.IpAddressBuilder<B>>, IpAddressAccessor.IpAddressMutator, IpAddressAccessor.IpAddressProperty
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.PathAccessor
org.refcodes.mixin.PathAccessor.PathBuilder<B extends org.refcodes.mixin.PathAccessor.PathBuilder<?>>, org.refcodes.mixin.PathAccessor.PathMutator, org.refcodes.mixin.PathAccessor.PathProperty
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.PortAccessor
org.refcodes.mixin.PortAccessor.PortBuilder<B extends org.refcodes.mixin.PortAccessor.PortBuilder<B>>, org.refcodes.mixin.PortAccessor.PortMutator, org.refcodes.mixin.PortAccessor.PortProperty
-
Nested classes/interfaces inherited from interface org.refcodes.net.QueryFieldsAccessor
QueryFieldsAccessor.QueryFieldsBuilder<B extends QueryFieldsAccessor.QueryFieldsBuilder<?>>, QueryFieldsAccessor.QueryFieldsMutator, QueryFieldsAccessor.QueryFieldsProperty
-
Nested classes/interfaces inherited from interface org.refcodes.net.SchemeAccessor
SchemeAccessor.SchemeBuilder<B extends SchemeAccessor.SchemeBuilder<B>>, SchemeAccessor.SchemeMutator, SchemeAccessor.SchemeProperty
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.SecretAccessor
org.refcodes.mixin.SecretAccessor.SecretBuilder<B extends org.refcodes.mixin.SecretAccessor.SecretBuilder<B>>, org.refcodes.mixin.SecretAccessor.SecretMutator, org.refcodes.mixin.SecretAccessor.SecretProperty
-
Nested classes/interfaces inherited from interface org.refcodes.net.Url
Url.UrlBuilder
-
-
Constructor Summary
Constructors Constructor Description UrlImpl()
Default constructor.UrlImpl(java.lang.String aUrl)
Constructs anUrl
from the provided URLString
.UrlImpl(java.lang.String aProtocol, java.lang.String aHost)
Constructs anUrl
with the common attributes.UrlImpl(java.lang.String aProtocol, java.lang.String aHost, int aPort)
Constructs anUrl
with the common attributes.UrlImpl(java.lang.String aProtocol, java.lang.String aHost, int aPort, java.lang.String aPath)
Constructs anUrl
with the common attributes.UrlImpl(java.lang.String aProtocol, java.lang.String aHost, int aPort, java.lang.String aPath, FormFields aQueryFields)
Constructs anUrl
with the common attributes.UrlImpl(java.lang.String aProtocol, java.lang.String aHost, int aPort, java.lang.String aPath, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl
with the common attributes.UrlImpl(java.lang.String aProtocol, java.lang.String aHost, java.lang.String aPath)
Constructs anUrl
with the common attributes.UrlImpl(java.lang.String aProtocol, java.lang.String aHost, java.lang.String aPath, FormFields aQueryFields)
Constructs anUrl
with the common attributes.UrlImpl(java.lang.String aProtocol, java.lang.String aHost, java.lang.String aPath, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl
with the common attributes.UrlImpl(java.lang.String aUrl, FormFields aQueryFields)
Constructs anUrl
from the provided URLString
.UrlImpl(java.lang.String aUrl, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl
from the provided URLString
.UrlImpl(java.net.URL aURL)
Constructs anUrl
from the providedURL
instance.UrlImpl(org.refcodes.data.Scheme aScheme, java.lang.String aHost)
Constructs anUrl
with the common attributes.UrlImpl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, int aPort)
Constructs anUrl
with the common attributes.UrlImpl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, int aPort, java.lang.String aPath)
Constructs anUrl
with the common attributes.UrlImpl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, int aPort, java.lang.String aPath, FormFields aQueryFields)
Constructs anUrl
with the common attributes.UrlImpl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, int aPort, java.lang.String aPath, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl
with the common attributes.UrlImpl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, java.lang.String aPath)
Constructs anUrl
with the common attributes.UrlImpl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, java.lang.String aPath, FormFields aQueryFields)
Constructs anUrl
with the common attributes.UrlImpl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, java.lang.String aPath, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl
with the common attributes.UrlImpl(Url aUrl)
UrlImpl(Url aUrl, java.lang.String... aPaths)
UrlImpl(Url aUrl, Url aOtherUrl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getFragment()
Retrieves the fragment from the fragment property.java.lang.String
getHost()
Retrieves the host from the host property.java.lang.String
getIdentity()
int[]
getIpAddress()
Retrieves the IP-Address from the IP-Address property.java.lang.String
getPath()
int
getPort()
FormFields
getQueryFields()
Retrieves the request Query-Fields from the request Query-Fields property.org.refcodes.data.Scheme
getScheme()
Retrieves the UrlScheme from the URL scheme.java.lang.String
getSecret()
java.lang.String
toProtocol()
Retrieves the protocol representation from theScheme
.java.lang.String
toString()
-
Methods inherited from interface org.refcodes.net.IpAddressAccessor
toCidrNotation
-
-
-
-
Constructor Detail
-
UrlImpl
public UrlImpl()
Default constructor. Make sure to set required attributes for a valid URL.
-
UrlImpl
public UrlImpl(java.lang.String aUrl) throws java.net.MalformedURLException
Constructs anUrl
from the provided URLString
.- Parameters:
aUrl
- The URLString
to be parsed. The URL consists of the scheme (protocol), the identify and the secret (optional), the host as well as an optional port and the (optional) path.- Throws:
java.net.MalformedURLException
- in case the provided URL is considered being malformed.
-
UrlImpl
public UrlImpl(java.lang.String aUrl, FormFields aQueryFields) throws java.net.MalformedURLException
Constructs anUrl
from the provided URLString
.- Parameters:
aUrl
- The URLString
to be parsed. The URL consists of the scheme (protocol), the identify and the secret (optional), the host as well as an optional port and the (optional) path.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.- Throws:
java.net.MalformedURLException
- in case the provided URL is considered being malformed.
-
UrlImpl
public UrlImpl(java.lang.String aUrl, FormFields aQueryFields, java.lang.String aFragment) throws java.net.MalformedURLException
Constructs anUrl
from the provided URLString
.- Parameters:
aUrl
- The URLString
to be parsed. The URL consists of the scheme (protocol), the identify and the secret (optional), the host as well as an optional port and the (optional) path.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.aFragment
- The fragment to be set.- Throws:
java.net.MalformedURLException
- in case the provided URL is considered being malformed.
-
UrlImpl
public UrlImpl(java.net.URL aURL)
Constructs anUrl
from the providedURL
instance.- Parameters:
aURL
- TheURL
to be used.
-
UrlImpl
public UrlImpl(org.refcodes.data.Scheme aScheme, java.lang.String aHost)
Constructs anUrl
with the common attributes.- Parameters:
aScheme
- TheScheme
(e.g. HTTP or HTTPS) to be used for the destination URL.aHost
- The host to which the destination URL is to point to.
-
UrlImpl
public UrlImpl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, int aPort)
Constructs anUrl
with the common attributes.- Parameters:
aScheme
- TheScheme
(e.g. HTTP or HTTPS) to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPort
- The port to be used when connecting to the host.
-
UrlImpl
public UrlImpl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, int aPort, java.lang.String aPath)
Constructs anUrl
with the common attributes.- Parameters:
aScheme
- TheScheme
(e.g. HTTP or HTTPS) to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPort
- The port to be used when connecting to the host.aPath
- The path on the host to which the base destination URL is to point to.
-
UrlImpl
public UrlImpl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, int aPort, java.lang.String aPath, FormFields aQueryFields)
Constructs anUrl
with the common attributes.- Parameters:
aScheme
- TheScheme
(e.g. HTTP or HTTPS) to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPort
- The port to be used when connecting to the host.aPath
- The path on the host to which the base destination URL is to point to.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.
-
UrlImpl
public UrlImpl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, int aPort, java.lang.String aPath, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl
with the common attributes.- Parameters:
aScheme
- TheScheme
(e.g. HTTP or HTTPS) to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPort
- The port to be used when connecting to the host.aPath
- The path on the host to which the base destination URL is to point to.aFragment
- The fragment to be set.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.
-
UrlImpl
public UrlImpl(java.lang.String aProtocol, java.lang.String aHost)
Constructs anUrl
with the common attributes.- Parameters:
aProtocol
- The protocolString
(e.g. "http://" or "https://") to be used for the destination URL.aHost
- The host to which the destination URL is to point to.
-
UrlImpl
public UrlImpl(java.lang.String aProtocol, java.lang.String aHost, int aPort)
Constructs anUrl
with the common attributes.- Parameters:
aProtocol
- The protocolString
(e.g. "http://" or "https://") to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPort
- The port to be used when connecting to the host.
-
UrlImpl
public UrlImpl(java.lang.String aProtocol, java.lang.String aHost, int aPort, java.lang.String aPath)
Constructs anUrl
with the common attributes.- Parameters:
aProtocol
- The protocolString
(e.g. "http://" or "https://") to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPort
- The port to be used when connecting to the host.aPath
- The path on the host to which the base destination URL is to point to.
-
UrlImpl
public UrlImpl(java.lang.String aProtocol, java.lang.String aHost, int aPort, java.lang.String aPath, FormFields aQueryFields)
Constructs anUrl
with the common attributes.- Parameters:
aProtocol
- The protocolString
(e.g. "http://" or "https://") to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPort
- The port to be used when connecting to the host.aPath
- The path on the host to which the base destination URL is to point to.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.
-
UrlImpl
public UrlImpl(java.lang.String aProtocol, java.lang.String aHost, int aPort, java.lang.String aPath, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl
with the common attributes.- Parameters:
aProtocol
- The protocolString
(e.g. "http://" or "https://") to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPort
- The port to be used when connecting to the host.aPath
- The path on the host to which the base destination URL is to point to.aFragment
- The fragment to be set.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.
-
UrlImpl
public UrlImpl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, java.lang.String aPath)
Constructs anUrl
with the common attributes.- Parameters:
aScheme
- TheScheme
(e.g. HTTP or HTTPS) to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPath
- The path on the host to which the base destination URL is to point to.
-
UrlImpl
public UrlImpl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, java.lang.String aPath, FormFields aQueryFields)
Constructs anUrl
with the common attributes.- Parameters:
aScheme
- TheScheme
(e.g. HTTP or HTTPS) to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPath
- The path on the host to which the base destination URL is to point to.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.
-
UrlImpl
public UrlImpl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, java.lang.String aPath, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl
with the common attributes.- Parameters:
aScheme
- TheScheme
(e.g. HTTP or HTTPS) to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPath
- The path on the host to which the base destination URL is to point to.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.aFragment
- The fragment to be set.
-
UrlImpl
public UrlImpl(java.lang.String aProtocol, java.lang.String aHost, java.lang.String aPath)
Constructs anUrl
with the common attributes.- Parameters:
aProtocol
- The protocolString
(e.g. "http://" or "https://") to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPath
- The path on the host to which the base destination URL is to point to.
-
UrlImpl
public UrlImpl(java.lang.String aProtocol, java.lang.String aHost, java.lang.String aPath, FormFields aQueryFields)
Constructs anUrl
with the common attributes.- Parameters:
aProtocol
- The protocolString
(e.g. "http://" or "https://") to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPath
- The path on the host to which the base destination URL is to point to.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.
-
UrlImpl
public UrlImpl(java.lang.String aProtocol, java.lang.String aHost, java.lang.String aPath, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl
with the common attributes.- Parameters:
aProtocol
- The protocolString
(e.g. "http://" or "https://") to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPath
- The path on the host to which the base destination URL is to point to.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.aFragment
- The fragment to be set.
-
UrlImpl
public UrlImpl(Url aUrl, java.lang.String... aPaths)
-
-
Method Detail
-
getScheme
public org.refcodes.data.Scheme getScheme()
Retrieves the UrlScheme from the URL scheme.- Specified by:
getScheme
in interfaceSchemeAccessor
- Returns:
- The UrlScheme stored by the URL scheme.
-
toProtocol
public java.lang.String toProtocol()
Retrieves the protocol representation from theScheme
. In case of a scheme unknown by theScheme
enumeration, thenSchemeAccessor.getScheme()
might return null whilstSchemeAccessor.toProtocol()
still retrieves the unknown scheme's protocol representation (as ofSchemeAccessor.SchemeMutator.setProtocol(String)
).- Specified by:
toProtocol
in interfaceSchemeAccessor
- Returns:
- The protocol representation for the URL.
-
getHost
public java.lang.String getHost()
Retrieves the host from the host property.- Specified by:
getHost
in interfaceHostAccessor
- Returns:
- The host stored by the host property.
-
getIpAddress
public int[] getIpAddress()
Retrieves the IP-Address from the IP-Address property.- Specified by:
getIpAddress
in interfaceIpAddressAccessor
- Returns:
- The IP-Address stored by the IP-Address property.
-
getPort
public int getPort()
- Specified by:
getPort
in interfaceorg.refcodes.mixin.PortAccessor
-
getPath
public java.lang.String getPath()
- Specified by:
getPath
in interfaceorg.refcodes.mixin.PathAccessor
-
getQueryFields
public FormFields getQueryFields()
Retrieves the request Query-Fields from the request Query-Fields property.- Specified by:
getQueryFields
in interfaceQueryFieldsAccessor
- Returns:
- The request Query-Fields stored by the request Query-Fields property.
-
getFragment
public java.lang.String getFragment()
Retrieves the fragment from the fragment property.- Specified by:
getFragment
in interfaceFragmentAccessor
- Returns:
- The fragment stored by the fragment property.
-
getIdentity
public java.lang.String getIdentity()
- Specified by:
getIdentity
in interfaceorg.refcodes.mixin.IdentityAccessor
-
getSecret
public java.lang.String getSecret()
- Specified by:
getSecret
in interfaceorg.refcodes.mixin.SecretAccessor
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-