Re: RE : Client API for HTTP_DIGEST Auth in 2.0M6

2009-11-24 Thread Thierry Boileau
Hello Rich,

I've updated the sample code of the wiki: 
http://wiki.restlet.org/docs_2.0/112-restlet.html
I hope this will help you.

Best regards,
Thierry Boileau


 Jerome,

 Thanks for the reply.  Unfortuanately, I already have 
 org.restlet.ext.crypto.jar on my classpath.

 Do you have any other ideas?

 Thanks 
 Rich


   
 Hi Rich,

 You should add the org.restlet.ext.crypto.jar to your classpath.

 Cheers,
 Jérôme

 Le 23 nov. 2009, 7:20 PM, webp...@tigris.org a écrit :

 I just migrated our client and server from 2.0m3 to 2.0M6. All of the
 changes were fairly easy to figure out except those related to adding
  ChallengeResponse for HTTP_DIGEST authentication. Our code was based upon
 the example in the user guide (which is still the example in today's
 version.

 We would build a form with the username, ri, nonce, realm, domain, algorithm
 and QOP from the result, and then calculate and add the d5 digest. The we
 call request.setCredentialComponents(form).

 Since setCredentialComponents() is gone, I tried to find an alternative
 example and was not able to find one, I tried calling the individual setters
 for each of the prpoerties that had been placed into the form, and then call
 Request.setChallengeResponse(). This compiles fine, but I get the following
 warning and the a 401 response.

 Nov 23, 2009 10:36:49 AM org.restlet.engine.security.AuthenticatorUtils
 formatResponse
 WARNING: Challenge scheme HTTP_DIGEST not supported by the Restlet engine.
 Nov 23, 2009 10:36:49 AM org.restlet.engine.security.AuthenticatorUtils
 parseMessage
 WARNING: Couldn't find any helper support the HTTP_Digest challenge scheme.

 Is there a current example I should be looking at? If not, can you point me
 in the right direction.

 Thanks for your help
 Rich

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

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



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


Problem: GAE - Attaching sub applications does not work

2009-11-24 Thread Sam
I am trying to create an application on GAE using the Restlet-GAE M6 ..

I ran into a problem when trying to attach an sub Application to the root 
Application ..

here is what I am trying to do:
public class RootApplication extends Application {

@Override
public Restlet createInboundRoot() {
Router router = new Router(getContext());

router.attach(/a/, new SubApplication());
return router;
}
}

public class SubApplication extends Application {

@Override
public Restlet createInboundRoot() {
Router router = new Router(getContext());

router.attach(b/, HelloWorldHelloWorldResource.class);
return router;
}
}

public class HelloWorldResource extends ServerResource {

@Get
public String represenxst() {
return hello, world (from the cloud!);
}

}


I have tested this on the SE edition and it worked fine when I go to /a/b/ url 
it works as expected .. but on GAE it does not work

any suggestions on why this is happening?

Thanks in advance

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


RE: Re: RestletGWTSimpleExample - Error while handling an HTTP client call

2009-11-24 Thread webpost
hello thierry,

thanks, i just tested the current example code and ... it worked!! ;)

maybe it is because this time i didn't use the ant-script (it is missing this 
time), but directly imported the eclipse project file.

well unfortunately i ran into troubles again.
on the server-side i am using the JAX-RS features of the apache cxf framework 
to publish my RESTful services. say that my service runs at 
http://localhost:1234/messages

