GWT client, authentication and ETags

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

GWT client, authentication and ETags

Niclas Hedhman
Hi,

I am confused over the client pattern to use.

On one hand, I find documentation/mails that speaks of ClientResource,
which IIUIC is not present in the GWT Module/jar of 2.0-M5, and
elsewhere I read of the "new Client( protocol )" usage, where I can't
figure out how to tailor authentication and headers.

First step; Which of the two is the correct one?

Step 2; If it is "Client", then how are these things supposed to be done?
My first guess was that one is called to the Uniform.handle() method
before the call is made, but then... it must be called after the call
is completed...

TIA

Cheers
--
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I  live here; http://tinyurl.com/2qq9er
I  work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2431992
Reply | Threaded
Open this post in threaded view
|

Re: GWT client, authentication and ETags

Thierry Boileau
Hello Niclas,

the API of Restlet 2.0 has been moving, as usual, and it is now
stabilized a few points needs to be addressed). The future 2.0 RC
(Release Candidate) is planned for january 2010, which means that the
API will be definitively freezed at this time.
That explains why the 2.0M5 (which is a milestone) does not reflect the
actual API. It is simply outdated.
Thus, if you intend to build GWT project, we invite you to use the
2.0M6, or even the current snapshot.

In matter of documentation, you may have already had a look at this
links which present two sample applications:
 - http://wiki.restlet.org/docs_2.0/188-restlet.html
 - http://wiki.restlet.org/docs_2.0/303-restlet.html

Best regards,
Thierry Boileau

> Hi,
>
> I am confused over the client pattern to use.
>
> On one hand, I find documentation/mails that speaks of ClientResource,
> which IIUIC is not present in the GWT Module/jar of 2.0-M5, and
> elsewhere I read of the "new Client( protocol )" usage, where I can't
> figure out how to tailor authentication and headers.
>
> First step; Which of the two is the correct one?
>
> Step 2; If it is "Client", then how are these things supposed to be done?
> My first guess was that one is called to the Uniform.handle() method
> before the call is made, but then... it must be called after the call
> is completed...
>
> TIA
>
> Cheers
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2432000
Reply | Threaded
Open this post in threaded view
|

Re: GWT client, authentication and ETags

Niclas Hedhman
On Mon, Dec 21, 2009 at 10:48 PM, Thierry Boileau
<[hidden email]> wrote:

> Hello Niclas,
>
> the API of Restlet 2.0 has been moving, as usual, and it is now
> stabilized a few points needs to be addressed). The future 2.0 RC
> (Release Candidate) is planned for january 2010, which means that the
> API will be definitively freezed at this time.
> That explains why the 2.0M5 (which is a milestone) does not reflect the
> actual API. It is simply outdated.
> Thus, if you intend to build GWT project, we invite you to use the
> 2.0M6, or even the current snapshot.
>
> In matter of documentation, you may have already had a look at this
> links which present two sample applications:
>  - http://wiki.restlet.org/docs_2.0/188-restlet.html
>  - http://wiki.restlet.org/docs_2.0/303-restlet.html

Ok, thanks. I will try to use M6 (can't use SNAPSHOT, since I have my
own 'release' and Maven refuse releasing with SNAPSHOT deps).


Cheers
--
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I  live here; http://tinyurl.com/2qq9er
I  work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2432212
Reply | Threaded
Open this post in threaded view
|

Re: GWT client, authentication and ETags

Niclas Hedhman
Ok,
Since I use JSON, and the ext.json was missing the GWT module
definition, I kind of 'forced' ;-) into SNAPSHOT after all.

So, first spontaneous observation;

 *  ext.json depends on Google's Json classes, and I think that
therefor the module should inherit the Google one.

Secondly, I presume that clientResource.getChallengeReequest() after
construction will return a mutable instance that can be used to set up
headers and auth... Right?


Cheers

On Tue, Dec 22, 2009 at 1:19 PM, Niclas Hedhman <[hidden email]> wrote:

> On Mon, Dec 21, 2009 at 10:48 PM, Thierry Boileau
> <[hidden email]> wrote:
>> Hello Niclas,
>>
>> the API of Restlet 2.0 has been moving, as usual, and it is now
>> stabilized a few points needs to be addressed). The future 2.0 RC
>> (Release Candidate) is planned for january 2010, which means that the
>> API will be definitively freezed at this time.
>> That explains why the 2.0M5 (which is a milestone) does not reflect the
>> actual API. It is simply outdated.
>> Thus, if you intend to build GWT project, we invite you to use the
>> 2.0M6, or even the current snapshot.
>>
>> In matter of documentation, you may have already had a look at this
>> links which present two sample applications:
>>  - http://wiki.restlet.org/docs_2.0/188-restlet.html
>>  - http://wiki.restlet.org/docs_2.0/303-restlet.html
>
> Ok, thanks. I will try to use M6 (can't use SNAPSHOT, since I have my
> own 'release' and Maven refuse releasing with SNAPSHOT deps).
>
>
> Cheers
> --
> Niclas Hedhman, Software Developer
> http://www.qi4j.org - New Energy for Java
>
> I  live here; http://tinyurl.com/2qq9er
> I  work here; http://tinyurl.com/2ymelc
> I relax here; http://tinyurl.com/2cgsug
>



--
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I  live here; http://tinyurl.com/2qq9er
I  work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2432225
Reply | Threaded
Open this post in threaded view
|

Re: GWT client, authentication and ETags

Thierry Boileau
Hi Niclas,

 > * ext.json depends on Google's Json classes, and I think that
therefore the module should inherit the Google one.
Isn't that the case? Do you think about the JSON.gwt.xml file that looks
like:
<module>
    <inherits name='com.google.gwt.user.User' />
    <inherits name='com.google.gwt.json.JSON' />
</module>


 >Secondly, I presume that clientResource.getChallengeRequest() after
construction will return a mutable instance that can be used to set up
headers and auth... Right?

Actually, the ChallengeRequest is sent by the server. The client send a
ChallengeResponse object...
You can have a look at the sample code :
http://wiki.restlet.org/docs_2.0/188-restlet.html

Best regards,
Thierry Boileau


> Ok,
> Since I use JSON, and the ext.json was missing the GWT module
> definition, I kind of 'forced' ;-) into SNAPSHOT after all.
>
> So, first spontaneous observation;
>
>  *  ext.json depends on Google's Json classes, and I think that
> therefor the module should inherit the Google one.
>
> Secondly, I presume that clientResource.getChallengeReequest() after
> construction will return a mutable instance that can be used to set up
> headers and auth... Right?
>
>
> Cheers
>
> On Tue, Dec 22, 2009 at 1:19 PM, Niclas Hedhman <[hidden email]> wrote:
>  
>> On Mon, Dec 21, 2009 at 10:48 PM, Thierry Boileau
>> <[hidden email]> wrote:
>>    
>>> Hello Niclas,
>>>
>>> the API of Restlet 2.0 has been moving, as usual, and it is now
>>> stabilized a few points needs to be addressed). The future 2.0 RC
>>> (Release Candidate) is planned for january 2010, which means that the
>>> API will be definitively freezed at this time.
>>> That explains why the 2.0M5 (which is a milestone) does not reflect the
>>> actual API. It is simply outdated.
>>> Thus, if you intend to build GWT project, we invite you to use the
>>> 2.0M6, or even the current snapshot.
>>>
>>> In matter of documentation, you may have already had a look at this
>>> links which present two sample applications:
>>> Â - http://wiki.restlet.org/docs_2.0/188-restlet.html
>>> Â - http://wiki.restlet.org/docs_2.0/303-restlet.html
>>>      
>> Ok, thanks. I will try to use M6 (can't use SNAPSHOT, since I have my
>> own 'release' and Maven refuse releasing with SNAPSHOT deps).
>>
>>
>> Cheers
>> --
>> Niclas Hedhman, Software Developer
>> http://www.qi4j.org - New Energy for Java
>>
>> I Â live here; http://tinyurl.com/2qq9er
>> I Â work here; http://tinyurl.com/2ymelc
>> I relax here; http://tinyurl.com/2cgsug
>>
>>    
>
>
>
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2432230
Reply | Threaded
Open this post in threaded view
|

Re: GWT client, authentication and ETags

Niclas Hedhman
On Tue, Dec 22, 2009 at 3:47 PM, Thierry Boileau
<[hidden email]> wrote:

> Hi Niclas,
>
>  > * ext.json depends on Google's Json classes, and I think that
> therefore the module should inherit the Google one.
> Isn't that the case? Do you think about the JSON.gwt.xml file that looks
> like:
> <module>
>    <inherits name='com.google.gwt.user.User' />
>    <inherits name='com.google.gwt.json.JSON' />
> </module>

Some short-circuit occurring. Possibly mixing it up with some previous version.

>  >Secondly, I presume that clientResource.getChallengeRequest() after
> construction will return a mutable instance that can be used to set up
> headers and auth... Right?
>
> Actually, the ChallengeRequest is sent by the server. The client send a
> ChallengeResponse object...
> You can have a look at the sample code :
> http://wiki.restlet.org/docs_2.0/188-restlet.html

Uhhh...??? Now I am more confused than ever... I thought I understood
the basic principles involved.

Your Example;

 // Add an AJAX call to the server
    ClientResource r = new ClientResource("/ping");

    // Set the callback object invoked when the response is received.
    r.setOnReceived(new Uniform() {
        public void handle(Request request, Response response) {
            try {
                button.setText(response.getEntity().getText());
            } catch (IOException e) {
                 e.printStackTrace();
            }
        }
    });
    r.get();

The Response instance is coming from the server, right???


Cheers
--
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I  live here; http://tinyurl.com/2qq9er
I  work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2432263
Reply | Threaded
Open this post in threaded view
|

Re: GWT client, authentication and ETags

Niclas Hedhman
Again, if I read a bit more careful...

The "Request" contains the "ChallengeReponse"....

Got it!!!

Thanks a lot for your patience... Tiring day for me...

Niclas

