RE: Understanding Restlet's Threading Model?

2008-03-04 Thread Jerome Louvel

Hi all,

Rob is right, the threading strategy depends on the actual server used
(Grizzly, Jetty, Simple or the NRE internal one). In general there is a pool
of worker threads. This pool has a configurable size so you can generally
limit the maximum number of concurrent threads. See this page for
configuration details:
http://www.restlet.org/documentation/1.1/connectors#jetty

For Jetty here is the list of parameters available:
http://www.restlet.org/documentation/1.1/ext/com/noelios/restlet/ext/jetty/J
ettyServerHelper

Now, be aware that web browser generally serialize the request to a single
target server/domain at least limit the number of concurrent requests sent.

If you really want to test the concurrent behavior of your Restlet
application, you should instead use a proper load tester. Here is a
benchmark that was done by Thierry on 1.0 connectors:
http://www.restlet.org/documentation/1.0/benchmark

Best regards,
Jerome  

 -Message d'origine-
 De : Rob Heittman [mailto:[EMAIL PROTECTED] 
 Envoyé : lundi 3 mars 2008 22:45
 À : discuss@restlet.tigris.org
 Objet : Re: Understanding Restlet's Threading Model?
 
 
 The mapping of incoming network connections to threads is 
 very dependent on the HTTP/HTTPS connector/server in use.  
 Restlet, as far as I know, does not do anything to attenuate 
 the native behavior of the server with regard to creating 
 threads for incoming network connections.  Which server 
 environment were you looking at when you tested?
 
 
 On Mon, Mar 3, 2008 at 2:43 PM, Aaron Crow 
 [EMAIL PROTECTED] wrote:
 
 
   I'd like to understand the threading model used by my 
 basic Restlet app. I
   have a standalone app that uses Application and 
 Component, and attaches
   subclasses of Restlet to the router. I am using the 
 reference implementation
   provided by noelios. (Many, many thanks to Jerome for 
 all of this!)
   
 
 



Re: 1.1-M2 maven dependency error for artifact 'com.noelios.restlet.ext.spring'

2008-03-04 Thread Thierry Boileau
Hello all,

thanks for reporting these issues. The publis repository has been updated.

best regards,
Thierry Boileau

On Tue, Mar 4, 2008 at 2:47 AM, Todd Nguyen [EMAIL PROTECTED] wrote:
 Got the same error after upgrading to 1.1-M2 snapshot. Can someone from
 restlet team fix the build process so it generate the correct pom.xml files
 for Spring?

 Thanks
 Todd



 On Mon, Mar 3, 2008 at 6:10 AM, Peter Neubauer [EMAIL PROTECTED]
 wrote:
  Rasmus Agerholm rasmus at agerholm.org writes:
 
  
   HiThe pom file for the 'com.noelios.restlet.ext.spring' artifact found
 at the
 
 
 
  'maven.restlet.org' repository,
 
 http://maven.restlet.org/com/noelios/restlet/com.noelios.restlet.ext.servlet/1.1-M2/com.noelios.restlet.ext.servlet-1.1-M2.pom
   defines the 'com.noelios.restlet.ext.servlet' dependency like this:
  dependency groupIdcom.noelios.restlet.ext.servlet/groupId
  artifactIdcom.noelios.restlet.ext.servlet/artifactId
version1.1-M/version  /dependencyI believe the
 groupId
  should be 'com.noelios.restlet' and the version should be '1.1-M2',
 right?The
  groupId issue also goes for the 1.1-SNAPSHOT pom.Best Regards, and thanks
 for a
  very good framework Rasmus Agerholm
  
 
  Hi there,
  another error in both 1.1-M2 and 1.1-SNAPSHOT like at
 
 http://maven.restlet.org/org/restlet/org.restlet.ext.spring/1.1-SNAPSHOT/org.restlet.ext.spring-1.1-SNAPSHOT.pom
  is the non-replaced spring framework dependency version variable
  @lib-spring-version@, resulting in non-valid deps in maven.
 
  /peter
 
  dependency
  groupIdorg.springframework/groupId
  artifactIdspring-core/artifactId
  version@lib-spring-version@/version
   /dependency
   dependency
  groupIdorg.springframework/groupId
  artifactIdspring-context/artifactId
  version@lib-spring-version@/version
   /dependency
   dependency
  groupIdorg.springframework/groupId
  artifactIdspring-beans/artifactId
  version@lib-spring-version@/version
   /dependency
   dependency
  groupIdorg.springframework/groupId
  artifactIdspring-web/artifactId
  version@lib-spring-version@/version
   /dependency
   dependency
  groupIdorg.springframework/groupId
  artifactIdspring-webmvc/artifactId
  version@lib-spring-version@/version
   /dependency
 
 
 




Re: 1.1-M2 maven dependency error for artifact 'com.noelios.restlet.ext.spring'

2008-03-04 Thread Rasmus Agerholm
Sorry to bother you again, Thierry, but you forgot to fix the groupId for
the com.noelios.restlet.ext.servlet dependency. It should be

  dependency
 groupIdcom.noelios.restlet/groupId
 artifactIdcom.noelios.restlet.ext.servlet/artifactId
 version1.1-M2/version
  /dependency

the same for 1.1-SNAPSHOT

Thanks

/Rasmus


On 3/4/08, Thierry Boileau [EMAIL PROTECTED] wrote:

 Hello all,

 thanks for reporting these issues. The publis repository has been updated.

 best regards,

 Thierry Boileau


 On Tue, Mar 4, 2008 at 2:47 AM, Todd Nguyen [EMAIL PROTECTED] wrote:
  Got the same error after upgrading to 1.1-M2 snapshot. Can someone from
  restlet team fix the build process so it generate the correct pom.xmlfiles
  for Spring?
 
  Thanks
  Todd
 
 
 
  On Mon, Mar 3, 2008 at 6:10 AM, Peter Neubauer [EMAIL PROTECTED]
 
  wrote:
   Rasmus Agerholm rasmus at agerholm.org writes:
  
   
HiThe pom file for the 'com.noelios.restlet.ext.spring' artifact
 found
  at the
  
  
  
   'maven.restlet.org' repository,
  
 
 http://maven.restlet.org/com/noelios/restlet/com.noelios.restlet.ext.servlet/1.1-M2/com.noelios.restlet.ext.servlet-1.1-M2.pom
defines the 'com.noelios.restlet.ext.servlet' dependency like this:
   dependency groupIdcom.noelios.restlet.ext.servlet
 /groupId
   artifactIdcom.noelios.restlet.ext.servlet/artifactId
 version1.1-M/version  /dependencyI believe the
  groupId
   should be 'com.noelios.restlet' and the version should be '1.1-M2',
  right?The
   groupId issue also goes for the 1.1-SNAPSHOT pom.Best Regards, and
 thanks
  for a
   very good framework Rasmus Agerholm
   
  
   Hi there,
   another error in both 1.1-M2 and 1.1-SNAPSHOT like at
  
 
 http://maven.restlet.org/org/restlet/org.restlet.ext.spring/1.1-SNAPSHOT/org.restlet.ext.spring-1.1-SNAPSHOT.pom
   is the non-replaced spring framework dependency version variable
   @lib-spring-version@, resulting in non-valid deps in maven.
  
   /peter
  
   dependency
   groupIdorg.springframework/groupId
   artifactIdspring-core/artifactId
   version@lib-spring-version@/version
/dependency
dependency
   groupIdorg.springframework/groupId
   artifactIdspring-context/artifactId
   version@lib-spring-version@/version
/dependency
dependency
   groupIdorg.springframework/groupId
   artifactIdspring-beans/artifactId
   version@lib-spring-version@/version
/dependency
dependency
   groupIdorg.springframework/groupId
   artifactIdspring-web/artifactId
   version@lib-spring-version@/version
/dependency
dependency
   groupIdorg.springframework/groupId
   artifactIdspring-webmvc/artifactId
   version@lib-spring-version@/version
/dependency
  
  
  
 
 




-- 
MvH
Rasmus Agerholm


Re: 1.1-M2 maven dependency error for artifact 'com.noelios.restlet.ext.spring'

2008-03-04 Thread Thierry Boileau
Hi Rasmus,

it should be fixed, thanks again.

best regards,
Thierry Boileau

On Tue, Mar 4, 2008 at 11:23 AM, Rasmus Agerholm [EMAIL PROTECTED] wrote:
 Sorry to bother you again, Thierry, but you forgot to fix the groupId for
 the com.noelios.restlet.ext.servlet dependency. It should be

   dependency
  groupIdcom.noelios.restlet/groupId

   artifactIdcom.noelios.restlet.ext.servlet/artifactId
   version1.1-M2/version
   /dependency

 the same for 1.1-SNAPSHOT

 Thanks

 /Rasmus




 On 3/4/08, Thierry Boileau [EMAIL PROTECTED] wrote:
  Hello all,
 
  thanks for reporting these issues. The publis repository has been updated.
 
  best regards,
 
  Thierry Boileau
 
 
  On Tue, Mar 4, 2008 at 2:47 AM, Todd Nguyen [EMAIL PROTECTED] wrote:
   Got the same error after upgrading to 1.1-M2 snapshot. Can someone from
   restlet team fix the build process so it generate the correct pom.xml
 files
   for Spring?
  
   Thanks
   Todd
  
  
  
   On Mon, Mar 3, 2008 at 6:10 AM, Peter Neubauer
 [EMAIL PROTECTED]
   wrote:
Rasmus Agerholm rasmus at agerholm.org writes:
   

 HiThe pom file for the 'com.noelios.restlet.ext.spring' artifact
 found
   at the
   
   
   
'maven.restlet.org' repository,
   
  
 http://maven.restlet.org/com/noelios/restlet/com.noelios.restlet.ext.servlet/1.1-M2/com.noelios.restlet.ext.servlet-1.1-M2.pom
 defines the 'com.noelios.restlet.ext.servlet' dependency like this:
dependency
 groupIdcom.noelios.restlet.ext.servlet/groupId
artifactIdcom.noelios.restlet.ext.servlet/artifactId
  version1.1-M/version  /dependencyI believe the
   groupId
should be 'com.noelios.restlet' and the version should be '1.1-M2',
   right?The
groupId issue also goes for the 1.1-SNAPSHOT pom.Best Regards, and
 thanks
   for a
very good framework Rasmus Agerholm

   
Hi there,
another error in both 1.1-M2 and 1.1-SNAPSHOT like at
   
  
 http://maven.restlet.org/org/restlet/org.restlet.ext.spring/1.1-SNAPSHOT/org.restlet.ext.spring-1.1-SNAPSHOT.pom
is the non-replaced spring framework dependency version variable
@lib-spring-version@, resulting in non-valid deps in maven.
   
/peter
   
dependency
groupIdorg.springframework/groupId
artifactIdspring-core/artifactId
version@lib-spring-version@/version
 /dependency
 dependency
groupIdorg.springframework/groupId
artifactIdspring-context/artifactId
version@lib-spring-version@/version
 /dependency
 dependency
groupIdorg.springframework/groupId
artifactIdspring-beans/artifactId
version@lib-spring-version@/version
 /dependency
 dependency
groupIdorg.springframework/groupId
artifactIdspring-web/artifactId
version@lib-spring-version@/version
 /dependency
 dependency
groupIdorg.springframework/groupId
artifactIdspring-webmvc/artifactId
version@lib-spring-version@/version
 /dependency
   
   
   
  
  
 



 --
 MvH
 Rasmus Agerholm


snapshot releases and the maven.restlet.org repository

2008-03-04 Thread Steve Loughran
Hi

I'm just starting to build against the 1.1-SNAPSHOT code so as to get
in sync with the restlet release schedule, and I have a couple of
questions

1. how often does the snapshot get updated?

2. is it possible to tweak the settings on the site so that the
expires: header on all the -SNAPSHOT artifacts have a very short
lifespan (a few hours, maybe).

We build behind a proxy server, see, and it can pick up dated
artifacts if I'm not careful

-steve


Re: snapshot releases and the maven.restlet.org repository

2008-03-04 Thread Thierry Boileau
Hello Steve,

  1. how often does the snapshot get updated?
The public repository (http://maven.restlet.org) is updated on 1st and
15th of each month, except in cases of bug fixing.
There is also a private repository which is refreshed with new
releases at the moment they are made which mans that the snapshots are
refreshed on a daily frequency.
You can have more details about both private and public repositories
by having a look at this page
(http://www.restlet.org/downloads/maven).

  2. is it possible to tweak the settings on the site so that the
  expires: header on all the -SNAPSHOT artifacts have a very short
  lifespan (a few hours, maybe).
At this time, the expiration time is set to 10 minutes.

best regards,
Thierry Boileau

On Tue, Mar 4, 2008 at 12:56 PM, Steve Loughran
[EMAIL PROTECTED] wrote:
 Hi

  I'm just starting to build against the 1.1-SNAPSHOT code so as to get
  in sync with the restlet release schedule, and I have a couple of
  questions

  1. how often does the snapshot get updated?

  2. is it possible to tweak the settings on the site so that the
  expires: header on all the -SNAPSHOT artifacts have a very short
  lifespan (a few hours, maybe).

  We build behind a proxy server, see, and it can pick up dated
  artifacts if I'm not careful

  -steve



Re: Understanding Restlet's Threading Model?

2008-03-04 Thread John D. Mitchell
On Tue, Mar 4, 2008 at 1:52 AM, Jerome Louvel [EMAIL PROTECTED] wrote:
[...]
  Now, be aware that web browser generally serialize the request to a single
  target server/domain at least limit the number of concurrent requests sent.

Indeed.  From http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.1.4 :
Clients that use persistent connections SHOULD limit the number of
simultaneous connections that they maintain to a given server. A
single-user client SHOULD NOT maintain more than 2 connections with
any server or proxy. A proxy SHOULD use up to 2*N connections to
another server or proxy, where N is the number of simultaneously
active users. These guidelines are intended to improve HTTP response
times and avoid congestion.

Web browsers are pretty good about following that rule.

ObHack:  If you want to up that concurrency for your own site, one
trick is to use multiple names for the same underlying set of servers.
I.e., if you have lots of images on a page, spreading out the requests
across host1.example.com, host2.example.com,  allows the browsers
to issue more simultaneous requests.

Have fun,
John


Usage of the latest spring snapshot SpringApplication

2008-03-04 Thread Peter Neubauer
Hi there,
I have been using the SpringApplication and extended it to look like 

public class TestRestApplication extends SpringApplication {

public static GeneralDao dao;

public TestRestApplication(Component comp) {
super(comp);
}

public void setGeneralDao(GeneralDao dao) {
this.dao = dao;
}
}

And registered that in the Spring context.xml using 
bean id=restApplication scope=singleton
class=test.TestApplication
constructor-arg ref=restComponent /
property name=root
bean class=org.restlet.ext.spring.SpringRouter
constructor-arg ref=restApplication /
property name=attachments
map
 entry key=/v1/issue/new/ 
value=test.NewIssueResource/
/map
/property
/bean
/property
property name=generalDao ref=generalDao/
/bean

but now the super constructor seems to be private. How is this class now
supposed to be used?

Thanks for any hints

/peter



RE: Usage of the latest spring snapshot SpringApplication

2008-03-04 Thread Jerome Louvel

Hi Peter,

Thanks for reporting this bug. It is now fixed in SVN trunk.

If you can't use the trunk, just invoke the constructor with a context taken
from your component.

public TestRestApplication(Component comp) {
super(comp.getContext());
}

Best regards,
Jerome  

 -Message d'origine-
 De : news [mailto:[EMAIL PROTECTED] De la part de Peter Neubauer
 Envoyé : mardi 4 mars 2008 15:11
 À : discuss@restlet.tigris.org
 Objet : Usage of the latest spring snapshot SpringApplication
 
 Hi there,
 I have been using the SpringApplication and extended it to look like 
 
 public class TestRestApplication extends SpringApplication {
 
   public static GeneralDao dao;
 
   public TestRestApplication(Component comp) {
   super(comp);
   }
 
   public void setGeneralDao(GeneralDao dao) {
   this.dao = dao;
   }
 }
 
 And registered that in the Spring context.xml using 
 bean id=restApplication scope=singleton
   class=test.TestApplication
   constructor-arg ref=restComponent /
   property name=root
   bean 
 class=org.restlet.ext.spring.SpringRouter
   constructor-arg 
 ref=restApplication /
   property name=attachments
   map
entry 
 key=/v1/issue/new/ value=test.NewIssueResource/
   /map
   /property
   /bean
   /property
   property name=generalDao ref=generalDao/
   /bean
 
 but now the super constructor seems to be private. How is 
 this class now
 supposed to be used?
 
 Thanks for any hints
 
 /peter
 



Authentication Header

2008-03-04 Thread Jahid
Hi,

On server side, I am trying to set a header which will look like this 

ABC realm=, challenge-container=salkfadfo823w9283oinfskefn2398wenfdsk;

Can anyone tell me how can I achieve that? Here I want to mention that, I
dont/can't change the challenge format. So, don't ask me to do that :), also i
want the challenge to go on server side as WWW-Authenticate header with a
status code 201.

Thanks in advance.

Regards,
Jahid



Re: Understanding Restlet's Threading Model?

2008-03-04 Thread Aaron Crow
Hi Rob,

Thank you for your reply. I believe the connector I'm using is the Simple one, 
since I've put com.noelios.restlet.ext.simple as a dependency in my Maven 
project and I don't believe I'm including any other connectors on the class 
path. Is there a good way to do a sanity check on this? Also, any good rules of 
thumb to use when evaluating the different connectors? (In my situation, I 
actually have full control over the clients that will be hitting me, so maybe 
that's an important factor?)

Thanks again to everyone for the help!
Aaron

  Rob Heittman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]

  The mapping of incoming network connections to threads is very dependent on 
the HTTP/HTTPS connector/server in use.  Restlet, as far as I know, does not do 
anything to attenuate the native behavior of the server with regard to creating 
threads for incoming network connections.  Which server environment were you 
looking at when you tested?


  On Mon, Mar 3, 2008 at 2:43 PM, Aaron Crow [EMAIL PROTECTED] wrote:

I'd like to understand the threading model used by my basic Restlet app. I
have a standalone app that uses Application and Component, and attaches
subclasses of Restlet to the router. I am using the reference implementation
provided by noelios. (Many, many thanks to Jerome for all of this!)


Re: Authentication Header

2008-03-04 Thread Rhett Sutphin

Hi,

On Mar 4, 2008, at 9:59 AM, Jahid wrote:

On server side, I am trying to set a header which will look like  
this 


ABC realm=, challenge- 
container=salkfadfo823w9283oinfskefn2398wenfdsk;


Can anyone tell me how can I achieve that? Here I want to mention  
that, I
dont/can't change the challenge format. So, don't ask me to do  
that :), also i
want the challenge to go on server side as WWW-Authenticate header  
with a

status code 201.



I'm not sure (I haven't tried it yet myself), but I think that you  
create a ChallengeRequest object and set it in the Response.  In 1.1- 
M2, it seems like one way to do this would be by extending Guard and  
overriding the challenge method.  If you are using the reference  
engine implementation (NRE), you could also implement  
com.noelios.restlet.authentication.AuthenticationHelper and register  
your implementation using Engine#registerAuthentication.


N.b.: like I said before, I haven't tried any of this myself yet.  I  
just happen to be looking into implementing a custom authentication  
scheme today.


Rhett




AWS auth in 1.1-SNAPSHOT

2008-03-04 Thread Steve Loughran
Is there any particular reason why I'm not allowed to use the AWS auth
scheme in the 1.1-SNAPSHOT up on the repository?

[sf-startdaemon-debug] INFO: Error while handling an HTTP client call
[sf-startdaemon-debug] java.lang.IllegalArgumentException: Challenge
scheme HTTP_AWS not supported by the Restlet engine.
[sf-startdaemon-debug]  at
com.noelios.restlet.util.AuthenticationUtils.format(AuthenticationUtils.java:183)
[sf-startdaemon-debug]  at
com.noelios.restlet.http.HttpClientConverter.addRequestHeaders(HttpClientConverter.java:349)
[sf-startdaemon-debug]  at
com.noelios.restlet.http.HttpClientConverter.toSpecific(HttpClientConverter.java:79)
[sf-startdaemon-debug]  at
com.noelios.restlet.http.HttpClientHelper.handle(HttpClientHelper.java:78)
[sf-startdaemon-debug]  at
org.smartfrog.services.restlet.overrides.ProxyEnabledClient.handle(ProxyEnabledClient.java:106)


setting a status description never shows up in the response?

2008-03-04 Thread Jeff Brekke
We are using 1.0.8 and setting a status description in a response.  If we use
the jetty or the servlet connector, our description is not passed along, but the
default is.  For example, if we change the 404 description in the response
status, it still says Not Found as the decription.  But, if we use the Simple
connector, it works as expected.  We've looked through the list, but haven't
seen any issues related lately ( there was a post about the servlet connector
back in 2006 v1.0.5 ).

Is there a known issue ( we tried 1.1M2 as well, same results )?



Authentication: multiple challenges?

2008-03-04 Thread Rhett Sutphin

Hi,

According to RFC2616 section 14.47, it should be possible to have  
multiple challenges in a WWW-Authenticate header.  I can't see a way  
to achieve that with Restlet.  Is there a way?


Context:  I'm trying to protect a collection of resources with both  
HTTP Basic and a custom token-based authentication scheme.  If it's  
not possible to have multiple challenges, I'll just challenge with  
Basic and then accept either form.


Thanks,
Rhett


How to use JSONP in Restlet?

2008-03-04 Thread cleverpig
Query 1.2 introduced JSONP support, but on initial read of the release
notes, I wasn't completely sure what it was - so for anyone else that
might want the Dr Seuss explanation.JSONP is script tag injection,
passing the response from the server in to a user specified function.
Anyone use JSONP with Restlet's json ext or anther way?


-- 
cleverpig
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
Phone: 010-66415588-1113
MSN: [EMAIL PROTECTED]
QQ: 149291732
Skype: cleverpigatmatrix
My Facebook ID:cleverpig
My Blog: www.morpheus.org.cn
My Tags: del.icio.us/cleverpig
My Twitter: twitter.com/cleverpig
My Organization: www.beijing-open-party.org
一些值得关注的唧歪:
  http://jiwai.de/t/jmatrix/
  http://jiwai.de/t/db4o/
  http://jiwai.de/t/matrix-community/


Reference and reference list

2008-03-04 Thread Leshek
I am looking for reference and reference list guidance, examples ( I think).

At the first level of my service my URI pattern is simply AT the root my 
service is simply /{type};

In the root of my service I just started creating I would like to return a 
list of links to all available types. I would like the list to have a title 
and each link to have some descriptive label.  I will need to do it in html 
and xml, but lets concentrate on html.  Before starting to craft my HTML and 
XML by hand I looked around and looks to me ReferenceList is a good 
candidate to help.

So in my Resource.represent I do something like:
ReferenceList rl = new ReferenceList();
for (int i = 0; i  supportedTypes.length; i++) {
Reference url = new Reference(getRequest().getRootRef());
url.addSegment(supportedTypes[i]);
   rl.add(url);
}
return rl.getWebRepresentation();

Any hints, example or doc pointes would be highly appreciated.  I tried, but 
I think I do not understand the concepts I am dealing with.

I would like to make it more informative, with the page title (instead of 
List of references), labels, the text for each  URI, instead of dry URI.

Here is what I get now:

List of references
http://localhost:9080/myrest/Type1
http://localhost:9080/myrest/Type2
...


I would like to get at least:

List of links for lists of items of a specific type
Type1
Type2
...


With URIs in the source.