Package org.refcodes.net
Interface Url
-
- All Superinterfaces:
org.refcodes.mixin.CredentialsAccessor
,org.refcodes.mixin.Dumpable
,FragmentAccessor
,HostAccessor
,org.refcodes.mixin.IdentityAccessor
,IpAddressAccessor
,org.refcodes.mixin.PathAccessor
,org.refcodes.mixin.PortAccessor
,QueryFieldsAccessor
,SchemeAccessor
,org.refcodes.mixin.SecretAccessor
- All Known Subinterfaces:
Url.UrlBuilder
- All Known Implementing Classes:
UrlBuilderImpl
,UrlImpl
public interface Url extends org.refcodes.mixin.Dumpable, SchemeAccessor, HostAccessor, IpAddressAccessor, org.refcodes.mixin.PortAccessor, org.refcodes.mixin.PathAccessor, QueryFieldsAccessor, FragmentAccessor, org.refcodes.mixin.CredentialsAccessor
An URL looks something like this: "scheme://[identity[:secret]@]host[:port][/path][?query][#fragment] In contrast to thejava.net
URL
, this URL also supports "relative" locators with neither a scheme nor a host declaration. If the relative locator starts with a "/" slash, then we assume not having a host being provided: "/path?query#fragment" When it does *not* start with a "/" slash, then we assume that the first element being the host: "[identity[:secret]@]host[:port]/path[?query][#fragment]"
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Url.UrlBuilder
-
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
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default java.lang.String
toHost()
Returns the "host" depending on whether an IP-Address has been provided or a host name.default java.lang.String
toHttpUrl()
Creates the complete "HTTP" URLString
from theUrl
instance's state.default java.lang.String
toLocator()
Creates the locator part from theUrl
instance's state, excluding the fragment or the query fields.default java.net.URL
toURL()
Constructs anURL
instance from yourUrl
's state.-
Methods inherited from interface org.refcodes.net.FragmentAccessor
getFragment
-
Methods inherited from interface org.refcodes.net.HostAccessor
getHost
-
Methods inherited from interface org.refcodes.net.IpAddressAccessor
getIpAddress, toCidrNotation
-
Methods inherited from interface org.refcodes.net.QueryFieldsAccessor
getQueryFields
-
Methods inherited from interface org.refcodes.net.SchemeAccessor
getScheme, toProtocol
-
-
-
-
Method Detail
-
toHost
default java.lang.String toHost()
Returns the "host" depending on whether an IP-Address has been provided or a host name.- Returns:
- The determined host.
-
toHttpUrl
default java.lang.String toHttpUrl()
Creates the complete "HTTP" URLString
from theUrl
instance's state.- Returns:
- The URL
String
for the givenUrl
.
-
toLocator
default java.lang.String toLocator()
Creates the locator part from theUrl
instance's state, excluding the fragment or the query fields.- Returns:
- The locator for the given
Url
.
-
toURL
default java.net.URL toURL() throws java.net.MalformedURLException
Constructs anURL
instance from yourUrl
's state.- Returns:
- The according
URL
instance. - Throws:
java.net.MalformedURLException
- thrown in case the state of yourUrl
instance cannot be used to construct a validURL
, you may be missing some properties.
-
-