Hello Richard,
I suggest you to update your code as follow:
public final Restlet createInboundRoot() {
Router rootRouter = new Router(getContext());
Router guardedRouter = new Router(getContext());
// attach your resources, relatively to the root path "/v1"
guardedRouter.attach("/test", MyTestResource.class);
// This router defines resources without authentication
Router router = new Router(getContext());
// attach your resources, relatively to the root path "/v2"
router.attach("/test", MyTestResource.class);
GaeAuthenticator guard = new GaeAuthenticator(getContext());
guard.setNext(guardedRouter);
rootRouter.attach("/v1", guard);
rootRouter.attach("/v2", router);
return rootRouter;
}
If you intend to serve the same hierarchy of resources under "/v1", or
"/v2", you can define only one router and attach it twice:
public final Restlet createInboundRoot() {
Router rootRouter = new Router(getContext());
// This router defines resources
Router router = new Router(getContext());
// attach your resources
router.attach("/test", MyTestResource.class);
GaeAuthenticator guard = new GaeAuthenticator(getContext());
guard.setNext(router);
rootRouter.attach("/v1", guard); // guarded
rootRouter.attach("/v2", router); // not guarded
return rootRouter;
}
Best regards,
Thierry Boileau
Thanks again for the update - I will continue to work on this, although
> right
> now I am in the midst of trying to get oAuth2 to work, so it may be a while
> before I have a real response.
> RB
>
> --
> View this message in context:
> http://restlet-discuss.1400322.n2.nabble.com/Is-it-possible-to-easily-have-authenticated-non-authenticated-versions-tp7557195p7561885.html
> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2961136
>
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2961141