I've so far been successful in setting up a basic web service using Apache Wink. This includes returning Atom, JSON, HTML, XHTML, XML, and plaintext media types, as per the samples provided. I've also been able to successfully use a MessageBodyWriter to "manually" generate the XHTML output. So far, great. I'm happy to return most of the media types via the existing Wink mechanism.
What I'm trying to do now is have the returned XHTML content use a JSP. I.e., I'd like to use a JSP as an output template, sending the POJO through as a parameter to populate the fields in the JSP. Below is some pseudocode for what I've got right now.
@Path("{id}")
@GET
@Produces({MediaType.APPLICATION_XHTML_XML})
public Response getXhtml( @PathParam("id") String id )
{
try {
MyBean mybean = service.getBean(id);
return Response.ok(new MyAsset(mybean))
.location(new URI(baseurl+"Output.jsp"))
.type(MediaType.APPLICATION_XHTML_XML).build();
} catch ( Exception e ) {
throw new WebApplicationException(e,Status.INTERNAL_SERVER_ERROR);
}
}
It just seems to ignore the JSP entirely. And if I finally do figure out how, I'll need to know how to pass the POJO as a parameter. I know there's something I'm missing here, as I assume Apache Wink can interoperate with a JSP-based web service. The Wink documentation is generally good, but I couldn't find anything on this. Thanks for any assistance, ideally a link to a working example.