Search code examples
javagetglassfish-4payload

Glassfish 4 returns 400 Bad Request for GET with payload


The application I am working on has a Rest web service that expects a GET request with a payload. I know it's not the way to go but for backward compatibility we have to keep it at least for a while longer. This was working fine in Glassfish 3 but now we want to upgrade to Glassfish 4 and here it returns a 400 Bad Request. Looking around in the Glassfish 4 source code I found this flag:

// flag, which enables/disables payload support for HTTP methods, // for which HTTP spec doesn't clearly state whether they support payload. // Known "undefined" methods are: GET, HEAD, DELETE org.glassfish.grizzly.http.HttpServerFilter#allowPayloadForUndefinedHttpMethods

By default this is false and this is why the 400 response is returned. This flag seems to only be populated in the bellow method based on the server config:

org.glassfish.grizzly.http.server.HttpServer#configureListener {   
....
httpServerCodecFilter.setAllowPayloadForUndefinedHttpMethods(
                serverConfig.isAllowPayloadForUndefinedHttpMethods());
....
}

The serverConfig here is a final attribute that has a public getter but that didn't get me anywhere.

After all this my question is: Is there any way of setting that flag to true either programmatically (i doubt it) or from the admin GUI? Is there any other way of getting this to work in Glassfish 4?

Thanks


Solution

  • there was an issue for that king of behaviour whole description you can see here fix has been aplied for glassfish 4.1.1. Developers have added new attribute for element http in the server configuration.