RE: Jackson extension performance question

2013-01-28 Thread Richard Berger
Tim: Was trying to use your LocalJacksonConverter in a Restlet application that I have. But I wasn't sure how to go about doing that. I figured that I should start in my createInboundRoot with something like... ObjectMapper objectMapper = new ObjectMapper(); LocalJacksonConverter

RE: Jackson extension performance question

2013-01-28 Thread Richard Berger
Tim: After some additional searching, I think I can get by with a simple singleton OBJECT_MAPPER for each of my ServerResources. It's probably not as good as one for all the ServerResources, but it is much simpler - and has already provided a fairly dramatic performance improvement. So

RE: Does the OAuth2 extension support client-side/user agent/implicit grant flow?

2013-01-08 Thread Richard Berger
I am pretty sure the answer to this question is No. Looking at code in org.restlet.ext.oauth.Flow anything related to the userAgent flow has been commented out. Maybe it will be revived one day... wish I had the ability to do it :) RB --

Does the OAuth2 extension support client-side/user agent/implicit grant flow?

2013-01-07 Thread Richard Berger
I have used the OAuth2 extension to build a Restlet-based and plain Java clients for my API (Restlet/GAE). These both use OAuth's authorization flow which is supported by the OAuth2 extension. Now I wanted to build a JavaScript client. JavaScript clients seem to require a different flow

RE: OAuth2: How to resolve Unable to get the template authorize.html.

2012-07-25 Thread Richard Berger
Thank you for the response. I was able to use setTemplateLoader to get my own code to point at a particular directory - but I didn't see how to change what AuthPageServerResource was doing (without of course changing that code and having my own version of it - which I didn't want to do). Did

Re: Handling exceptions/errors when using Restlet for Client and Server....

2012-07-11 Thread Richard Berger
you can do is to explicitly manage the error entity, as in the workaround in the snippet. It's not pretty, but it works. --tim On Tue, Jul 10, 2012 at 8:36 PM, Richard Berger [hidden email]http://user/SendEmail.jtp?type=nodenode=7578202i=0 wrote: And one further note, wrapping the client

Re: Handling exceptions/errors when using Restlet for Client and Server....

2012-07-11 Thread Richard Berger
Excellent points - I didn't quite realize that the Status was restlet specific and now it makes more sense to me that (as you put it) the illusion isn't extended all the way to Exceptions. Thanks for your ongoing assistance and information! RB -- View this message in context:

Handling exceptions/errors when using Restlet for Client and Server....

2012-07-10 Thread Richard Berger
My question is similar to that raised at: http://restlet-discuss.1400322.n2.nabble.com/Sending-server-side-exceptions-error-codes-back-to-client-td7219795.html#a7229629 http://restlet-discuss.1400322.n2.nabble.com/Sending-server-side-exceptions-error-codes-back-to-client-td7219795.html#a7229629 ,

Re: Handling exceptions/errors when using Restlet for Client and Server....

2012-07-10 Thread Richard Berger
sure I DON'T have this problem. Is this a bug in the client that it can't access the http status message? That is what I'm gathering from the thread you linked as well. bjorn On Jul 10, 2012, at 1:18 PM, Richard Berger wrote: My question is similar to that raised at: http://restlet

Re: Handling exceptions/errors when using Restlet for Client and Server....

2012-07-10 Thread Richard Berger
(commitsRef); CommitmentsResource commitsResource = clientResource.wrap(CommitmentsResource.class); Representation commitsRep = null; commitsRep = commitsResource.represent(); Changes nothing RB On Tue, Jul 10, 2012 at 4:22 PM, Richard Berger rich...@landisfamily.orgwrote: Yes, I

RE: Re: ServerResource getRequest() returns null

2012-06-19 Thread Richard Berger
On my resource: public class UserActsServerResource extends ServerResource implements UserActsResource {... I am able to use: public final Representation represent() { ... User user = UserHelpers.getCurrentUser(this.getRequest(), this.getResponse()); and this.getRequest() returns a useful

RE: Restlet + GAE + OAuth - anyone get this to work?

2012-06-19 Thread Richard Berger
Took a week, but I did get it to work. For anyone else who runs into this 1. I was following the Ericsson documentation at: https://labs.ericsson.com/apis/oauth2-framework/documentation#Web_Client_Flow that got me as far as getting things to work on my local Google-app-engine dev server.

RE: Restlet + GAE + OAuth - anyone get this to work?

2012-06-19 Thread Richard Berger
One more note... there is a more complete code sample at: http://fni.googlecode.com/svn/!svn/bc/622/trunk/fniCloud/src/fi/foyt/fni/cloud/ (it's much better than my code - although most of the Restlet relevant classes seem to no longer be available in the owner's current version - they may have

Restlet + GAE + OAuth - anyone get this to work?

2012-06-13 Thread Richard Berger
I thought I was close - I had things working on my dev server, but when I upload to appspot, I can no longer access my resources. If anyone has made this work please post back and I will provide additional details. Thanks!! RB -- View this message in context:

Simple OpenId question re: multiple verifiers

2012-06-01 Thread Richard Berger
Using the instructions at http://wiki.restlet.org/docs_2.1/13-restlet/28-restlet/404-restlet.html I am able to use OpenId4Java to provide Google based authentication. In particular, the line: OpenIdVerifier verifier = new OpenIdVerifier(OpenIdVerifier.PROVIDER_GOOGLE); Does much of the magic.

RE: Re: OAuth2: How to resolve Unable to get the template authorize.html._130102

2012-05-25 Thread Richard Berger
Thanks so much! The /classes directory wasn't visible in Eclipse so I didn't think to try there. So I just copied the files using Windows and that worked perfectly! Thanks again, RB --

OAuth2: How to resolve Unable to get the template authorize.html.

2012-05-24 Thread Richard Berger
I am working through the oAuth2 sample code and have hit a Restlet issue that has stymied me for a while. Following the sample code, I have: HttpOAuthHelper.setAuthPageTemplate(authorize.html, getContext()); However, when AuthPageServerResource.getPage() is called the following code is unable to

RE: GAEAuthenticator and Android - anyone make this work?

2012-05-21 Thread Richard Berger
Some success - at least when accessing a local GAE server. #1. Replaced use of the Android Account Manager with at HttpClient call to http://10.0.2.2:/_ah/login to obtain the authentication information (dev_appserver_login=l:True:145185941422614610318; Path=/;) This was followed by

RE: GAEAuthenticator and Android - anyone make this work?

2012-05-21 Thread Richard Berger
Following Nick's excellent blog article at: http://blog.notdot.net/2010/05/Authenticating-against-App-Engine-from-an-Android-app and with the changes I had made previously, I am now able to use the Android AccountManager and Restlet's GaeAuthenticator to require authentication to access the API

Re: [Restlet] Unsupported media type

2012-05-19 Thread Richard Berger
I had a problem like this and resolved it by adding: Engine.getInstance().getRegisteredConverters().add(0, new JacksonConverter()); to my Android code before I constructed my client resource My code is just a little tweak on the documented version at:

RE: Re: [Restlet] Unsupported media type

2012-05-19 Thread Richard Berger
Do you get the same 415 error when you go to /connection in your browser? (If so, then the problem is in your ServiceConnection class, rather then in your Android code). Also, in my Android code, I don't wrap the resource, but do the call directly on the ClientResource class, as in:

RE: Re: [Restlet] Unsupported media type

2012-05-19 Thread Richard Berger
From the code that you have posted, I am not able to see the problem Perhaps the type of your connect variable doesn't match the type defined in your Server file. But that is just a guess. Good luck! RB -- View this message in context:

RE: Is it possible to (easily) have authenticated/non-authenticated versions...

2012-05-16 Thread Richard Berger
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:

Re: Is it possible to (easily) have authenticated/non-authenticated versions...

2012-05-16 Thread Richard Berger
Thanks - that works perfectly for me. I had been returning the guard to fix an earlier problem - but obviously I fixed it in the wrong way. Thanks again for the detailed solution! RB -- View this message in context:

RE: Is it possible to (easily) have authenticated/non-authenticated versions...

2012-05-15 Thread Richard Berger
Thank you for the response... My simplified test code is now: public final Restlet createInboundRoot() { Router router = new Router(getContext()); router.attach(/v1/, RootServerResource.class); router.attach(/v2/, RootServerResource.class); GaeAuthenticator guard = new

Is it possible to (easily) have authenticated/non-authenticated versions...

2012-05-14 Thread Richard Berger
As I am working on implementing authentication, I was wondering if I could configure createInboundRoute to attach the GAEAuthenticator guard only to uris of the form /v1/ (to implement authentication) and allow uris of the form /v0/... to pass through without authentication. My code

RE: [Restlet Android] Object representation selection (application/x-java-serialized-object vs. application/json)

2012-04-25 Thread Richard Berger
Engine.getInstance().getRegisteredConverters().add(0, new JacksonConverter()); Worked for me - putting the JacksonConverter first seemed to restore the automagic :) RB --

Re: Is there a way to get the response code from the annotated ClientResource?

2012-03-23 Thread Richard Berger
Thanks so much - that was exactly what I needed! RB -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/Is-there-a-way-to-get-the-response-code-from-the-annotated-ClientResource-tp7397618p7398735.html Sent from the Restlet Discuss mailing list archive at Nabble.com.

How to generate/catch a 404 error correctly?

2012-03-22 Thread Richard Berger
Designing some Junit tests and in one of those tests, a create a Commitment, then delete, then get it to make sure I get a 404. On the server side, the following code executes: public Representation get() { ... setStatus(Status.CLIENT_ERROR_NOT_FOUND, There is no record with id +

Re: How to generate/catch a 404 error correctly?

2012-03-22 Thread Richard Berger
[Solved] public Representation get(MediaType mediaType) throws ResourceException So I need to catch the ResourceException and examine the status (and that works just fine). -- View this message in context:

Re: Restlet client support (browser)

2012-03-22 Thread Richard Berger
Felipe: I have used the Restlet-Javascript edition, although only in a test environment - and my use is probably pretty basic. Thierry has been very responsive in answering questions that I had (mostly my issues were about how representations were being negotiated). Good luck, RB -- View

Is there a way to get the response code from the annotated ClientResource?

2012-03-22 Thread Richard Berger
Given code like the following... ClientResource commentClient = new ClientResource(...); CommentsResource commentsResource = commentClient.wrap(CommentsResource.class); commentsResource.postCommentForm(form); is there a way to get the response code from the commentsResource? Currently I am

Re: Mystery of @Post...

2012-03-15 Thread Richard Berger
Thank you for the clarification. I made the changes you suggested (totally dropping the postJava() method). I tested this with the Java client (it worked, no surprise). I then tested it using the Apigee console - and it still worked (a little surprise). Then tested it with a Javascript (using

Re: Mystery of @Post...

2012-03-14 Thread Richard Berger
I downloaded the 3/14 snapshot of 2.2 and I don't see a change. Two points... 1. This may not be a bug - this may only be a conflict with my expectations 2. If this is a bug, is it possible that it is a Jackson problem and not a Restlet problem? Please let me know if I can provide additional

Re: Mystery of @Post...

2012-03-14 Thread Richard Berger
Thank you for the suggestions (I especially liked having the annotations only in the interface). But no difference... After removing the annotations from the implementation, the output was: Mar 14, 2012 8:13:44 PM com.fourspires.api.server.CommentsServerResource postJson INFO: In postJson Mar

Re: Mystery of @Post...

2012-03-14 Thread Richard Berger
I am now only using the @Post(java) method to be able to use: ClientResource client4 = new ClientResource(someURL); CommentsResource commentsResource = client4.wrap(CommentsResource.class); Representation representation4 = commentsResource.postJava(comment); rather than the more generic:

Mystery of @Post...

2012-03-02 Thread Richard Berger
First, the good news. My code is working. But I don't understand WHY it works. Using Restlet and the Annotated Interface approach, described at http://wiki.restlet.org/docs_2.0/13-restlet/27-restlet/328-restlet/285-restlet.html. I am also running Restlet GAE (if that matters). I am using

Beginning WADL question...

2012-02-28 Thread Richard Berger
I am trying to follow the example in 6.3 of the latest version of Restlet in Action to add WADL generation to my Restlet (GAE edition) app. My application extends WadlApplication /public class CommitmentServerApplication extends WadlApplication {/ All my resources extend /WadlServerResource/

Re: Post problems when using Restlet Javascript Edition...

2012-02-24 Thread Richard Berger
Quick update - I put in explicit media types for the @Post() annotations on my implementing classes, e.g.: @Post(json) public Representation acceptJson(String jsonString) { And that has fixed the problem both when going through tcpmon and without tcpmon involved. I wasn't able to figure out if

Re: Post problems when using Restlet Javascript Edition...

2012-02-23 Thread Richard Berger
Thierry: Thanks so much for your help. The short version is that the latest Restlet JS code (plus one change in my code) fixes my problem with post(). There is one strangeness that I will describe below, but it isn't a big problem for me at this point, but I will describe it below in case you

Re: Post problems when using Restlet Javascript Edition...

2012-02-15 Thread Richard Berger
First - thank you for your message and the work that you are doing. I downloaded the latest .js files and the previously reported error is indeed fixed. But my post() is still not being received on the server side when called from Javascript. From Javascript, I am able to succesfully call get

Re: Post problems when using Restlet Javascript Edition...

2012-02-15 Thread Richard Berger
Thanks again for your help. I downloaded tcpmon and made the suggested changes to my Java client. I then did a post through Java and below are the Request and the Response. Request POST /commitments/ HTTP/1.1 Date: Wed, 15 Feb 2012 22:19:58 GMT Content-Length: 109 Content-Type:

Would I be correct in assuming that the Javascript Edition for Restlet is inactive?

2012-02-13 Thread Richard Berger
Haven't been able to find much documentation - all the posts here are quite old - and just wondering if I should use something else for playing around with a javascript REST client (e.g. JQuery). On the other hand, if folks are hard at work on the Javascript edition - my apologies! Thanks in

Post problems when using Restlet Javascript Edition...

2012-02-09 Thread Richard Berger
Working on a small project to learn REST/Restlet and ran into a problem where I can successfully post from a Java client to my server or from an HTML form to my server, but when I try to post from Javascript it fails. I am following the sample code that is now on github

RE: tutorial not working

2010-12-20 Thread Richard Berger
Tutorial works fine for me in dev mode, but fails when I upload to appspot. I only have a single servlet in my web.xml web-app context-param param-nameorg.restlet.clients/param-name param-valueCLAP FILE/param-value /context-param servlet servlet-nameadapter/servlet-name