On Tue, Dec 22, 2009 at 5:33 PM, Niclas Hedhman <[hidden email]> wrote:

> On Tue, Dec 22, 2009 at 3:47 PM, Thierry Boileau
> <[hidden email]> wrote:
>> Hi Niclas,
>>
>>  > * ext.json depends on Google's Json classes, and I think that
>> therefore the module should inherit the Google one.
>> Isn't that the case? Do you think about the JSON.gwt.xml file that looks
>> like:
>> <module>
>>    <inherits name='com.google.gwt.user.User' />
>>    <inherits name='com.google.gwt.json.JSON' />
>> </module>
>
> Some short-circuit occurring. Possibly mixing it up with some previous version.
>
>>  >Secondly, I presume that clientResource.getChallengeRequest() after
>> construction will return a mutable instance that can be used to set up
>> headers and auth... Right?
>>
>> Actually, the ChallengeRequest is sent by the server. The client send a
>> ChallengeResponse object...
>> You can have a look at the sample code :
>> http://wiki.restlet.org/docs_2.0/188-restlet.html
>
> Uhhh...??? Now I am more confused than ever... I thought I understood
> the basic principles involved.
>
> Your Example;
>
>  // Add an AJAX call to the server
>    ClientResource r = new ClientResource("/ping");
>
>    // Set the callback object invoked when the response is received.
>    r.setOnReceived(new Uniform() {
>        public void handle(Request request, Response response) {
>            try {
>                button.setText(response.getEntity().getText());
>            } catch (IOException e) {
>                 e.printStackTrace();
>            }
>        }
>    });
>    r.get();
>
> The Response instance is coming from the server, right???
>
>
> Cheers
> --
> Niclas Hedhman, Software Developer
> http://www.qi4j.org - New Energy for Java
>
> I  live here; http://tinyurl.com/2qq9er
> I  work here; http://tinyurl.com/2ymelc
> I relax here; http://tinyurl.com/2cgsug
>



--
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I  live here; http://tinyurl.com/2qq9er
I  work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2432265
Reply | Threaded
Open this post in threaded view
|

Re: GWT client, authentication and ETags

Thierry Boileau
Hi Niclas,

 >Some short-circuit occurring. Possibly mixing it up with some previous
version.
sure, there have been updates in the last days.

>Thanks a lot for your patience... Tiring day for me...

you're welcome! :)

Best regards,
Thierry Boileau


> Again, if I read a bit more careful...
>
> The "Request" contains the "ChallengeReponse"....
>
> Got it!!!
>
> Thanks a lot for your patience... Tiring day for me...
>
> Niclas
>
> On Tue, Dec 22, 2009 at 5:33 PM, Niclas Hedhman <[hidden email]> wrote:
>  
>> On Tue, Dec 22, 2009 at 3:47 PM, Thierry Boileau
>> <[hidden email]> wrote:
>>    
>>> Hi Niclas,
>>>
>>> Â > * ext.json depends on Google's Json classes, and I think that
>>> therefore the module should inherit the Google one.
>>> Isn't that the case? Do you think about the JSON.gwt.xml file that looks
>>> like:
>>> <module>
>>> Â  Â <inherits name='com.google.gwt.user.User' />
>>> Â  Â <inherits name='com.google.gwt.json.JSON' />
>>> </module>
>>>      
>> Some short-circuit occurring. Possibly mixing it up with some previous version.
>>
>>    
>>> Â >Secondly, I presume that clientResource.getChallengeRequest() after
>>> construction will return a mutable instance that can be used to set up
>>> headers and auth... Right?
>>>
>>> Actually, the ChallengeRequest is sent by the server. The client send a
>>> ChallengeResponse object...
>>> You can have a look at the sample code :
>>> http://wiki.restlet.org/docs_2.0/188-restlet.html
>>>      
>> Uhhh...??? Now I am more confused than ever... I thought I understood
>> the basic principles involved.
>>
>> Your Example;
>>
>> Â // Add an AJAX call to the server
>> Â  Â ClientResource r = new ClientResource("/ping");
>>
>> Â  Â // Set the callback object invoked when the response is received.
>> Â  Â r.setOnReceived(new Uniform() {
>> Â  Â  Â  Â public void handle(Request request, Response response) {
>> Â  Â  Â  Â  Â  Â try {
>> Â  Â  Â  Â  Â  Â  Â  Â button.setText(response.getEntity().getText());
>> Â  Â  Â  Â  Â  Â } catch (IOException e) {
>> Â  Â  Â  Â  Â  Â  Â  Â  e.printStackTrace();
>> Â  Â  Â  Â  Â  Â }
>> Â  Â  Â  Â }
>> Â  Â });
>> Â  Â r.get();
>>
>> The Response instance is coming from the server, right???
>>
>>
>> Cheers
>> --
>> Niclas Hedhman, Software Developer
>> http://www.qi4j.org - New Energy for Java
>>
>> I Â live here; http://tinyurl.com/2qq9er
>> I Â work here; http://tinyurl.com/2ymelc
>> I relax here; http://tinyurl.com/2cgsug
>>
>>    
>
>
>
>

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