I am working with Jersey's implicit views and would appreciate your
help on the following issues:
1) I have a single resource which uses an index.jsp to render a
(customer) list to the page. I am issuing a POST from a HTML form
rendered by this index.jsp against the same resource which adds a new
customer record. How do I then redirect the user back to the same
page? Currently, I'm returning a Response object. What do I need to
return in order to render the same index.jsp following a successful
POST?
@POST
public Response addCust(@FormParam("name") String name,
@FormParam("description") String desc) {
try {
int custId = persistCust(name, desc);
return Response.ok().build(); // *** WHAT SHOULD I
RETURN HERE TO RENDER THE IMPLICIT INDEX.JSP???
} catch (Exception e) {
throw new WebApplicationException(e,
Response.Status.INTERNAL_SERVER_ERROR);
}
}
2) The resource in question is @Path /Customers. I'm hitting an
intermittent problem where some of the ahref links are not correctly
rendered by the JSP. I need all links to be relative to the current
resource at e.g.
http://webappname:8080/Customers/{id} but quite often
the 'Customers' segment is left out. So obviously if I hardcode this
into the implicit JSP view, it intermittently gets inserted twice. Is
there a correct way to resolve links on the page so that they are
relative to the implicit resource?
3) Finally, I would like to build something which renders a number of
items on the page that are constructed from multiple REST calls. Sort
of like a collection of REST portlets (sorry if that is a bad word!).
Is there any support in Jersey for constructing a page from a series
of REST calls?
Thanks,
Louis