Hi Ross,
See attached for a modified Bookstore sample that uses Spring.
When using GF, Jersey with Servlet and the JSP view support it will
only work with URL patterns of the form "/" or "/<something>/*", and
will not work with a URL pattern of "/*", and a 404 will be returned
(even though there is no error forwarding to the JSP). I am not sure
if that behavior is the same for other app servers.
So, it is recommended that if you want to use JSP view support with a
URL pattern of "/*" that you utilize a filter.
Hope this helps,
Paul.
On May 23, 2009, at 10:09 AM, Ross Duncan wrote:
> Hi guys,
>
> Great to be joining the mailing list.
>
> I have been experimenting with Jersey for the past couple of weeks,
> and would like to share a challenge I am facing.
>
> I am looking to build a Spring based application with both human web
> and machine web clients. I want to be able to, as far as possible,
> serve HTML pages as well as JSON (or some other machine friendly
> representation) out of the same codebase.
>
> REST looks like a good fit for this because the the same Resource
> could simply have different Representations for humans and machines.
> Jersey looks like a good fit because there are already examples that
> demonstrate the implicit binding of JSP views to Resources
> (Bookstore sample), and the annotated Spring integration (spring-
> annotations sample).
>
> The trouble for me is, I havent so far managed to get both concepts
> working at the same time in the same application. I have tried
> various ways of combining the two samples, but I always end up with
> a 404 when accessing the Resource URLS from the web browser. Im
> guessing I just need to strike upon the right way of configuring
> web.xml, but the two samples take two different approaches here.
> Bookstore sets up Jersey using a filter, and Annotated-Spring uses a
> Servlet. I have tried taking the configuration options used against
> the filter in Bookstore and adding them to the servlet's
> configuration in Annotated-Spring, but no joy.
>
> Is it clear what I am trying to do? If so, is it possible with the
> current version of Jersey?
>
> Any help would be much appreciated!
>
> Thanks,
> Ross