Package org.apache.juneau.http.part
Class HttpUriPart
java.lang.Object
org.apache.juneau.http.part.HttpPartBean
org.apache.juneau.http.part.HttpUriPart
- All Implemented Interfaces:
HttpPart
An
HttpPart whose value is a URI.
Mirrors the semantics of BasicUriPart from juneau-rest-common-classic without
the Apache HttpCore dependency.
- Since:
- 10.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionHttpUriPart(String name, String value) Constructor accepting a wire-format string value.HttpUriPart(String name, URI value) Constructor accepting aURIvalue.HttpUriPart(String name, Supplier<URI> supplier) Constructor accepting a lazyURIsupplier. -
Method Summary
Modifier and TypeMethodDescriptionasUri()Returns the value as anOptional<URI>.static HttpUriPartCreates anHttpUriPartwith the given name and URI value.static HttpUriPartCreates anHttpUriPartwith a lazy URI supplier.static HttpUriPartCreates anHttpUriPartby parsing the given wire value.Returns the value if present, otherwise returnsother.toUri()Returns the value as aURI, ornullif not set.
-
Constructor Details
-
HttpUriPart
Constructor accepting a wire-format string value.- Parameters:
name- The part name. Must not benull .value- The wire value. May benull or empty.
-
HttpUriPart
Constructor accepting aURIvalue.- Parameters:
name- The part name. Must not benull .value- The URI value. May benull .
-
HttpUriPart
Constructor accepting a lazyURIsupplier.- Parameters:
name- The part name. Must not benull .supplier- Supplier for the URI value. Must not benull .
-
-
Method Details
-
of
Creates anHttpUriPartwith the given name and URI value.- Parameters:
name- The part name. Must not benull .value- The URI value. May benull .- Returns:
- A new instance. Never
null .
-
ofString
Creates anHttpUriPartby parsing the given wire value.- Parameters:
name- The part name. Must not benull .value- The wire value. May benull or empty.- Returns:
- A new instance. Never
null .
-
ofLazy
Creates anHttpUriPartwith a lazy URI supplier.- Parameters:
name- The part name. Must not benull .supplier- Supplier for the URI value. Must not benull .- Returns:
- A new instance. Never
null .
-
asUri
Returns the value as anOptional<URI>.- Returns:
- The URI value, wrapped in an
Optional. Nevernull .
-
orElse
Returns the value if present, otherwise returnsother.- Parameters:
other- The default value.- Returns:
- The value or
other.
-
toUri
Returns the value as aURI, ornullif not set.- Returns:
- The URI value, possibly
null.
-