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 find "authorize.html":

  Configuration config = new Configuration();
ContextTemplateLoader ctl = new ContextTemplateLoader(getContext(),
"clap:///");
config.setTemplateLoader(ctl);
getLogger().fine("loading: " + authPage);
TemplateRepresentation result = new TemplateRepresentation(authPage,
config, MediaType.TEXT_HTML);
Specifically, result.template is null.  The message that I see is:
WARNING: Unable to get the template authorize.html. Error message: Template
authorize.html not found.

The first problem I fixed was adding the CLAP protocol.  My web.xml file
had:

org.restlet.clients
HTTP HTTPS CLAP  

but that didn't seem to be enough, so in MyOauthServer.createInboundRoot()
method, I added:
  this.getConnectorService().getClientProtocols().add(Protocol.CLAP);  //
For Freemarker  
  this.getContext().getClientDispatcher().getProtocols().add(Protocol.CLAP); 
// For Freemarker another attempt
This fixed the error message "FINE: The protocol used by this request is not
declared in the application's connector service. Please update the list of
client connectors used by your application and restart it." but did not
solve the null template problem.

It seems that the getPage() is trying to load a "class" of type "html" from
the top-level directory of my war file.  And that is where I have
authorize.html.  I also put it in the WEB-INF directory.  In addition, since
MyOauthServer is setup in my web.xml file as:
  
