Closed GoogleCodeExporter closed 8 years ago
Do you see the same output when using Jersey alone i.e. independent of the
grails-jaxrs plugin?
Original comment by krass...@googlemail.com
on 6 Jun 2012 at 6:37
Hello Martin.
Sorry for the delayed answer. After further investigation I've discovered that
the GrailsDispatcherServlet was the responsable for the odd behavior.
The result using Jersey alone was exactly what I was expecting (a wadl xml for
the resource and the allow header with the annotated http methods only).
I've forked the grails-jaxrs project and if everything works out fine I
politely ask you to accept my pull request.
Sample Code:
@Path('/v1/category/{id}')
class CategoryResource {
@GET
@Produces(['application/xml', 'application/json'])
Category getCategoryRepresentation(@PathParam('id') String id) {
/*
* method body
*/
}
@OPTIONS
@Produces(['text/plain'])
Response options(){
/*
* method body
*/
}
}
200 OPTIONS http://localhost:8080/api/v1/category
Response:
Headers:
Date: Fri, 08 Jun 2012 20:14:51 GMT
Transfer-Encoding: chunked
Server: Apache-Coyote/1.1
Allow: OPTIONS,GET,HEAD
Content-Type: application/vnd.sun.wadl+xml
Body:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<application xmlns="http://research.sun.com/wadl/2006/10">
<doc xmlns:jersey="http://jersey.java.net/" jersey:generatedBy="Jersey: 1.8 06/24/2011 12:17 PM"/>
<resources base="http://10.1.0.30:8080/api/">
<resource path="v1/category/">
<method name="GET" id="getCategoryListRepresentation">
<response>
<representation mediaType="application/xml"/>
<representation mediaType="application/json"/>
</response>
</method>
</resource>
</resources>
</application>
Original comment by wilso...@gmail.com
on 11 Jun 2012 at 6:44
Hi Wilson, just merged your pull request. Thanks a lot for your contribution,
highly appreciate it. Keep up the good work :)
Original comment by krass...@googlemail.com
on 12 Jun 2012 at 5:59
Original issue reported on code.google.com by
wilso...@gmail.com
on 4 Jun 2012 at 5:44