i tried to run a simple get-request on that url using
ClientResource r = new ClientResource(http://localhost:1234/messages;);
r.setOnReceived(new Uniform() {
public void handle(Request request, Response response) {
...
}
r.get(MediaType.APPLICATION_XML);

my service won't be invoked, the handler method neither, nor do i receive any 
log output...

is a restlet gwt client intended to be used with a restlet gwt server 
implementation only, so accessing my cxf services doesn't work by definition?

or is the problem that i can't access my service because of running gwt in 
hosted mode and trying to access a restful service on localhost outside of the 
gwt hosted scope?

thanks for your hints.

josef

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


Re: RestletGWTSimpleExample - Error while handling an HTTP client call

2009-11-24 Thread Thierry Boileau
Hello josef,

what is the status code of the response inside the  onReceived event 
manager?

is a restlet gwt client intended to be used with a restlet gwt server 
implementation only?
Not at all. The server part could be a simple servlet based application.

could you describe your environment? and maybe send a reproductible test 
case?

Best regards,
Thierry Boileau

 hello thierry,

 thanks, i just tested the current example code and ... it worked!! ;)

 maybe it is because this time i didn't use the ant-script (it is missing this 
 time), but directly imported the eclipse project file.

 well unfortunately i ran into troubles again.
 on the server-side i am using the JAX-RS features of the apache cxf framework 
 to publish my RESTful services. say that my service runs at 
 http://localhost:1234/messages

 i tried to run a simple get-request on that url using
 ClientResource r = new ClientResource(http://localhost:1234/messages;);
 r.setOnReceived(new Uniform() {
   public void handle(Request request, Response response) {
 ...
 }
 r.get(MediaType.APPLICATION_XML);

 my service won't be invoked, the handler method neither, nor do i receive any 
 log output...

 is a restlet gwt client intended to be used with a restlet gwt server 
 implementation only, so accessing my cxf services doesn't work by definition?

 or is the problem that i can't access my service because of running gwt in 
 hosted mode and trying to access a restful service on localhost outside of 
 the gwt hosted scope?

 thanks for your hints.

 josef



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


Re: RestletGWTSimpleExample - Error while handling an HTTP client call

2009-11-24 Thread Thierry Boileau
Hi Josef,

you seem to use two separate projects. Could you integrate your RESTful 
service application inside the gwt project? This should be composed of 
two parts: client and server (configured using the war/WEB=INF/web.xml 
file).

best regards,
Thierry Boileau


 i just saw, that internally an exception is thrown:

 Internal Connector Error (1002) - The URL http://localhost:1234/messages is 
 invalid or violates the same-origin security restriction

 this seems to be the problem. it might not be specific to restlet, anyways 
 maybe you know a way to bypass the SOP restricition using restless gwt?

 --

 regarding my environment: there is an apache cxf RESTful webservice started 
 by a simple java application which publishes a message service at 
 http://localhost:1234/messages. using firefox poster i can veryfy, that GET 
 http:localhost:1234/messages would give a list of messages in xml format. now 
 i am trying to build a gwt client which accesses the service. my platform is 
 ubuntu 9.10 where i develop under eclipse.

 thanks for your help and regards, josef

   
 Hello josef,

 what is the status code of the response inside the  onReceived event 
 manager?

 
 is a restlet gwt client intended to be used with a restlet gwt server 
 implementation only?
   
 Not at all. The server part could be a simple servlet based application.

 could you describe your environment? and maybe send a reproductible test 
 case?

 Best regards,
 Thierry Boileau

 
 hello thierry,

 thanks, i just tested the current example code and ... it worked!! ;)

 maybe it is because this time i didn't use the ant-script (it is missing 
 this time), but directly imported the eclipse project file.

 well unfortunately i ran into troubles again.
 on the server-side i am using the JAX-RS features of the apache cxf 
 framework to publish my RESTful services. say that my service runs at 
 http://localhost:1234/messages

 i tried to run a simple get-request on that url using
 ClientResource r = new ClientResource(http://localhost:1234/messages;);
 r.setOnReceived(new Uniform() {
 public void handle(Request request, Response response) {
 ...
 }
 r.get(MediaType.APPLICATION_XML);

 my service won't be invoked, the handler method neither, nor do i receive 
 any log output...

 is a restlet gwt client intended to be used with a restlet gwt server 
 implementation only, so accessing my cxf services doesn't work by 
 definition?

 or is the problem that i can't access my service because of running gwt in 
 hosted mode and trying to access a restful service on localhost outside of 
 the gwt hosted scope?

 thanks for your hints.

 josef


   



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


Re: Problem: GAE - Attaching sub applications does not work

2009-11-24 Thread Thierry Boileau
Hello Sam,

I think this issue is due to the routing and the matching strategy. 
Before the 2.0m6 release, a router detected the best route according to 
the start_with mode. At this time, this default strategy has been 
replaced by the equals mode, which is clearly not appropriate with 
your hierarchical structure.
That is to say: /sub/a/b is not equals to the first defined segment 
/sub, it simply starts with.
Therefore, I suggest that you updated the default routing strategy of 
the RootApplication's router:
router.setDefaultMatchingMode(Template.MODE_STARTS_WITH);

Best regards,
Thierry Boileau



 I am trying to create an application on GAE using the Restlet-GAE M6 ..

 I ran into a problem when trying to attach an sub Application to the root 
 Application ..

 here is what I am trying to do:
 public class RootApplication extends Application {

 @Override
 public Restlet createInboundRoot() {
 Router router = new Router(getContext());

 router.attach(/a/, new SubApplication());
 return router;
 }
 }

 public class SubApplication extends Application {

 @Override
 public Restlet createInboundRoot() {
 Router router = new Router(getContext());

 router.attach(b/, HelloWorldHelloWorldResource.class);
 return router;
 }
 }

 public class HelloWorldResource extends ServerResource {

 @Get
 public String represenxst() {
 return hello, world (from the cloud!);
 }

 }


 I have tested this on the SE edition and it worked fine when I go to /a/b/ 
 url it works as expected .. but on GAE it does not work

 any suggestions on why this is happening?

 Thanks in advance

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



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


@Get annotation not marked with @Inherited

2009-11-24 Thread Harald Pehl
Hi,

in my current application I would like to use the @Get annotation to marke the 
method for GET requests. For security checks I configured an aspect around the 
@Get method. Doing so, Restlet unfortunately is no longer able to see the @Get 
annotation in the generated AOP proxy class (which is a subclass of 
ServerResource). Looking at the @Get annotation I noticed that there's no 
@Inherited annotation present. 

As a workaround I cannot use the @Get annotation, but have to override the 
appropriate methods from ServerResource.

Would it be possible to add an @Inherited annotation to the @Get, @Post, ... 
annotations? Am I the first one facing this problem?

For further details see a 
href=http://haraldpehl.blogspot.com/2009/11/google-appengine-restlet-security.html;http://haraldpehl.blogspot.com/2009/11/google-appengine-restlet-security.html/a.

Best regards 
Harald

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


Re: Restlet 2.0 Best Practices

2009-11-24 Thread Avi Flax
On Mon, Nov 23, 2009 at 14:58,  webp...@tigris.org wrote:

 I am evaluating Restlet 2.0 vs. Spring 3.0 for a new project that is starting 
 soon. I have done a lot of reading on the website and have written a couple 
 of small programs with Restlet 2.0M6 to get the feel for it. I am looking to 
 hear from people who have been using it into production about their 
 configuration choices.

We're running 1.1, but my answers might still be helpful. We have 5
complex apps in production.

 1) What connector are you using with Restlet in production?

We've been using the Jetty connector for a few years now, and we're
very happy with it.

 I very much like the idea of not having to run inside of a web container, but 
 I am not sure from the list of available connectors which are the best for 
 production, and what are the pros and con's of each connector. Any advice 
 from the community on this is appreciated.

We run our apps as standalone apps — no servlet container — and I'm
very happy with this approach. We use the Tanuki Service Wrapper to
run them as Windows services.

 2) How are you dealing with Caching on the server side?

Mostly Memcache, some OSCache. I prefer Memcache, and after trying out
EHCache, I think it's better than OSCache.

 3)  Are you finding that the Services / Data Access Layers in Standard Web 
 Apps don’t apply in the Restlet World?

I didn't have a lot of experience with Java web development before I
started using Restlet, so I'm not sure what a Service is in a
Standard web app. But I have used a Data Access Object in one of my
Restlet apps, and that's worked out just fine.

 Given that we are exposing resources and no longer exposing services and 
 functionality, do you find that the need for Data Access Objects is gone? As 
 i think about what the app will do, I keep noticing that it is easier to put 
 the data access for a resource into the Restlet instead of making a Data 
 Access Object. After all PUT, POST, and DELETE will do something to the 
 persistent state of the resource and GET will just query it. Thoughts about 
 this from the community are highly appreciated.

This is highly specific to your application.

 4) What does your Restlet production setup look like?

Can you elaborate? What kind of information are you looking for?

-- 
Avi Flax » Partner » Arc90 » http://arc90.com
➙ Have you tried Kindling‽ http://kindlingapp.com

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


RE: Re: RE : Client API for HTTP_DIGEST Auth in 2.0M6

2009-11-24 Thread webpost
Thierry,

Thanks for the update.  After restructuring to match your new example, 
everything almost worked. I was still missing the DigestHelper. But I found a 
post about Engine.setUserClassLoader which fixed that (I'm running in an 
eclipse plugin/OSGI environment).

THe changes really simplify use of DIGEST Authentication. Glad to see the 
progress.


Thanks,

Rich

 Hello Rich,
 
 I've updated the sample code of the wiki: 
 http://wiki.restlet.org/docs_2.0/112-restlet.html
 I hope this will help you.
 
 Best regards,
 Thierry Boileau
 
 
  Jerome,
 
  Thanks for the reply.  Unfortuanately, I already have 
  org.restlet.ext.crypto.jar on my classpath.
 
  Do you have any other ideas?
 
  Thanks 
  Rich
 
 

  Hi Rich,
 
  You should add the org.restlet.ext.crypto.jar to your classpath.
 
  Cheers,
  Jérôme
 
  Le 23 nov. 2009, 7:20 PM, webp...@tigris.org a écrit :
 
  I just migrated our client and server from 2.0m3 to 2.0M6. All of the
  changes were fairly easy to figure out except those related to adding
   ChallengeResponse for HTTP_DIGEST authentication. Our code was based upon
  the example in the user guide (which is still the example in today's
  version.
 
  We would build a form with the username, ri, nonce, realm, domain, 
  algorithm
  and QOP from the result, and then calculate and add the d5 digest. The we
  call request.setCredentialComponents(form).
 
  Since setCredentialComponents() is gone, I tried to find an alternative
  example and was not able to find one, I tried calling the individual 
  setters
  for each of the prpoerties that had been placed into the form, and then 
  call
  Request.setChallengeResponse(). This compiles fine, but I get the following
  warning and the a 401 response.
 
  Nov 23, 2009 10:36:49 AM org.restlet.engine.security.AuthenticatorUtils
  formatResponse
  WARNING: Challenge scheme HTTP_DIGEST not supported by the Restlet engine.
  Nov 23, 2009 10:36:49 AM org.restlet.engine.security.AuthenticatorUtils
  parseMessage
  WARNING: Couldn't find any helper support the HTTP_Digest challenge scheme.
 
  Is there a current example I should be looking at? If not, can you point me
  in the right direction.
 
  Thanks for your help
  Rich
 
  --
  http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2423509
  
 
  --
  http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2423548
 
 

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


Re: Setting Http Authorization header (part 2)

2009-11-24 Thread Thierry Boileau
hello Alex,

using the sample code available here 
http://wiki.restlet.org/docs_2.0/188-restlet.html, I've found that 2 
requests are received by the server (when clicking on the button 
labelled Refresh (Basic authentication).
The first one is not authenticated, the other one is and contains the 
Authorization header... However at the same time, the code that sends 
the request (from client side: 
org.restlet.gwt.engine.http.GwtHttpClientCall sendRequest) is only 
called once...
Is this the current behaviour of the GWT client in hosted mode? We need 
a bit more investigations.

best regards,
Thierry Boileau


 Hello Jerome and all Restlet fans!

 I have spent my last 2 days trying to set the authorization header to a
 certain value, using the restlet gwt api. However, I was unsuccessful, so I
 started looking at the source code. You specifically said in the previous
 message that an authorization header is automatically created for you when
 you specify a ChallengeResponse object (also mentioned in wiki), but the
 only code that actually does something with the ChallengeResponse object is
 located in GwtHttpClientHelper lines 86-92:

 if (request.getChallengeResponse() != null) {
 result.getRequestBuilder().setUser(
 request.getChallengeResponse().getIdentifier());
 result.getRequestBuilder().setPassword(
 String.valueOf(request.getChallengeResponse()
 .getSecret()));
 }

 I have tried all kind of value combinations, but none showed the
 Authorization header in Firebug. WHAT AM I MISSING here? PS: I don't need
 a password set here, just a association between Authorization - Id in
 headers map

 Thanks, Alex


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