Spring-boot: Hal Browser issue since Spring-boot 1.4.0.RELEASE

Created on 5 Aug 2016  路  6Comments  路  Source: spring-projects/spring-boot

Since upgrading services to spring-boot 1.4, when heading to the root of the service (localhost:8080/), the HAL-browser does not show links to our apis. The Inspector shows that the Response Headers is text/html (in 1.3.7, it was application/hal+json) and the body seems to content the html page itself instead of hal json document.

It can be reproduce with a project generated from spring initializr with the following specificities :

  • gradle project
  • spring boot 1.4.0
  • dependencies on Rest Repositories & Rest Repositories HAL Browser

Here is the dependencies section from the build.gradle file:

dependencies {
    compile('org.springframework.boot:spring-boot-starter-data-rest')
    compile('org.springframework.data:spring-data-rest-hal-browser')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

Looking at other issues in the issues db, I think this might be related to #6562

regards,

-S茅bastien

bug

Most helpful comment

The issue has already been reported and fixed in DATAREST-863. The snapshots should already work as expected again.

There actually is a test case for that functionality but Hopper still builds on Spring 4.2 and we haven't had integration tests against 4.3 set up. About to fix that, too. We're going to make sure, Hopper SR3 will be released in time for Boot 1.4.1.

All 6 comments

There's a behaviour change in Spring Data REST.

Its DelegatingHandlerMapping has two delegates. In Spring Boot 1.3.7 (Spring Data Gosling) the first delegate throws an HttpMediaTypeNotAcceptableException giving the second delegate (RepositoryRestHandlerMapping) a chance to return a HandlerExecutionChain that returns the desired application/hal+json response. In Spring Boot 1.4 (Spring Data Hopper), the first delegate returns a HandlerExecutionChain for HAL browser's text/html.

The problem is that CustomAcceptHeaderHttpServletRequest doesn't override all header-related methods. Spring Framework 4.2.x called getHeader which is overridden but Spring Framework 4.3.2 calls getHeaderValues which is not overridden.

I've opened #6583 to upgrade to Spring Data Hopper SR3 which I'm hoping will provide a fix for DATAREST-870. I'm going to keep this issue open as the problem probably should have been caught by an integration test for the HAL browser support.

The issue has already been reported and fixed in DATAREST-863. The snapshots should already work as expected again.

There actually is a test case for that functionality but Hopper still builds on Spring 4.2 and we haven't had integration tests against 4.3 set up. About to fix that, too. We're going to make sure, Hopper SR3 will be released in time for Boot 1.4.1.

@olivergierke has the testing side of this covered so I'm going to close this one in favour of #6583.

Was this page helpful?
0 / 5 - 0 ratings