TypedRest for Java
|
Base class for building REST RPC-like endpoints. More...
Public Member Functions | |
void | probe () throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException |
Queries the server about capabilities of the endpoint without performing any action. More... | |
Optional< Boolean > | isTriggerAllowed () |
Shows whether the server has indicated that the trigger method is currently allowed. More... | |
![]() | |
final void | setDefaultLink (String rel, String... hrefs) |
Registers one or more default links for a specific relation type. More... | |
final void | setDefaultLinkTemplate (String rel, String href) |
Registers a default link template for a specific relation type. More... | |
Set< URI > | getLinks (String rel) |
Retrieves all links with a specific relation type cached from the last request. More... | |
Map< URI, String > | getLinksWithTitles (String rel) |
Retrieves all links (with titles) with a specific relation type cached from the last request. More... | |
URI | link (String rel) |
Retrieves a single link with a specific relation type. More... | |
UriTemplate | linkTemplate (String rel) |
Retrieves a link template with a specific relation type. More... | |
String | toString () |
![]() | |
URI | getUri () |
The HTTP URI of the remote resource. More... | |
Executor | getExecutor () |
The REST executor used to communicate with the remote resource. More... | |
ObjectMapper | getSerializer () |
Controls the serialization of entities sent to and received from the server. More... | |
default URI | linkTemplate (String rel, String variableName, Object value) |
Retrieves a link template with a specific relation type and resolves it. More... | |
Protected Member Functions | |
AbstractTriggerEndpoint (Endpoint referrer, URI relativeUri) | |
AbstractTriggerEndpoint (Endpoint referrer, String relativeUri) | |
![]() | |
AbstractEndpoint (URI uri, Executor executor, ObjectMapper serializer) | |
Creates a new REST endpoint with an absolute URI. More... | |
AbstractEndpoint (Endpoint referrer, URI relativeUri) | |
Creates a new REST endpoint with a relative URI. More... | |
AbstractEndpoint (Endpoint referrer, String relativeUri) | |
Creates a new REST endpoint with a relative URI. More... | |
HttpResponse | executeAndHandle (Request request) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Executes a REST request and wraps HTTP status codes in appropriate Exception types. More... | |
HttpResponse | execute (Request request) throws IOException |
Executes a REST request adding any configured defaultHeaders. More... | |
void | handleResponse (HttpResponse response, Request request) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Handles the response of a REST request and wraps HTTP status codes in appropriate Exception types. More... | |
void | handleErrors (HttpResponse response, Request request) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Wraps HTTP status codes in appropriate Exception types. More... | |
void | handleHeaderLinks (HttpResponse response, Map< String, Map< URI, String >> links, Map< String, String > linkTemplates) |
Handles links embedded in HTTP response headers. More... | |
void | handleBodyLinks (JsonNode jsonBody, Map< String, Map< URI, String >> links, Map< String, String > linkTemplates) |
Handles links embedded in JSON response bodies. More... | |
void | handleCapabilities (HttpResponse response) |
Handles allowed HTTP methods and other capabilities reported by the server. More... | |
Optional< Boolean > | isMethodAllowed (String method) |
Shows whether the server has indicated that a specific HTTP method is currently allowed. More... | |
Additional Inherited Members | |
![]() | |
final URI | uri |
final Executor | executor |
final ObjectMapper | serializer |
final Collection< Header > | defaultHeaders = new LinkedList<>() |
A set of default HTTP headers to be added to each request. | |
Base class for building REST RPC-like endpoints.
Optional<Boolean> net.typedrest.AbstractTriggerEndpoint.isTriggerAllowed | ( | ) |
Shows whether the server has indicated that the trigger method is currently allowed.
Uses cached data from last response.
Implements net.typedrest.TriggerEndpoint.
void net.typedrest.AbstractTriggerEndpoint.probe | ( | ) | throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException |
Queries the server about capabilities of the endpoint without performing any action.
IOException | Network communication failed. |
IllegalArgumentException | HttpStatus#SC_BAD_REQUEST |
IllegalAccessException | HttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN |
FileNotFoundException | HttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE |
IllegalStateException | HttpStatus#SC_CONFLICT |
RuntimeException | Other non-success status code. |
Implements net.typedrest.TriggerEndpoint.