From: Adam W. <me...@ad...> - 2012-09-27 20:39:15
|
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 |