Closed GoogleCodeExporter closed 8 years ago
Completely agree that this is the right approach. Are you interested in fixing
that yourself and send a pull request via github? This could be faster than
waiting for me to do it. WDYT?
Original comment by krass...@googlemail.com
on 10 Mar 2011 at 12:54
roger, will do ;)
Original comment by bernardo...@gmail.com
on 10 Mar 2011 at 7:30
Awesome! Appreciate it!
Original comment by krass...@googlemail.com
on 11 Mar 2011 at 7:14
I worked on this while upgrading the libraries but found collisions within the
Restlet and Jersey projects at the JAXRs specification. Probably it might be
better to roll out a Restlet plugin on its own.
You can find the changes at
Fork at
https://github.com/berngp/grails-jaxrs
commit:
https://github.com/berngp/grails-jaxrs/commit/591f12f7ea17aeef53076bb6b5a5e112f0
d2728b
Until further discussion I am not sending a pull request.
Cheers
Bernardo
Original comment by bernardo...@gmail.com
on 20 Mar 2011 at 6:36
Hi Bernardo,
thanks a lot! Works fine for on the Jersey side.
What collisions are you referring to? The failing
RestletControllerIntegrationTests?
Cheers,
Martin
Original comment by krass...@googlemail.com
on 20 Mar 2011 at 8:07
Hi Martin,
If for example I let the BuldConfig.groovy be
compile('asm:asm:3.3',
* **'com.sun.jersey:jersey-core:1.5'*,
'com.sun.jersey:jersey-server:1.5',
'com.sun.jersey.contribs:jersey-spring:1.5',
'javax.ws.rs:jsr311-api:1.1',
'org.restlet.jse:org.restlet:2.0.5',
*'org.restlet.jee:org.restlet.ext.jaxrs:2.0.5' */** Collision
with jersey-core's jaxrs classes */,
'org.restlet.jee:org.restlet.ext.servlet:2.0.5',
'org.restlet.jee:org.restlet.ext.json:2.0.5'
)
And run the tests I will end up with a JAXRS collision since Jersey's
implementation differs form the one used by Restlets and the *Runtime JAXRS*
*Implementation* is loaded.. well.. at runtime. The following error is
the stack-trace that is generated when Jersey loads a JAXRs implementation
but finds the one provided by Restlet first.
This method supports only the Types Cookie, CacheControl, EntityTag,
NewCookie and MediaType
java.lang.IllegalArgumentException: This method supports only the Types
Cookie, CacheControl, EntityTag, NewCookie and MediaType
at
org.restlet.ext.jaxrs.internal.spi.RuntimeDelegateImpl.createHeaderDelegate(Runt
imeDelegateImpl.java:101)
at
com.sun.jersey.spi.container.ContainerResponse.getHeaderValue(ContainerResponse.
java:211)
at
com.sun.jersey.spi.container.servlet.WebComponent$Writer.writeHeaders(WebCompone
nt.java:350)
at
com.sun.jersey.spi.container.servlet.WebComponent$Writer.writeStatusAndHeaders(W
ebComponent.java:338)
at
com.sun.jersey.spi.container.servlet.WebComponent$Writer.initiate(WebComponent.j
ava:329)
at
com.sun.jersey.spi.container.servlet.WebComponent$Writer.write(WebComponent.java
:309)
...
If I remove the Restlet JAXRs implementation
compile('asm:asm:3.3',
* **'com.sun.jersey:jersey-core:1.5'*,
'com.sun.jersey:jersey-server:1.5',
'com.sun.jersey.contribs:jersey-spring:1.5',
'javax.ws.rs:jsr311-api:1.1',
'org.restlet.jse:org.restlet:2.0.5',
'org.restlet.jee:org.restlet.ext.servlet:2.0.5',
'org.restlet.jee:org.restlet.ext.json:2.0.5'
)
And disable the Restlet dependencies at
# modified: src/java/org/grails/jaxrs/web/JaxrsContext.java
# deleted: src/java/org/grails/jaxrs/web/RestletServlet.java
# deleted:
test/integration/RestletControllerIntegrationTests.groovy
All tests pass with flying colors.
Original comment by bernardo...@gmail.com
on 21 Mar 2011 at 2:03
Hi Bernardo,
I see. Wonder why this error didn't came up earlier. Maybe loading the runtime
impl changed since Jersey 1.4 or 1.5.
I think we should investigate whether Jersey and Restlet can be configured to
load a *specific* runtime impl, then we can leave a single plugin. Otherwise
making different plugin editions (jersey, restlet, ...) makes sense.
Original comment by krass...@googlemail.com
on 21 Mar 2011 at 6:14
Section 7.1 of the JAX-RS spec says how to specify a concrete RuntimeDelegate
impl. Among others, this can be either a file named
META-INF/services/javax.ws.rs.ext.RuntimeDelegate or a system property named
javax.ws.rs.ext.RuntimeDelegate. The file takes higher precedence than the
system property.
The problem is that Restlet has this file in its jaxrs extension jar and the
grails-jaxrs plugin therefore cannot override this setting using a system
property.
I'll see what I can do. Maybe we need to provide a modifed version of this jar
in the lib folder.
Any better ideas?
Original comment by krass...@googlemail.com
on 21 Mar 2011 at 7:57
See also http://restlet.tigris.org/issues/show_bug.cgi?id=1251
Original comment by krass...@googlemail.com
on 21 Mar 2011 at 9:26
Original comment by krass...@googlemail.com
on 21 Mar 2011 at 10:32
Original comment by krass...@googlemail.com
on 21 Mar 2011 at 11:09
I just went through the changes, sorry for the delay. Agree in all, awesome!
Thanks for the Restlet issue too.
Kudos
Original comment by bernardo...@gmail.com
on 21 Mar 2011 at 5:03
Original issue reported on code.google.com by
bernardo...@gmail.com
on 9 Mar 2011 at 6:49