I would do the other way : put your Jettison configuration in a JAXB
decorator (see the @Pretty in user guide). The marshaller in the decorator
processor is Jettison.

Maybe another way : do you really need the Json in the response template ?
Using the rest-js "Ajax client" you can really simply get your JSON by
javascript. And if you need it in DOM jQuery can inject it :
MainMapPageModel.JSON  could be serialized as <div id="jsonify"></div> and
a $('#jsonify').html(jsonResponse) would do the job.

2012/9/27 Adam Walczak <m...@adamwalczak.info>

> Hi,
>
> I'm developing a website using RESTEasy and Seam REST module for
> templating support.
> (great libraries BTW)
>
> I have a method that generates an HTML page like:
>
>     @GET
>     @Produces({MediaType.TEXT_HTML})
>     @ResponseTemplate(value=MainLayoutModel.TEMP_PATH,
> responseName="model")
>     public MainMapPageModel mainMapPage() throws JAXBException {
>         MainMapPageModel model = new MainMapPageModel();
>         model.addLocacScript("main-map.js");
>         Marshaller m = createMarshaller() // need to implement this so I
> can later to getJSON() in the template
>         StringWriter sw = new StringWriter();
>         m.marshal(model, sw);
>         model.setJSON(sw.toString());
>         return model;
>     }
>
> As you see I would like to have the MainMapPageModel also available in my
> HTML as JSON so that it would be accessible to my JavaScript code.
>
> The most suitable marshaller for me would be the same one RESTEasy is
> using.
> This way the JSON in HTML would be consistent with my JSON from the REST
> API.
>
> This is why I'm searching for a way to access
> RESTEasy's JettisonMappedContext to create a marshaller.
> Does any one know any way to get it ?
> What class in RESTEasy instances it internally ?
> Maybe I could hack it.
>
> Big thanks for any help.
>
> --
> Adam Walczak
> www.adamwalczak.info
> +48 604 188 992
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://ad.doubleclick.net/clk;258768047;13503038;j?
> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
> _______________________________________________
> Resteasy-users mailing list
> Resteasy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>
>
------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to