hateoas

How to configure Spring HATEOAS behind proxy?

亡梦爱人 提交于 2019-11-27 23:06:48
I have Spring Data Rest with Hateoas as my backed. It is behind a proxy. Backend url: backend.com Proxy url: proxy.com When I query proxy url, e.g. http://proxy.com/items/1 , I get a response with href links with domain backend.com . I need the domain to be proxy.com . As of Spring-Boot 2.1 / Spring 5.1, Spring shifts the responsibility of handling X-Forwarded-* from Spring HATEOAS to Spring MVC. https://jira.spring.io/browse/SPR-16668 You now require the registration of a filter bean. Minimal implementation: @Bean FilterRegistrationBean<ForwardedHeaderFilter> forwardedHeaderFilter() {

How to create a custom media type (application/vnd) for a RESTful web service?

梦想与她 提交于 2019-11-27 18:08:57
I'm playing with REST right now and thought I properly implement HATEOAS just to get all concepts right. For that I want to create my own media types ( application/vnd[...]+xml and application/vnd[...]+json ). One first question: Does the media type define the contract between my server and client? The media type will define my message formats so I need to add XML schema and JSON schema to go with the new media types (so that REST clients know what's coming in messages and what to send back). I've done some research on the web but the details of how one does this are missing. Does it only

HAL - is it a violation to the HAL format/standard if links are in the main body?

白昼怎懂夜的黑 提交于 2019-11-27 15:58:09
According to the HAL standard (see here and here ) the links to other resources should be placed in a specific embedded section. So for instance this is not valid HAL, is my understanding correct? { "movies": [ { "id": "123", "title": "Movie title 1", "_links": { "subtitles": { "href": "/movies/123/subtitles" } } },{ "id": "456", "title": "Movie title 2", "_links": { "subtitles": { "href": "/movies/456/subtitles" } } } ], "_links": { "self": { "href": "/movies" } } } The reason for which the above JSON is not valid HAL is that the links should be placed in an embedded section ( "_embedded" )

Multiple converters with Retrofit 2

非 Y 不嫁゛ 提交于 2019-11-27 11:41:43
问题 I have a HATEOAS (HAL) REST service and managed to talk to it with the code below (using halarious as a conversion engine) but when I try to merge the converters ( stallone and stallone2 ), the app will always pick up the first converter, instead of the one that is appropriate for the response type which of course leads to an error. How could I avoid duplicate retrofits that are only different in a small type detail? public interface Stallone { @GET("/discovery") Call<DiscoveryResponse>

Custom response for root request int the Spring REST HATEOAS with both RepositoryRestResource-s and regular controllers

£可爱£侵袭症+ 提交于 2019-11-27 10:10:05
问题 Let's say I have two repositories: @RepositoryRestResource(collectionResourceRel = "person", path = "person") public interface PersonRepository extends PagingAndSortingRepository<Person, Long> { List<Person> findByLastName(@Param("name") String name); } and @RepositoryRestResource(collectionResourceRel = "person1", path = "person1") public interface PersonRepository1 extends PagingAndSortingRepository<Person1, Long> { List<Person1> findByLastName(@Param("name") String name); } with one

Is That REST API Really RPC? Roy Fielding Seems to Think So

て烟熏妆下的殇ゞ 提交于 2019-11-27 10:04:23
A large amount of what I thought I knew about REST is apparently wrong - and I'm not alone. This question has a long lead-in, but it seems to be necessary because the information is a bit scattered. The actual question comes at the end if you're already familiar with this topic. From the first paragraph of Roy Fielding's REST APIs must be hypertext-driven , it's pretty clear he believes his work is being widely misinterpreted: I am getting frustrated by the number of people calling any HTTP-based interface a REST API. Today’s example is the SocialSite REST API . That is RPC. It screams RPC.

Actual examples for HATEOAS (REST-architecture) [closed]

久未见 提交于 2019-11-27 09:09:23
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . as everyone may have noticed, there are lot of fake/rudimentary REST-APIs in the wild (which implement a HTTP-API and call it REST

How to configure Spring HATEOAS behind proxy?

孤街浪徒 提交于 2019-11-26 21:19:08
问题 I have Spring Data Rest with Hateoas as my backed. It is behind a proxy. Backend url: backend.com Proxy url: proxy.com When I query proxy url, e.g. http://proxy.com/items/1 , I get a response with href links with domain backend.com . I need the domain to be proxy.com . 回答1: As of Spring-Boot 2.1 / Spring 5.1, Spring shifts the responsibility of handling X-Forwarded-* from Spring HATEOAS to Spring MVC. https://jira.spring.io/browse/SPR-16668 You now require the registration of a filter bean.

How to create a custom media type (application/vnd) for a RESTful web service?

走远了吗. 提交于 2019-11-26 19:18:53
问题 I'm playing with REST right now and thought I properly implement HATEOAS just to get all concepts right. For that I want to create my own media types ( application/vnd[...]+xml and application/vnd[...]+json ). One first question: Does the media type define the contract between my server and client? The media type will define my message formats so I need to add XML schema and JSON schema to go with the new media types (so that REST clients know what's coming in messages and what to send back).

Is That REST API Really RPC? Roy Fielding Seems to Think So

非 Y 不嫁゛ 提交于 2019-11-26 17:53:59
问题 A large amount of what I thought I knew about REST is apparently wrong - and I'm not alone. This question has a long lead-in, but it seems to be necessary because the information is a bit scattered. The actual question comes at the end if you're already familiar with this topic. From the first paragraph of Roy Fielding's REST APIs must be hypertext-driven, it's pretty clear he believes his work is being widely misinterpreted: I am getting frustrated by the number of people calling any HTTP