Restlet, Tomcat and lost body of POST request ...

2009-10-05 Thread Eugene Batogov
Hello all !
We are using Restlet in our product.
Thank you very match for excellent framework!

But lately we met one distasteful problem.

Our  environment:
-
OS:  RHEL 5  (x86 or x86-64 platform);
JVM: Oracle BEA JRockit 1.6  and SUN JDK 1.6.0_14;
AppServer:  JBoss-4.2.2.GA with Tomcat-6.0.13 inside (a.k.a JBossWeb);
Libraries versions:
   - Restlet: 2.0-M3;
   - Spring: 2.5.6;
   - AspectJ: 1.6.4;
-
This problem in Tomcat bugzilla:
https://issues.apache.org/bugzilla/show_bug.cgi?id=47797

This problem in JBossWeb forum:
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=161900

This problem at coderanch:
http://www.coderanch.com/t/464693/Tomcat/body-request-lost-when-you#2076125
--


The problem is that sometimes gets lost body POST request. Possible cause 
specified in the tomcat bugzilla. 
I have assumed that Restlet can somehow indirectly affect the appearance of 
this error.



As you understand from the error message, I'm testing a simple servlet, which 
is a loss of body and POST request.
But, when I just run TestNG test using HttpClient, I have no error occurs. But 
at the same Tomcat deployed our system on the Restlet. 
And when using the Grinder, I load it, the loss of POST requests starts to 
happen more often!? 

Question: Can Restlet in any way affect the other application and Tomcat to 
work as a whole? 

Thanks in advance for help. 


-- 
Best Regards, Eugene Batogov
___

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

RE: Restlet GWT: Problem with HTTP POST request in Firefox

2009-10-05 Thread webpost
Hi, 

  I'm using Restlet 2.0 M5, and also tried with the Restlet 2.0 snapshot and 
I've the same problem, Firebug shows that it calls the OPTIONS method instead 
of POST when using compiled mode in Firefox. Any ideas? This should be fixed on 
M5? 

  Thanks!

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


RE: HTTP/1.x 405

2009-10-05 Thread webpost
Hello Jerome,

I seem to be experiencing the same behavior that is described in this post 
while using 2.0m5.  Is this expected?  Based on the changelogs it seems like 
this should be corrected.  Perhaps this is a slightly different scenario.  I 
have a ServerResource (source code below) where the first retrieval works but 
the subsequent one fails with a 405.  The HTTP communications look like this:

--

GET /widget/app/view/HELLO/time.html HTTP/1.1

Host: 

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.19) 
Gecko/20081216 Fedora/2.0.0.19-1.fc8 Firefox/2.0.0.19

Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Connection: keep-alive



HTTP/1.x 200 OK

Server: Apache-Coyote/1.1, Restlet-Framework/2.0m5

Cache-Control: public, max-age=300

Expires: Mon, 05 Oct 2009 18:45:44 GMT

Last-Modified: Mon, 05 Oct 2009 18:40:44 GMT

Date: Mon, 05 Oct 2009 18:40:44 GMT

Accept-Ranges: bytes

Content-Type: text/html;charset=ISO-8859-1

Content-Length: 386

--

GET /widget/app/view/HELLO/time.html HTTP/1.1

Host: 

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.19) 
Gecko/20081216 Fedora/2.0.0.19-1.fc8 Firefox/2.0.0.19

Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Connection: keep-alive

If-Modified-Since: Mon, 05 Oct 2009 18:40:44 GMT

Cache-Control: max-age=0



HTTP/1.x 405 The method specified in the request is not allowed for the 
resource identified by the request URI

Server: Apache-Coyote/1.1, Restlet-Framework/2.0m5

Date: Mon, 05 Oct 2009 18:40:54 GMT

Accept-Ranges: bytes

Content-Type: text/html;charset=utf-8

Content-Length: 1271

--


And the restlets-generated logs look like this:

