users@jersey.java.net

[Jersey] User specific WADL

From: Markus Gulden <markus.c.gulden_at_googlemail.com>
Date: Tue, 19 Jun 2012 17:43:39 +0200

Hello everbody,

I'm pretty happy with the Jersey WADL generator and Jersey in general, but
I still miss one feature.
Maybe somebody can tell me, that I just didn't find the existing solution
and where I have to look for it, or which would be the best way to
implement this on my own:

Our application shall enable a user to remote control one or more vehicles
by a smartphone app. The communication between app and server is
implemented as a REST interface.
For example, /server/vehicle1 represents the car, /server/vehicle1/position
its actual position, /server/vehicle1/ac the air conditioner and so on. Via
http commands, the user can ask for the actual state, or control it.

Since the interface could be changed with the time (e. g. a car has a new
function), the client app shall retreive a WADL of the actual interface to
know which functions can be called, and to generate a GUI on runtime.


So far, so good, these functionalities can be used out of the box, and they
work.

But of course, not every user shall be able to use every function of the
general system, e. g. a boss should'nt see the actual position of his
employee's car due to privacy reasons, or a user should only have basic
functions due to contract reasons.

For this, I need a way to filter all existing REST resources by certain
(user specific) criterias.

Is there a solution out of the box, I just haven't found?

And if not, maybe somebody can give me an advice to do this on my own?

I'm not so familiar with servlet technology and so on, but I would try to
inject a @Context SecurityContext into
my com.sun.jersey.server.wadl.WadlBuilder instance to get the user
credentials, and then filter the whole bulk of exisiting resources by user
criterias which I get from a database.


Thank you a lot for your help!
Kind regards