Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
oauth2-0.31
-
None
-
None
-
Glassfish 3.1.2
Apache Oltu from SVN trunk (0.31-SNAPSHOT, 2013-25-04)
Description
yThe POST method in the TokenEndpoint class in the integration tests package is defined as follows:
@POST
@Consumes("application/x-www-form-urlencoded")
@Produces("application/json")
public Response authorize(@Context HttpServletRequest request) throws OAuthSystemException
Now, the annotation @Consumes("application/x-www-form-urlencoded") is used to get the body of the POST parsed into the parameters of HttpServletRequest request. Sadly this does not work on Glassfish.
For similar problems see:
- http://jersey.576304.n2.nabble.com/Tomcat-Deployment-Vs-Jetty-Deployment-no-parameters-from-HttpServletRequest-td1516207.html
- http://cxf.547215.n5.nabble.com/POST-data-missing-in-Context-td4391121.html
- https://issues.apache.org/jira/browse/CXF-2993
What works is the following:
@POST
@Consumes("application/x-www-form-urlencoded")
@Produces("application/json")
public Response token(MultivaluedMap<String, String> params) throws OAuthSystemException
Apache Oltu expects a HttpServletRequest to build a OAuthTokenRequest object out of it.
To workaround the problem I made a wrapper class: https://gist.github.com/dschuermann/5509667
I propose to allow other constructors with objects working in Glassfish. One could also report the bug upstream.
Could be related: