Hi antoniojg,

antoniojg schrieb:
> Hi all, I'm trying to port the restlet-gwt sample to a jax-rs style using the
> appropriate classes and annotations.
> However, I do not know how to set  two guards on a same resource.
>
> In the original sample, two guards performing basic and digest
> authentication were added on two different urls /guarded and guarded_digest.
> This was possible since the router.attach method was being invoked.
>
> Now I'm wondering whether the same thing is possible to achieve using a
> JsrApplication instance.
> If I use the setGuard method I'm unable to distinguish which Guard should be
> invoked depending on a particular url. So how can I do?
> May someone help me?
>   
You mean you have two root resource classes, and want to use different 
guards for them?
You have to instantiate two JaxRsApplications, and give one Guard to the 
first JaxRsApplication the other Guard to the other JaxRsApplication. 
Than you set one of the jaxRsApplication objects as default restlet to 
the other jaxRsApplication object:

        JaxRsApplication jaxRsApp1 = new JaxRsApplication();
        JaxRsApplication jaxRsApp2 = new JaxRsApplication();
        jaxRsApp1.setGuard(guard1);
        jaxRsApp2.setGuard(guard2);       
        jaxRsApp1.getJaxRsRestlet().attachDefault(jaxRsApp2);

Does this solve your problem? Or do I missunderstood you?
> The documentation at the link:
> http://wiki.restlet.org/docs_1.1/13-restlet/28-restlet/57-restlet.html 
> is a little vague and according to previous posts, it also seems to be
> partially wrong since the createRoot method is being missed and all the
> activity has been moved to the construcor.
> Moreover, the  ExampleApplication should extend ApplicationConfig and not
> Application, if I do not get wrong.
> Thanks to alla for your support. It's a really great project and I'd like to
> contribute for it.
I've just take a look on the wiki page. It says nothing about the method 
createRoot, and I've changed ApplicationConfig to Application some weeks or 
month ago. Do you used an old version of this page, perhaps a cached one? Could 
you reload it from the server in your browser, or perhaps clear your cache?

best regards
   Stephan

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

Reply via email to