2009-10-05 13:40:44 11 INFOorg.restlet.engine.log.LogFilter.afterHandle: 
2009-10-05 13:40:44172.29.66.36-   172.29.66.368080GET  
   /widget/app/view/HELLO/time.html-
   200 386 -   2 Mozilla/5.0 (X11; U; Linux 
x86_64; en-US; rv:1.8.1.19) Gecko/20081216 Fedora/2.0.0.19-1.fc8 
Firefox/2.0.0.19-
2009-10-05 13:40:54 11 INFOorg.restlet.engine.log.LogFilter.afterHandle: 
2009-10-05 13:40:54172.29.66.36-   172.29.66.368080GET  
   /widget/app/view/HELLO/time.html-
   405 0   -   3 Mozilla/5.0 (X11; U; Linux 
x86_64; en-US; rv:1.8.1.19) Gecko/20081216 Fedora/2.0.0.19-1.fc8 
Firefox/2.0.0.19-


The test class in question is something like this:

public class TimeResource extends ServerResource {

protected Representation get() throws ResourceException {
Date now = new Date();

Representation r = new StringRepresentation("...", 
MediaType.TEXT_HTML);

Calendar cal = Calendar.getInstance();
cal.setTime(now);
cal.add(Calendar.MINUTE, 5);
r.setExpirationDate(cal.getTime());

r.setModificationDate(now);

HttpResponse response = (HttpResponse) getResponse();
Series headers = 
response.getHttpCall().getResponseHeaders();
headers.add("Cache-Control", "public, max-age=300");

return r;
}

}

Does anyone have any thoughts on this?  Thanks!

Best regards,
Eli

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


2.0 Server, Finder, etc. documentation

2009-10-05 Thread Patrick Logan
I am sure I only understand the bare minimum of setting up a Server with 
ServerResources, etc. The doc that gets into this mostly is in Finder from what 
I have seen. i.e. there's not much in Server that indicates how the Class 
constructor argument will be used. The tutorial makes clear it can be a 
ServerResource subclass.

Is this better explained anywhere? And/or the other constructors for Server?

I'd be happy to write up what little I know and submit (e.g. on the wiki?) it 
if there is a need.

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


RE: OPTIONS instead of POST on GWT

2009-10-05 Thread Daniel Bell
I had the same problem. We actually ended up using the GWT request builder 
instead, and created new Methods for it (PUT and DELETE) to use with our 
Restlet on the server.

-Original Message-
From: webp...@tigris.org [mailto:webp...@tigris.org]
Sent: Monday, 5 October 2009 8:25 PM
To: discuss@restlet.tigris.org
Subject: OPTIONS instead of POST on GWT

Hi,

   I'm a new user of Restlet. I want to call from a GWT client a REST service 
running on GAE. This is my client code:

Client client = new Client(Protocol.HTTP);
client.post("http://localhost:4040/ping";, 
getXMLCourseRepresentation(),new Uniform() {
@Override
public void handle(Request request, Response response,  
Uniform callback) {
}
});

I'm doing a local test and I'm running the client on tomcat and the GAE server 
on hosted mode. I don't understand why using the post method from the client 
always call the HTTP OPTIONS method and not the POST.

Any clue? I'm begining to get desperate...

Thanks

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

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


TemplateFilter with Restlet

2009-10-05 Thread webpost
Hello,

I am looking for an example for using the TemplateFilter class of freemarker 
extension. If someone has a such example, it will great for me

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


Re: Unable to setup SpringBeanRouter configure

2009-10-05 Thread infinity
Works with 2.0M5. Thanks


