restlet-framework-java icon indicating copy to clipboard operation
restlet-framework-java copied to clipboard

Resource returns an Incorrect content type in Java 9

Open adolski opened this issue 8 years ago • 3 comments

I have a resource subclass that provides HTML and JSON representations using @Get("html") and @Get("json") annotations. In Java 8, the correct representation is returned based on the value of the Accept header. In Java 9, the Accept header is not respected and HTML is always returned.

I've assembled a minimal Restlet 2.3.10 JSE application to demo this: https://github.com/adolski/restlet-jdk9-issue

adolski avatar Sep 20 '17 20:09 adolski

Hi @adolski I see that the value of this annotation @Get("json") is "json" using JDK9 and not json...

Issue is located on class AnnotationUtils, at line 139

thboileau avatar Oct 20 '17 16:10 thboileau

I'm having exactly the same issue. In a subclass of org.restlet.resource.ServerResource I have two methods taking care of two different content types, @Get("html") and @Get("json") respectively. On Java 8 everything works fine, but with Java 10 the content negotiation through annotations stopped working.

I'm using Restlet 2.3.12, is there any branch or new release where this has been fixed?

ebner avatar Oct 23 '18 13:10 ebner

I'm using Restlet 2.3.12, is there any branch or new release where this has been fixed?

I just found out that 2.4.1 contains the fix. On the web site 2.3.12 is as of today still listed as the latest stable release.

ebner avatar Oct 23 '18 14:10 ebner