Class representing hypermedia links. A hypermedia link may include additional
parameters beyond its underlying URI. Parameters such as rel or type
provide additional meta-data. Links in responses can be javax.ws.rs.client.Invocation.Builder or a
javax.ws.rs.client.WebTarget.
The methods toString and valueOf can be used to serialize
and de-serialize a link into a link header (RFC 5988).
javax.ws.rs.client.Client#invocation, javax.ws.rs.client.Client#target(javax.ws.rs.core.Link), javax.ws.rs.core.Response#getLink(java.lang.String)
| Modifier and Type | Class and Description |
|---|---|
| public static interface | Link.Builder
Builder class for hypermedia links. |
| public static class | Link.JaxbAdapter
An implementation of JAXB |
| public static class | Link.JaxbLink
Value type for |
| Modifier and Type | Field and Description |
|---|---|
| public static final String | REL
Rel link param from RFC 5988. |
| public static final String | TITLE
Title link param from RFC 5988. |
| public static final String | TYPE
Type link param from RFC 5988. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static Link. | |
| public static Link. | Returns: the updated Link.Builder.the resource containing the method. resource, String the name of the method whose method)javax.ws.rs.Path value will be used
to obtain the path to append.Convenience method to build a link from a resource. |
| public static Link. | |
| public static Link. | Returns: a newlink builder instance.a root resource whose resource)javax.ws.rs.Path value will be used
to initialize the builder.Convenience method to build a link from a resource. |
| public static Link. | |
| public static Link. | |
| public static Link. | Returns: a new builder.instance of URI builder. uriBuilder)Create a new builder instance initialized from a URI builder. |
| public abstract Map | Returns: immutable map of link parameters.Returns an immutable map that includes all the link parameters defined on this link. |
| public abstract String | Returns: relation types as string ornull.Returns the value associated with the link |
| public abstract List | Returns: relation types as list of strings or empty list.Returns the value associated with the link |
| public abstract String | Returns: value of title parameter ornull.Returns the value associated with the link |
| public abstract String | Returns: value of type parameter ornull.Returns the value associated with the link |
| public abstract URI | |
| public abstract UriBuilder | Returns: UriBuilder initialized using underlying URI.Convenience method that returns a |
| public abstract String | Returns: string link header representation for this link.Overrides java. |
| public static Link |
| REL | back to summary |
|---|---|
| public static final String REL Rel link param from RFC 5988. | |
| TITLE | back to summary |
|---|---|
| public static final String TITLE Title link param from RFC 5988. | |
| TYPE | back to summary |
|---|---|
| public static final String TYPE Type link param from RFC 5988. | |
| Link | back to summary |
|---|---|
| public Link() | |
| fromLink | back to summary |
|---|---|
| public static Link. Create a new builder instance initialized from another link. | |
| fromMethod | back to summary |
|---|---|
| public static Link. Convenience method to build a link from a resource. Equivalent to
Link.fromUriBuilder(
| |
| fromPath | back to summary |
|---|---|
| public static Link. Convenience method to build a link from a path. Equivalent to
| |
| fromResource | back to summary |
|---|---|
| public static Link. Convenience method to build a link from a resource. Equivalent to
Link.fromUriBuilder(
| |
| fromUri | back to summary |
|---|---|
| public static Link. Create a new builder instance initialized from an existing URI.
| |
| fromUri | back to summary |
|---|---|
| public static Link. Create a new builder instance initialized from an existing URI represented as a string.
| |
| fromUriBuilder | back to summary |
|---|---|
| public static Link. Create a new builder instance initialized from a URI builder.
| |
| getParams | back to summary |
|---|---|
| public abstract Map Returns an immutable map that includes all the link parameters
defined on this link. If defined, this map will include entries
for | |
| getRel | back to summary |
|---|---|
| public abstract String getRel() Returns the value associated with the link
| |
| getRels | back to summary |
|---|---|
| public abstract List Returns the value associated with the link | |
| getTitle | back to summary |
|---|---|
| public abstract String getTitle() Returns the value associated with the link
| |
| getType | back to summary |
|---|---|
| public abstract String getType() Returns the value associated with the link
| |
| getUri | back to summary |
|---|---|
| public abstract URI getUri() Returns the underlying URI associated with this link.
| |
| getUriBuilder | back to summary |
|---|---|
| public abstract UriBuilder getUriBuilder() Convenience method that returns a
| |
| toString | back to summary |
|---|---|
| public abstract String toString() Overrides java. Returns a string representation as a link header (RFC 5988).
All link params are serialized as link-param="value" where value
is a quoted-string. For example,
| |
| valueOf | back to summary |
|---|---|
| public static Link valueOf(String value) Simple parser to convert link header string representations into a link.
link ::= '<' uri '>' (';' link-param)*
link-param ::= name '=' quoted-string
See RFC 5988 for more information.
| |
Link
| Modifier and Type | Method and Description |
|---|---|
| public Link. | |
| public Link. | |
| public Link | |
| public Link | Returns: newly built link.URI used for relativization. uri, Object... parameters used to build underlying URI. values)Finish building this link using the supplied values as URI parameters and relativize the result with respect to the supplied URI. |
| public Link. | |
| public Link. | |
| public Link. | |
| public Link. | |
| public Link. | |
| public Link. | |
| public Link. | |
| public Link. | |
| public Link. | Returns: the updated builder.underlying URI builder. uriBuilder)Set underlying URI builder representing the URI template for the link being constructed. |
| baseUri | back to summary |
|---|---|
| public Link. Set the base URI for resolution of relative URIs. If the underlying URI is already absolute, the base URI is ignored.
| |
| baseUri | back to summary |
|---|---|
| public Link. Set the base URI as a string for resolution of relative URIs. If the underlying URI is already absolute, the base URI is ignored.
| |
| build | back to summary |
|---|---|
| public Link build(Object... values) Finish building this link using the supplied values as URI parameters. The state of the builder is unaffected; this method may be called multiple times on the same builder instance.
| |
| buildRelativized | back to summary |
|---|---|
| public Link buildRelativized(URI uri, Object... values) Finish building this link using the supplied values as URI parameters
and relativize the result with respect to the supplied URI.
If the underlying link is already relative or if it is absolute but does
not share a prefix with the supplied URI, this method is equivalent to calling
| |
| link | back to summary |
|---|---|
| public Link. Initialize builder using another link. Sets underlying URI and copies all parameters. | |
| link | back to summary |
|---|---|
| public Link. Initialize builder using another link represented as a string. Uses simple parser to convert string representation into a link.
link ::= '<' uri '>' (';' link-param)*
link-param ::= name '=' quoted-string
See RFC 5988 for more information.
| |
| param | back to summary |
|---|---|
| public Link. Set an arbitrary parameter on this link. Note that link parameters are those
defined in RFC 5988 and should not be confused with URI parameters which can
be specified when calling
| |
| rel | back to summary |
|---|---|
| public Link. Convenience method to set a link relation. More than one
| |
| title | back to summary |
|---|---|
| public Link. Convenience method to set a
| |
| type | back to summary |
|---|---|
| public Link. Convenience method to set a
| |
| uri | back to summary |
|---|---|
| public Link. Set underlying URI template for the link being constructed. | |
| uri | back to summary |
|---|---|
| public Link. Set underlying string representing URI template for the link being constructed.
| |
| uriBuilder | back to summary |
|---|---|
| public Link. Set underlying URI builder representing the URI template for the link being constructed.
| |
javax.xml.bind.annotation.adapters.XmlAdapter
that maps the JAX-RS javax.ws.rs.core.Link type to a value that can be
marshalled and unmarshalled by JAXB. The following example shows how to use
this adapter on a JAXB bean class:
@XmlRootElement
public class MyModel {
private Link link;
@XmlElement(name="link")
@XmlJavaTypeAdapter(JaxbAdapter.class)
public Link getLink() {
return link;
}
...
}
javax.ws.rs.core.Link.JaxbLink
| Access | Constructor and Description |
|---|---|
| public |
| JaxbAdapter | back to summary |
|---|---|
| public JaxbAdapter() | |
| marshal | back to summary |
|---|---|
| public Link. Implements abstract javax. | |
| unmarshal | back to summary |
|---|---|
| public Link unmarshal(Link. Implements abstract javax. | |
javax.ws.rs.core.Link that can be marshalled and
unmarshalled by JAXB.
javax.ws.rs.core.Link.JaxbAdapter
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. |
| public Map | |
| public URI | |
| public int | |
| pack-priv void | |
| pack-priv void |
| params | back to summary |
|---|---|
| private Map<QName, Object> params | |
| uri | back to summary |
|---|---|
| private URI uri | |
| JaxbLink | back to summary |
|---|---|
| public JaxbLink() Default constructor needed during unmarshalling. | |
| JaxbLink | back to summary |
|---|---|
| public JaxbLink(URI uri) Construct an instance from a URI and no parameters.
| |
| JaxbLink | back to summary |
|---|---|
| public JaxbLink(URI uri, Map<QName, Object> params) Construct an instance from a URI and some parameters. | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getParams | back to summary |
|---|---|
| public Map Get the parameter map for this link. | |
| getUri | back to summary |
|---|---|
| public URI getUri() Get the underlying URI for this link.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| setParams | back to summary |
|---|---|
| pack-priv void setParams(Map<QName, Object> params) Set the parameter map for this link. This setter is needed for JAXB unmarshalling. | |
| setUri | back to summary |
|---|---|
| pack-priv void setUri(URI uri) Set the underlying URI for this link. This setter is needed for JAXB unmarshalling. | |