users@jersey.java.net

Best practices - Web service and website

From: Stephen Colebourne <scolebourne_at_joda.org>
Date: Fri, 20 Aug 2010 14:42:16 +0100

I'm building a system where there are two distinct types of output -
web service and website.

For the web service, I want exceptions to map to status codes. For the
website, I want to map to error pages. Are there any strategies for
doing this? The exception mappers seem to be global.

To make this work neatly, I have one class for the web service and one
class for the website for the same resource. In order to get this to
work, I ended up adjusting the URI, so the web service one has /data
in the middle. Is it possible to have the same URI implemented in two
different classes (so long as the media type annotations are
different)?

Stephen