Pritam wrote:
> 
> I'm using 2.0M4, will try 2.0M5. Can you point out the file in which this
> bug was fixed so that I could test in the interim?
> 
> (I'm using Nabble and I assume the "reply" does go the mailing list)
> 
> 
> Rhett Sutphin wrote:
>> 
>> Hi,
>> 
>> On Oct 5, 2009, at 12:03 PM, infinity wrote:
>> 
>>> Hi Rhett,
>>>
>>>
>>> Rhett Sutphin wrote:

 This mapping combined with the URIs in your resource beans means that
 your server should respond to

 http://servername:port/ws/ws/contact/{operation}
 http://servername:port/ws/mock/1/data/Contact/{userId}
 http://servername:port/mock/ws/contact/{operation}
 http://servername:port/mock/mock/1/data/Contact/{userId}

 I'm guessing that's not what you want.  Router attachment URIs
 (whether you use SpringRouter, SpringBeanRouter, or something else)
 are relative to the attachment point of the router.

 Rhett


>>>
>>> I think you're mistaken. Did you look at the updated configuration  
>>> in the
>>> parent post? I have the same configuration working for singleton beans
>>> (entry key ).
>> 
>> This is a mailing list.  If you want your changes to be seen by  
>> everyone, you need to send a new message.
>> 
>>> For a prototype bean,
>>> >> class="com.xxx.yyy.rest.resource.ContactData" scope="prototype"
>>> autowire="byName"/>
>>>
>>> with a router prepending a /ws, I would expect
>>> http://servername:port/appname/ws/contact/{operation}
>>>
>>> But it doesn't work. I get the following warning in the log, if that  
>>> helps.
>>>
>>> Oct 5, 2009 12:21:27 PM org.restlet.resource.Finder handle
>>> WARNING: No target class was defined for this finder:
>>> org.restlet.ext.spring.springbeanfin...@c7afdd
>>> Oct 5, 2009 12:21:27 PM org.restlet.engine.log.LogFilter afterHandle
>> 
>> Are you using 2.0-M5?  This was a bug in 2.0-M4, but it should be  
>> fixed now.  If not, could you build a minimal reproduceable test case  
>> and file a bug?
>> 
>> Thanks,
>> Rhett
>> 
>>> -- 
>>> View this message in context:
>>> http://n2.nabble.com/Unable-to-setup-SpringBeanRouter-confiiguration-with-VirtualHost-tp3769405p3770177.html
>>> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>>>
>>> --
>>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2403811
>> 
>> --
>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2403814
>> 
>> 
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Unable-to-setup-SpringBeanRouter-confiiguration-with-VirtualHost-tp3769405p3771459.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: Unable to setup SpringBeanRouter configure

2009-10-05 Thread infinity
I'm using 2.0M4, will try 2.0M5. Can you point out the file in which this bug
was fixed so that I could test in the interim?

(I'm using Nabble and I assume the "reply" does go the mailing list)


Rhett Sutphin wrote:
> 
> Hi,
> 
> On Oct 5, 2009, at 12:03 PM, infinity wrote:
> 
>> Hi Rhett,
>>
>>
>> Rhett Sutphin wrote:
>>>
>>> This mapping combined with the URIs in your resource beans means that
>>> your server should respond to
>>>
>>> http://servername:port/ws/ws/contact/{operation}
>>> http://servername:port/ws/mock/1/data/Contact/{userId}
>>> http://servername:port/mock/ws/contact/{operation}
>>> http://servername:port/mock/mock/1/data/Contact/{userId}
>>>
>>> I'm guessing that's not what you want.  Router attachment URIs
>>> (whether you use SpringRouter, SpringBeanRouter, or something else)
>>> are relative to the attachment point of the router.
>>>
>>> Rhett
>>>
>>>
>>
>> I think you're mistaken. Did you look at the updated configuration  
>> in the
>> parent post? I have the same configuration working for singleton beans
>> (entry key ).
> 
> This is a mailing list.  If you want your changes to be seen by  
> everyone, you need to send a new message.
> 
>> For a prototype bean,
>> > class="com.xxx.yyy.rest.resource.ContactData" scope="prototype"
>> autowire="byName"/>
>>
>> with a router prepending a /ws, I would expect
>> http://servername:port/appname/ws/contact/{operation}
>>
>> But it doesn't work. I get the following warning in the log, if that  
>> helps.
>>
>> Oct 5, 2009 12:21:27 PM org.restlet.resource.Finder handle
>> WARNING: No target class was defined for this finder:
>> org.restlet.ext.spring.springbeanfin...@c7afdd
>> Oct 5, 2009 12:21:27 PM org.restlet.engine.log.LogFilter afterHandle
> 
> Are you using 2.0-M5?  This was a bug in 2.0-M4, but it should be  
> fixed now.  If not, could you build a minimal reproduceable test case  
> and file a bug?
> 
> Thanks,
> Rhett
> 
>> -- 
>> View this message in context:
>> http://n2.nabble.com/Unable-to-setup-SpringBeanRouter-confiiguration-with-VirtualHost-tp3769405p3770177.html
>> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>>
>> --
>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2403811
> 
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2403814
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Unable-to-setup-SpringBeanRouter-confiiguration-with-VirtualHost-tp3769405p3770255.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: Unable to setup SpringBeanRouter configure

2009-10-05 Thread Rhett Sutphin
Hi,

On Oct 5, 2009, at 12:03 PM, infinity wrote:

> Hi Rhett,
>
>
> Rhett Sutphin wrote:
>>
>> This mapping combined with the URIs in your resource beans means that
>> your server should respond to
>>
>> http://servername:port/ws/ws/contact/{operation}
>> http://servername:port/ws/mock/1/data/Contact/{userId}
>> http://servername:port/mock/ws/contact/{operation}
>> http://servername:port/mock/mock/1/data/Contact/{userId}
>>
>> I'm guessing that's not what you want.  Router attachment URIs
>> (whether you use SpringRouter, SpringBeanRouter, or something else)
>> are relative to the attachment point of the router.
>>
>> Rhett
>>
>>
>
> I think you're mistaken. Did you look at the updated configuration  
> in the
> parent post? I have the same configuration working for singleton beans
> (entry key ).

This is a mailing list.  If you want your changes to be seen by  
everyone, you need to send a new message.

> For a prototype bean,
>  class="com.xxx.yyy.rest.resource.ContactData" scope="prototype"
> autowire="byName"/>
>
> with a router prepending a /ws, I would expect
> http://servername:port/appname/ws/contact/{operation}
>
> But it doesn't work. I get the following warning in the log, if that  
> helps.
>
> Oct 5, 2009 12:21:27 PM org.restlet.resource.Finder handle
> WARNING: No target class was defined for this finder:
> org.restlet.ext.spring.springbeanfin...@c7afdd
> Oct 5, 2009 12:21:27 PM org.restlet.engine.log.LogFilter afterHandle

Are you using 2.0-M5?  This was a bug in 2.0-M4, but it should be  
fixed now.  If not, could you build a minimal reproduceable test case  
and file a bug?

Thanks,
Rhett

> -- 
> View this message in context: 
> http://n2.nabble.com/Unable-to-setup-SpringBeanRouter-confiiguration-with-VirtualHost-tp3769405p3770177.html
> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2403811

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


Re: Unable to setup SpringBeanRouter configure

2009-10-05 Thread infinity
Hi Rhett,


Rhett Sutphin wrote:
> 
> This mapping combined with the URIs in your resource beans means that  
> your server should respond to
> 
> http://servername:port/ws/ws/contact/{operation}
> http://servername:port/ws/mock/1/data/Contact/{userId}
> http://servername:port/mock/ws/contact/{operation}
> http://servername:port/mock/mock/1/data/Contact/{userId}
> 
> I'm guessing that's not what you want.  Router attachment URIs  
> (whether you use SpringRouter, SpringBeanRouter, or something else)  
> are relative to the attachment point of the router.
> 
> Rhett
> 
> 

I think you're mistaken. Did you look at the updated configuration in the
parent post? I have the same configuration working for singleton beans
(entry key ). 

For a prototype bean, 

  
with a router prepending a /ws, I would expect
http://servername:port/appname/ws/contact/{operation}

But it doesn't work. I get the following warning in the log, if that helps.

Oct 5, 2009 12:21:27 PM org.restlet.resource.Finder handle
WARNING: No target class was defined for this finder:
org.restlet.ext.spring.springbeanfin...@c7afdd
Oct 5, 2009 12:21:27 PM org.restlet.engine.log.LogFilter afterHandle
-- 
View this message in context: 
http://n2.nabble.com/Unable-to-setup-SpringBeanRouter-confiiguration-with-VirtualHost-tp3769405p3770177.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: Unable to setup SpringBeanRouter configure

2009-10-05 Thread Rhett Sutphin
Hi Infinity,

On Oct 5, 2009, at 11:25 AM, infinity wrote:

> Rhett,
>
> Spring context loaded in web.xml (tomcat) via context params
>
> 
> 
>   restletServlet
>   org.restlet.ext.spring.SpringServerServlet class>
> 
> 
>   restletServlet
>   /ws/*
>   /mock/*
> 

This mapping combined with the URIs in your resource beans means that  
your server should respond to

http://servername:port/ws/ws/contact/{operation}
http://servername:port/ws/mock/1/data/Contact/{userId}
http://servername:port/mock/ws/contact/{operation}
http://servername:port/mock/mock/1/data/Contact/{userId}

I'm guessing that's not what you want.  Router attachment URIs  
(whether you use SpringRouter, SpringBeanRouter, or something else)  
are relative to the attachment point of the router.

Rhett

>
> 
>
> 
>   
>   Comma separated list of Spring context configuration files.
>   
>   contextConfigLocation
>   
>   /WEB-INF/spring/spring-core.xml,
>   /WEB-INF/spring/spring-mail.xml,
>   /WEB-INF/spring/spring-restlet.xml,
>
> 
>
> 
>   
>Spring bean name that inherits from Component. It is used to  
> instantiate
> and attach
>the described component, contained applications and connectors 
>  
> (Used by
> org.restlet.ext.spring.SpringServerServlet)
>   
>   org.restlet.component
>   
>   component
>   
> 
>
>
> Btw, I corrected the virtual host configuration from the parent  
> post. pl
> refer the same.
>
>
>
> Rhett Sutphin wrote:
>>
>> Hi Infinity,
>>
>> On Oct 5, 2009, at 10:03 AM, infinity wrote:
>>
>>> I'm trying to setup a SpringBeanRouter as per the javadocs since I
>>> cannot use
>>> SpringRouter if I use spring prototype beans for attachements acc to
>>> this
>>> http://n2.nabble.com/Unable-to-inject-Protoype-beans-into-a-singleton-bean-via-value-ref-for-a-Spring-Router-td3756435.html#a3756435
>>> issue .
>>>
>>> Is there something wrong with the following configuration?
>>>
>>> 
>>> http://www.springframework.org/schema/beans";
>>>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>> xmlns:util="http://www.springframework.org/schema/util";
>>>   xsi:schemaLocation="http://www.springframework.org/schema/beans
>>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd";>
>>>
>>>   
>>>   >> class="org.restlet.ext.spring.SpringComponent">
>>>   
>>>   
>>>  HTTP, HTTPS
>>>   
>>>
>>>   
>>>   
>>>   
>>>   
>>>   
>>>
>>>   
>>>
>>>   
>>>   
>>>   
>>>   
>>>   
>>>   
>>>   
>>>   
>>>   
>>>
>>>   
>>>   >> class="org.restlet.ext.spring.SpringBeanRouter"/>
>>>
>>>   
>>>>> class="com.xx.rest.resource.ContactData" scope="prototype"
>>> autowire="byName"/>
>>>   >> class="com.xxx.mock.resource.ContactData" scope="prototype"
>>> autowire="byName"/>
>>>
>>> The server loads fine but none of Server Resources are invoked.
>>> There is no
>>> stacktrace either. Pl suggest.
>>
>> What sort of server are you using?  How are you loading the beans  
>> from
>> this context and attaching them to the server?
>>
>> Rhett
>>
>>>
>>> 
>>> -- 
>>> View this message in context:
>>> http://n2.nabble.com/Unable-to-setup-SpringBeanRouter-configure-tp3769405p3769405.html
>>> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>>>
>>> --
>>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2403701
>>
>> --
>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2403785
>>
>>
>
> -- 
> View this message in context: 
> http://n2.nabble.com/Unable-to-setup-SpringBeanRouter-confiiguration-with-VirtualHost-tp3769405p3769937.html
> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2403797

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


Re: Unable to setup SpringBeanRouter configure

2009-10-05 Thread infinity
Rhett,

Spring context loaded in web.xml (tomcat) via context params



restletServlet

org.restlet.ext.spring.SpringServerServlet   



restletServlet
/ws/*
/mock/*






Comma separated list of Spring context configuration files.

contextConfigLocation

/WEB-INF/spring/spring-core.xml,
/WEB-INF/spring/spring-mail.xml,
/WEB-INF/spring/spring-restlet.xml,





 Spring bean name that inherits from Component. It is used to 
instantiate
and attach
 the described component, contained applications and connectors 
(Used by
org.restlet.ext.spring.SpringServerServlet)

org.restlet.component

component




Btw, I corrected the virtual host configuration from the parent post. pl
refer the same. 



Rhett Sutphin wrote:
> 
> Hi Infinity,
> 
> On Oct 5, 2009, at 10:03 AM, infinity wrote:
> 
>> I'm trying to setup a SpringBeanRouter as per the javadocs since I  
>> cannot use
>> SpringRouter if I use spring prototype beans for attachements acc to  
>> this
>> http://n2.nabble.com/Unable-to-inject-Protoype-beans-into-a-singleton-bean-via-value-ref-for-a-Spring-Router-td3756435.html#a3756435
>> issue .
>>
>> Is there something wrong with the following configuration?
>>
>> 
>> http://www.springframework.org/schema/beans";
>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>> xmlns:util="http://www.springframework.org/schema/util";
>>xsi:schemaLocation="http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd";>
>>
>>
>>> class="org.restlet.ext.spring.SpringComponent">
>>
>>
>>   HTTP, HTTPS
>>
>> 
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> class="org.restlet.ext.spring.SpringBeanRouter"/>
>>
>>
>> > class="com.xx.rest.resource.ContactData" scope="prototype"
>> autowire="byName"/>
>>> class="com.xxx.mock.resource.ContactData" scope="prototype"
>> autowire="byName"/>
>>
>> The server loads fine but none of Server Resources are invoked.  
>> There is no
>> stacktrace either. Pl suggest.
> 
> What sort of server are you using?  How are you loading the beans from  
> this context and attaching them to the server?
> 
> Rhett
> 
>>
>> 
>> -- 
>> View this message in context:
>> http://n2.nabble.com/Unable-to-setup-SpringBeanRouter-configure-tp3769405p3769405.html
>> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>>
>> --
>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2403701
> 
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2403785
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Unable-to-setup-SpringBeanRouter-confiiguration-with-VirtualHost-tp3769405p3769937.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: Unable to setup SpringBeanRouter configure

2009-10-05 Thread Rhett Sutphin
Hi Infinity,

On Oct 5, 2009, at 10:03 AM, infinity wrote:

> I'm trying to setup a SpringBeanRouter as per the javadocs since I  
> cannot use
> SpringRouter if I use spring prototype beans for attachements acc to  
> this
> http://n2.nabble.com/Unable-to-inject-Protoype-beans-into-a-singleton-bean-via-value-ref-for-a-Spring-Router-td3756435.html#a3756435
> issue .
>
> Is there something wrong with the following configuration?
>
> 
> http://www.springframework.org/schema/beans";
>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:util="http://www.springframework.org/schema/util";
>xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd";>
>
>
> class="org.restlet.ext.spring.SpringComponent">
>
>
>   HTTP, HTTPS
>
> 
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> class="org.restlet.ext.spring.SpringBeanRouter"/>
>
>
>  class="com.xx.rest.resource.ContactData" scope="prototype"
> autowire="byName"/>
> class="com.xxx.mock.resource.ContactData" scope="prototype"
> autowire="byName"/>
>
> The server loads fine but none of Server Resources are invoked.  
> There is no
> stacktrace either. Pl suggest.

What sort of server are you using?  How are you loading the beans from  
this context and attaching them to the server?

Rhett

>
> 
> -- 
> View this message in context: 
> http://n2.nabble.com/Unable-to-setup-SpringBeanRouter-configure-tp3769405p3769405.html
> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2403701

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


Re: Unable to inject Protoype beans into a singleton bean via for a Spring Router

2009-10-05 Thread Rhett Sutphin
Hi Infinity,

On Oct 5, 2009, at 9:58 AM, infinity wrote:

> Looking at the code in SpringRouter.setAttachments(), it looks like  
> the
> default implementation can not handle prototype spring beans.

SpringRouter can't directly handle spring-configured resource  
instances.  You want either SpringBeanRouter or SpringRouter +  
SpringBeanFinders.

Rhett

>
> if (value instanceof Restlet) {
>router.attach(key, (Restlet) value);
> } else if (value instanceof Class) {
>router.attach(key, (Class) value);
> } else if (value instanceof String) {
> resourceClass = Engine.loadClass((String) value);
>
>if (org.restlet.resource.Resource.class
>   .isAssignableFrom(resourceClass)) {
>   router.attach(key, resourceClass);
>} else if (org.restlet.resource.ServerResource.class
>   .isAssignableFrom(resourceClass)) {
>   router.attach(key, resourceClass);
>} else {
>   router
>   .getLogger().warning("Unknown class found in the mappings. Only 
>  
> subclasses
> of
> org.restlet.resource.Resource and ServerResource are  
> allowed.");
>}
> }
>
> So, I get a warning since the "value" returned here is an instance of
> ServerResource.
>
> I think this should be a bug or clearly documented as not being able  
> to
> handle spring prototype beans for BaseServer Resources unless I'm  
> missing
> something here
>
>
>
>
>
>
>
> Pritam wrote:
>>
>> I'm using Restlet spring ext to configure routers
>>
>> 
>>
>>
>>
>>
>>
>>
>> 
>>
>> 
>>
>>
>>> value-ref="contact" />
>>
>>
>> 
>>
>> 
>>
>>
>> "contact" bean is not being injected in the SpringRouter if I use a
>> value-ref for some reason. Is this because the bean is a prototype?
>> Strangely,  works for VirtualHost where wsRouter is  
>> injected,
>> but it's a singleton bean.
>>
>> Using  instead works too
>>
>> 
>>
>> Any suggestions?
>>
>
> -- 
> View this message in context: 
> http://n2.nabble.com/Unable-to-inject-Protoype-beans-into-a-singleton-bean-via-value-ref-for-a-Spring-Router-tp3756435p3769372.html
> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2403696

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


Unable to setup SpringBeanRouter configure

2009-10-05 Thread infinity
I'm trying to setup a SpringBeanRouter as per the javadocs since I cannot use
SpringRouter if I use spring prototype beans for attachements acc to this 
http://n2.nabble.com/Unable-to-inject-Protoype-beans-into-a-singleton-bean-via-value-ref-for-a-Spring-Router-td3756435.html#a3756435
issue . 

Is there something wrong with the following configuration?


http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:util="http://www.springframework.org/schema/util";
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd";>





   HTTP, HTTPS

 





















   



The server loads fine but none of Server Resources are invoked. There is no
stacktrace either. Pl suggest.


-- 
View this message in context: 
http://n2.nabble.com/Unable-to-setup-SpringBeanRouter-configure-tp3769405p3769405.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: Unable to inject Protoype beans into a singleton bean via for a Spring Router

2009-10-05 Thread infinity
Looking at the code in SpringRouter.setAttachments(), it looks like the
default implementation can not handle prototype spring beans.

if (value instanceof Restlet) {
router.attach(key, (Restlet) value);
} else if (value instanceof Class) {
router.attach(key, (Class) value);
} else if (value instanceof String) {
 resourceClass = Engine.loadClass((String) value);

if (org.restlet.resource.Resource.class
.isAssignableFrom(resourceClass)) {
router.attach(key, resourceClass);
} else if (org.restlet.resource.ServerResource.class
.isAssignableFrom(resourceClass)) {
router.attach(key, resourceClass);
} else {
router
.getLogger().warning("Unknown class found in the mappings. Only 
subclasses
of
 org.restlet.resource.Resource and ServerResource are allowed.");
}
}

So, I get a warning since the "value" returned here is an instance of
ServerResource.

I think this should be a bug or clearly documented as not being able to
handle spring prototype beans for BaseServer Resources unless I'm missing
something here







Pritam wrote:
> 
> I'm using Restlet spring ext to configure routers
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  value-ref="contact" />
> 
> 
> 
> 
> 
> 
> 
> "contact" bean is not being injected in the SpringRouter if I use a
> value-ref for some reason. Is this because the bean is a prototype?
> Strangely,  works for VirtualHost where wsRouter is injected,
> but it's a singleton bean.
> 
> Using  instead works too
> 
> 
> 
> Any suggestions?
> 

-- 
View this message in context: 
http://n2.nabble.com/Unable-to-inject-Protoype-beans-into-a-singleton-bean-via-value-ref-for-a-Spring-Router-tp3756435p3769372.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: automated conversion from java object to json

2009-10-05 Thread Laurent Rustuel
Hello Jerome,
Jerome Louvel a écrit :
> Hi Laurent,
> 
> In order to have this automatic conversion to XML or JSON happen, you need
> to add the "org.restlet.ext.xstream.jar" and *all* its dependencies in your
> classpath, including Jettison. The Restlet engine should detect it and
> leverage it to convert your Profile objects in both directions, from JSON or
> to JSON.
Thank you, this was missing, the Jettison dependency, everything seems 
to work fine.

Regards,
Laurent.

-- 
Laurent Rustuel,
Alten contractor for Genesys, an Alcatel-Lucent Company

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


Unable to inject bean in a Spring Router

2009-10-05 Thread infinity
I have the following spring beans configured in a context file





















my "contact" bean is not being injected in the SpringRouter if I use a
value-ref for some reason. It does work for a  configuration though:



Any suggestions?
-- 
View this message in context: 
http://n2.nabble.com/Unable-to-inject-bean-value-ref-in-a-Spring-Router-tp3756435p3756435.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


OPTIONS instead of POST on GWT

2009-10-05 Thread webpost
Hi, 

   I'm a new user of Restlet. I want to call from a GWT client a REST service 
running on GAE. This is my client code:

Client client = new Client(Protocol.HTTP);
client.post("http://localhost:4040/ping";, 
getXMLCourseRepresentation(),new Uniform() {
@Override
public void handle(Request request, Response response,  
Uniform callback) {
}
});

I'm doing a local test and I'm running the client on tomcat and the GAE server 
on hosted mode. I don't understand why using the post method from the client 
always call the HTTP OPTIONS method and not the POST. 

Any clue? I'm begining to get desperate...

Thanks

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