-
1. Re: migrate JAX-RS Jersey project from glassfish to wildfly RestEasy
jamezp Apr 28, 2014 8:23 PM (in response to thomas_x) -
2. Re: migrate JAX-RS Jersey project from glassfish to wildfly RestEasy
thomas_x Apr 29, 2014 4:18 AM (in response to jamezp)I dont know how to write a Service that Returns Json with padding ... on Glassfish3 with Jersey i have used the jersey-class 'JSONWithPadding' and it worked out of the box.
I found the following in the docu:
-----------------------------------------------------------------------------------------------------------------------
21.7. JSONP Support
If you're using Jackson, Resteasy has JSONP that you can turn on by adding the provider
org.jboss.resteasy.plugins.providers.jackson.JacksonJsonpInterceptor
(Jackson2JsonpInterceptor if you're using the Jackson2 provider) to your deployments. If the media type of the response is json and a callback query parameter is given, the response will be a javascript snippet with a method call of the method defined by the callback parameter. For example:GET /resources/stuff?callback=processStuffResponse
will produce this response:
processStuffResponse(<nomal JSON body>)
This supports the default behavior of jQuery.
You can change the name of the callback parameter by setting the callbackQueryParameter property.
-----------------------------------------------------------------------------------------------------------------------
but i don't know how to add the provider
org.jboss.resteasy.plugins.providers.jackson.JacksonJsonpInterceptor
-
3. Re: migrate JAX-RS Jersey project from glassfish to wildfly RestEasy
thomas_x Apr 29, 2014 12:24 PM (in response to thomas_x)I have made a workaround with a Servletfilter: http://code.google.com/p/moodlemobile/source/browse/moodlemobile/src/main/java/org/jboss/tools/example/html5/util/JSONPRequestFilter.java?r=3
-
4. Re: migrate JAX-RS Jersey project from glassfish to wildfly RestEasy
jamezp Apr 29, 2014 12:40 PM (in response to thomas_x)Have a look at creating the @Pretty annotation RESTEasy JAX-RS. It's for XML, but could be used with Jackson2 as well mapper to use SerializationFeature.INDENT_OUTPUT. I'm sure Jettison or other processors also have a way of doing this.
--
James R. Perkins
-
5. Re: migrate JAX-RS Jersey project from glassfish to wildfly RestEasy
thomas_x Apr 30, 2014 2:27 AM (in response to jamezp)I have tried it with jackson2 as descriped in the posting above (this is an extract of the your link) ... but it didn't work !
I didn't find out how to add the provider.
I think it's the best way to use the Servletfilter, so we can use jackson,jettison, jersey or ...
thank's for your help !