Hi,
We are using Jersey 1.1.5.1 with some security (OAuth + accreditation
level).
We would like to display in the "application.wadl" only the resources
that are allowed for a member. And we are facing some difficulties doing
that, what would be the better approach to do it?
We also use the extended Wadl.
We try to use "application.wadl" display as a service:
So we would like to obtain something like that
@Path("/application.wadl")
public class ApplicationWadlResource extends RestResource {
private static SortedMap<ResourceSecurity.Level, Response>
wadlByLevel;
/**
* @response.representation.200.mediaType application/xml
* @response.representation.200.doc The "application.wadl"
describing the services you can access.
* @response.representation.503.doc If the resource is unavailable.
* @return
* @throws Exception
*/
@ResourceSecurity(level = Level.L1_PUBLIC)
@GET
@Produces(MediaType.APPLICATION_XML)
public Response responseWadl() throws Exception {
SecurityContext sc = (SecurityContext)
servletRequest.getAttribute(SecurityContext.ATTRIBUTE);
//get the wadl corresponding to the accreditation level
return wadlByLevel.get(sc.getAccreditation());
}
public static void
setWadlByLevel(SortedMap<ResourceSecurity.Level, Response> wadlByLevel)
{
ApplicationWadlResource.wadlByLevel = wadlByLevel;
}
The map would be filled by a filter at server start.
The problems we are facing is filling the wadlByLevel map, we tried
with
new WadlBuilder().generate( ... );
That needs a set of "AbstractResources" which are a bit difficult to use
for our needs.
What would be the better approach?
Thank you for your help.
Patrick Sauts.