|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.ws.rs.core.Link
public final class Link
Class representing hypermedia links. A hypermedia link may include additional
parameters beyond its underlying URI. Parameters such as "rel" or "method"
provide additional meta-data and can be used to easily create instances of
Invocation in order to follow links.
The methods toString() and valueOf(java.lang.String) can be used to serialize
and deserialize a link into a link header (RFC 5988).
Client.invocation(javax.ws.rs.core.Link)| Nested Class Summary | |
|---|---|
static class |
Link.Builder
Builder class for hypermedia links. |
static class |
Link.JaxbAdapter
An implementation of JAXB XmlAdapter
that maps the JAX-RS Link type to a value that can be
marshalled and unmarshalled by JAXB. |
static class |
Link.JaxbLink
Value type for Link that can be marshalled and
unmarshalled by JAXB. |
| Field Summary | |
|---|---|
static String |
CONSUMES
|
static String |
METHOD
|
static String |
PRODUCES
|
static String |
REL
|
static String |
TITLE
|
static String |
TYPE
|
| Constructor Summary | |
|---|---|
Link()
|
|
| Method Summary | |
|---|---|
boolean |
equals(Object other)
Equality test for links. |
static Link.Builder |
fromLink(Link link)
Create a new instance initialized from another link. |
static Link.Builder |
fromResourceMethod(Class<?> resource,
String method)
Generate a link by introspecting a resource method. |
static Link.Builder |
fromResourceMethod(Class<?> resource,
String method,
String rel)
Generate a link by introspecting a resource method. |
static Link.Builder |
fromUri(String uri)
Create a new instance initialized from an existing URI. |
static Link.Builder |
fromUri(URI uri)
Create a new instance initialized from an existing URI. |
List<String> |
getConsumes()
Returns an immutable list containing all the types defined on this link via the "consumes" parameter. |
String |
getMethod()
Returns the value associated with the link "method" param, or null if this param is not specified. |
MultivaluedMap<String,String> |
getParams()
Returns an immutable map that includes all the link parameters defined on this link. |
List<String> |
getProduces()
Returns an immutable list containing all the types defined on this link via the "produces" parameter. |
List<String> |
getRel()
Returns an immutable list containing all the relation types defined on this link via the "rel" parameter. |
String |
getTitle()
Returns the value associated with the link "title" param, or null if this param is not specified. |
String |
getType()
Returns the value associated with the link "type" param, or null if this param is not specified. |
URI |
getUri()
Returns the underlying URI associated with this link. |
UriBuilder |
getUriBuilder()
Convenience method that returns a UriBuilder
initialized with this link's underlying URI. |
int |
hashCode()
Hash code computation for links. |
String |
toString()
Returns a string representation as a link header (RFC 5988). |
static Link |
valueOf(String value)
Simple parser to convert link header string representations into a link. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String CONSUMES
public static final String METHOD
public static final String PRODUCES
public static final String TITLE
public static final String REL
public static final String TYPE
| Constructor Detail |
|---|
public Link()
| Method Detail |
|---|
public URI getUri()
public UriBuilder getUriBuilder()
UriBuilder
initialized with this link's underlying URI.
public List<String> getRel()
public String getTitle()
public String getType()
public String getMethod()
public List<String> getProduces()
public List<String> getConsumes()
public MultivaluedMap<String,String> getParams()
public boolean equals(Object other)
equals in class Objectother - Object to compare against
public int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
public static Link valueOf(String value)
throws IllegalArgumentException
value - String representation
IllegalArgumentException - if a syntax error is found
public static Link.Builder fromUri(URI uri)
throws IllegalArgumentException
uri - a URI that will be used to initialize the Builder.
IllegalArgumentException - if uri is null
public static Link.Builder fromUri(String uri)
throws IllegalArgumentException
uri - a URI that will be used to initialize the Builder.
IllegalArgumentException - if uri is nullpublic static Link.Builder fromLink(Link link)
link - other link used for initialization
public static Link.Builder fromResourceMethod(Class<?> resource,
String method)
throws IllegalArgumentException
fromResourceMethod(resource, method, method).
resource - resource classmethod - name of resource method
IllegalArgumentException - if any argument is null or no method is foundfromResourceMethod(java.lang.Class, java.lang.String, java.lang.String)
public static Link.Builder fromResourceMethod(Class<?> resource,
String method,
String rel)
throws IllegalArgumentException
MediaType.WILDCARD is used. Likewise, if "consumes"
is not defined, MediaType.WILDCARD is used but
only when the HTTP method is POST or PUT. The value of "rel" must be specified
as an argument.
resource - resource classmethod - name of resource methodrel - value of "rel" parameter
IllegalArgumentException - if any argument is null or no method is found
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||