AuthServer
org.restlet.ext.servlet.ServerServlet

  org.restlet.application
  com.fourspires.oauth.server.MyOauthServer

  
  
 AuthServer
 /oauth/*
  

I also put an authorize.html at "war"/oauth/authorize.html and
"war"/web-inf/oauth/authorize.html.

But alas, none of these work.  Where do I have to place the authorize.html
file so that it can be loaded by the ContextTemplateLoader?

Note: I am running 2.2 GAE Edition.

Thanks so much!
RB

--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/OAuth2-How-to-resolve-Unable-to-get-the-template-authorize-html-tp7575959.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


RE: No buffer space available (maximum connections reached?)

2012-05-24 Thread Jerome Louvel
Hi Arjohn,

Thanks for reporting this issue, it should now be fixed in 2.1 RC5 and in the 
master branch.

We now try to properly close the Pipe when an exception occurs and by default 
we now relay calls made on write(OutputStream) to write(WritableByteChannel) 
using a blocking channel, almost like you suggested.

Best regards,
Jerome
--
http://www.restlet.com
http://twitter.com/#!/jlouvel


-Message d'origine-
De : Arjohn Kampman [mailto:arjohn.kamp...@aduna-software.com] 
Envoyé : lundi 21 mai 2012 08:41
À : discuss@restlet.tigris.org
Objet : Re: No buffer space available (maximum connections reached?)

Hi Thierry,

FYI: We've tested this solution using a custom WritableRepresentation subclass 
for a couple of weeks now. We haven't seen this issue anymore since then.

Regards,
Arjohn

On 16/05/2012 16:47, Thierry Boileau wrote:
> Hello Arjohn,
>
> sorry for the delay, I ask Jérôme to take a closer look at your suggestion.
>
> Best regards,
> Thierry Boileau
>
> Hi all, me again :-)
>
> I have debugged this issue further and have probably found a simple fix.
> I've migrated from 2.0.x to 2.1.x in the mean time and both version are
> affected by this issue.
>
> The "Unable to establish loopback connection" problem surfaces when
> using resources that return WritableRepresentation objects. In the stack
> trace below, ChannelRepresentation.write(OutputStream) converts the
> writable channel to a readable one through
> WritableRepresentation.getChannel() and
> NioUtils.getReadableByteChannel(...). This last method uses a
> java.nio.channels.Pipe as a buffer between the writer and reader.
> Because this pipe isn't closed/released in time, the system will run out
> of available ports under high load, resulting in the shown stack trace.
>
> Making sure that the reader-side of the pipe is always closed could help
> to resolve this issue, but there's a more elegant solution that doesn't
> use ports. This solution is to override write(OutputStream) in
> WritableRepresentation, wrap the OutputStream in a WritableByteChannel
> using e.g. java.nio.channels.Channels.newChannel(...) and pass that to
> WritableRepresentation.write(WritableByteChannel). Gut feeling is that
> this might even improve the performance as it feels like a lighter
> weight approach than using the system's pipes.
>
> WDYT? Can we get this fix?
>
> Cheers,
>
> Arjohn
>
>
>
> On 20/04/2012 10:01, Arjohn Kampman wrote:
>  > Hi all,
>  >
>  > My restlet server is running into the error mentioned in the subject
>  > after a couple of minutes of moderate load. After this error, the
> server
>  > stops responding. Does anyone know what causes this error and how
> it can
>  > be fixed?
>  >
>  > The full stack trace looks like this:
>  >
>  > org.restlet.engine.http.adapter.ServerAdapter commit
>  > SEVERE: An exception occured writing the response entity
>  > java.io.IOException: Unable to establish loopback connection
>  >   at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:106)
>  >   at java.security.AccessController.doPrivileged(Native Method)
>  >   at sun.nio.ch.PipeImpl.(PipeImpl.java:122)
>  >   at
> sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:27)
>  >   at java.nio.channels.Pipe.open(Pipe.java:133)
>  >   at org.restlet.engine.io.NioUtils.getChannel(NioUtils.java:160)
>  >   at
>  >
> 
> org.restlet.representation.WritableRepresentation.getChannel(WritableRepresentation.java:65)
>  >   at
>  >
> 
> org.restlet.representation.ChannelRepresentation.write(ChannelRepresentation.java:71)
>  >   at
>  >
> 
> org.restlet.engine.application.EncodeRepresentation.write(EncodeRepresentation.java:304)
>  >   at
>  >
> org.restlet.engine.http.ServerCall.writeResponseBody(ServerCall.java:550)
>  >   at
> org.restlet.engine.http.ServerCall.sendResponse(ServerCall.java:488)
>  >   at
>  >
> org.restlet.ext.jetty.internal.JettyCall.sendResponse(JettyCall.java:327)
>  >   at
>  >
> 
> org.restlet.engine.http.adapter.ServerAdapter.commit(ServerAdapter.java:197)
>  >   at
>  >
> org.restlet.engine.http.HttpServerHelper.handle(HttpServerHelper.java:151)
>  >   at
>  >
> 
> org.restlet.ext.jetty.JettyServerHelper$WrappedServer.handle(JettyServerHelper.java:167)
>  >   at
>  >
> 
> org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:594)
>  >   at
>  >
> 
> org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1042)
>  >   at
> org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:549)
>  >   at
> org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:211)
> 

Re: How to measure the performance of an app using Restlet 2.1

2012-05-24 Thread Dalia Sobhy
I already tried both JMeter and LoadUI and no output is shown i mean as for 
LoadUI there is no graph plotted its an empty graph thats why I am asking..

Although I have tried the tools on either URLs as google.com and it worked out.

So my question is has anyone faced these errors or do anyone tried those tools 
and they were working normally with him/her ??

Sent from my iPhone

On 2012-05-24, at 9:57 AM, "Ioannis Mavroukakis [via Restlet Discuss]" 
 wrote:

> Yes both run under OSX IIRC. JMeter definitely, LoadUI probably. 
> 
> On 23 May 2012, at 23:14, Dalia Sobhy <[hidden email]> wrote: 
> 
> > Is there one for mac osx ?? 
> > 
> > -- 
> > View this message in 
> > context:http://restlet-discuss.1400322.n2.nabble.com/How-to-measure-the-performance-of-an-app-using-Restlet-2-1-tp7571360p7574242.html
> > Sent from the Restlet Discuss mailing list archive at Nabble.com. 
> > 
> > -- 
> >http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2964700
> 
> -- 
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2964785
> 
> 
> If you reply to this email, your message will be added to the discussion 
> below:
> http://restlet-discuss.1400322.n2.nabble.com/How-to-measure-the-performance-of-an-app-using-Restlet-2-1-tp7571360p7574734.html
> To unsubscribe from How to measure the performance of an app using Restlet 
> 2.1, click here.
> NAML

Sent from my iPhone

On 2012-05-24, at 9:57 AM, "Ioannis Mavroukakis [via Restlet Discuss]" 
 wrote:

> Yes both run under OSX IIRC. JMeter definitely, LoadUI probably. 
> 
> On 23 May 2012, at 23:14, Dalia Sobhy <[hidden email]> wrote: 
> 
> > Is there one for mac osx ?? 
> > 
> > -- 
> > View this message in context: 
> > http://restlet-discuss.1400322.n2.nabble.com/How-to-measure-the-performance-of-an-app-using-Restlet-2-1-tp7571360p7574242.html
> > Sent from the Restlet Discuss mailing list archive at Nabble.com. 
> > 
> > -- 
> > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2964700
> 
> -- 
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2964785
> 
> 
> If you reply to this email, your message will be added to the discussion 
> below:
> http://restlet-discuss.1400322.n2.nabble.com/How-to-measure-the-performance-of-an-app-using-Restlet-2-1-tp7571360p7574734.html
> To unsubscribe from How to measure the performance of an app using Restlet 
> 2.1, click here.
> NAML


--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/How-to-measure-the-performance-of-an-app-using-Restlet-2-1-tp7571360p7574788.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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

Re: How to measure the performance of an app using Restlet 2.1

2012-05-24 Thread Dalia Sobhy
I already tried both JMeter and LoadUI and no output is shown i mean as for 
LoadUI there is no graph plotted its an empty graph thats why I am asking..

Although I have tried the tools on either URLs as google.com and it worked out.

So my question is has anyone faced these errors or do anyone tried those tools 
and they were working normally with him/her ??

Sent from my iPhone

On 2012-05-24, at 9:57 AM, "Ioannis Mavroukakis [via Restlet Discuss]" 
 wrote:

> Yes both run under OSX IIRC. JMeter definitely, LoadUI probably. 
> 
> On 23 May 2012, at 23:14, Dalia Sobhy <[hidden email]> wrote: 
> 
> > Is there one for mac osx ?? 
> > 
> > -- 
> > View this message in context: 
> > http://restlet-discuss.1400322.n2.nabble.com/How-to-measure-the-performance-of-an-app-using-Restlet-2-1-tp7571360p7574242.html
> > Sent from the Restlet Discuss mailing list archive at Nabble.com. 
> > 
> > -- 
> > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2964700
> 
> -- 
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2964785
> 
> 
> If you reply to this email, your message will be added to the discussion 
> below:
> http://restlet-discuss.1400322.n2.nabble.com/How-to-measure-the-performance-of-an-app-using-Restlet-2-1-tp7571360p7574734.html
> To unsubscribe from How to measure the performance of an app using Restlet 
> 2.1, click here.
> NAML


--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/How-to-measure-the-performance-of-an-app-using-Restlet-2-1-tp7571360p7574787.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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

Re: How to measure the performance of an app using Restlet 2.1

2012-05-24 Thread Ioannis Mavroukakis
Yes both run under OSX IIRC. JMeter definitely, LoadUI probably. 

On 23 May 2012, at 23:14, Dalia Sobhy  wrote:

> Is there one for mac osx ??
> 
> --
> View this message in context: 
> http://restlet-discuss.1400322.n2.nabble.com/How-to-measure-the-performance-of-an-app-using-Restlet-2-1-tp7571360p7574242.html
> Sent from the Restlet Discuss mailing list archive at Nabble.com.
> 
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2964700

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


Re: Restlet Framework 2.1 RC5 and 2.0.14 released

2012-05-24 Thread Ioannis Mavroukakis
Hi Dalia, 
Please do not hijack the release thread. The problem you have with ab has 
nothing to do with Restlet, as I've already explained to you in an earlier 
post. Use an alternative load tool like LoadUI or Apache JMeter

On 23 May 2012, at 23:21, Dalia Sobhy  wrote:

> Hiii Jerome, 
> 
> I have a problem with restlet 2.0.12,
> 
> When I type this cmd $ab -n 10 -c 5
> http://localhost:8182/test/1235/retrievepatient
> This is ApacheBench, Version 2.3 <$Revision: 655654 $>
> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
> Licensed to The Apache Software Foundation, http://www.apache.org/
> 
> Benchmarking localhost (be patient)...apr_poll: The timeout specified has
> expired (70007)
> 
> $ curl http://localhost:8182/test/1235/retrievepatient
> info:address => 
> 6 Elfanan Ahmed Osman zizenia; info:bloodGroup => 
> O; info:dateOfBirth => 
> Sat Nov 10 00:00:00 EET 3860; info:fullname => 
> Nadia Badawi; info:gender => 
> male; info:maritalStatus => 
> MARRIED;  
> 
> So any info plzz because this is so critical to me, I want to test the
> performance of my restlet web app...
> 
> --
> View this message in context: 
> http://restlet-discuss.1400322.n2.nabble.com/Restlet-Framework-2-1-RC5-and-2-0-14-released-tp7574149p7574251.html
> Sent from the Restlet Discuss mailing list archive at Nabble.com.
> 
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2964701

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