Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xenit-eu/java-hal-client

Hateoas and Hal client for Java
https://github.com/xenit-eu/java-hal-client

Last synced: 6 days ago
JSON representation

Hateoas and Hal client for Java

Awesome Lists containing this project

README

        

# ContentGrid HAL Forms Client

## Context

This is a minimal HAL and HAL-FORMS client, to be used with integration tests.

## Usage

```
var halFormsClient = HalFormsClient.builder().restClient(restClient).build();

var orgs = halFormsClient.follow(HalLink.from(URI.create("http://api.contentgrid.test/orgs")));
var myOrg = halFormsClient.requestDefaultTemplate(orgs)
.properties(Map.of("display_name", "test"))
.execute().toHalDocument();

var projects = halFormsClient.follow(myOrg.getRequiredLink("projects"));
var testProject = halFormsClient.requestDefaultTemplate(projects)
.properties(Map.of("name", "test"))
.execute().toHalDocument();

```

## Possible improvements

* [ ] More explicit support for OAuth2 clients
* [ ] Use Spring HATEOAS concepts: `RepresentationModel`
* [ ] Use Spring HATEOAS / Traverson concepts: `LinkRelation`, `LinkDiscoverer`, ...
* [ ] Base internals on `RestOperations` to improve testability, potentially using `RestOperationsAdapter`
* [ ] Add support to automatically follow redirects (HTTP 302)
* [ ] Let `DefaultHalFormsClient` extend `DefaultHalClient` to avoid duplication (possibly via ServiceLoader)