Hello Bedwyr,

 >where am I going wrong?
Well, I don't know.... I've just copy/pasted your code which works fine 
for me.

I just notice some strange characters ("âEUR<âEUR<") in the instruction 
that attaches the guard:

router.attach("/resourcesâEUR<âEUR<", guard);



Best regards,
Thierry Boileau


> 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âEUR<âEUR<", guard);
>
> return router;
> }
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2442048
>
>

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

Reply via email to