I'm trying to guard resources under the uri /resources/{resourceId} but am not 
having much luck.

In createRoot i have defined router and guards as below but I'm not being 
issued with a challenge and in the constructor of the ResourceResource class I 
no longer have access to the resourceId attribute:

getRequest().getAttributes().get("resourceId");

returns null, and the response returns a 404. Without the guard, the 
application works as expected, where am I going wrong?

Thanks,
Bedwyr

public synchronized Restlet createRoot() {

Router router = new Router(getContext());

Router guardedRouter = new Router(getContext());        

Guard guard = new Guard(getContext(),
                ChallengeScheme.HTTP_BASIC, "testing");
guard.setNext(guardedRouter);
guard.getSecrets().put("name", "pass".toCharArray());

guardedRouter.attach("/{resourceId}", ResourceResource.class);
router.attach("/resources​​", guard);

return router;
}

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2442048

Reply via email to