Re: SpringBeanRouter

2009-04-14 Thread Jim Alateras
Rhett,

Thanks for the quick turnaround and suggestions


On 14/04/2009, at 2:19 PM, Rhett Sutphin wrote:

 Hi Jim,

 On Apr 13, 2009, at 7:56 PM, Jim Alateras wrote:

 I am currently using s custom class to attach routes to  a router but
 am now looking at using the SpringBeanRouter but have a couple of
 questions.

 1.  In the example below if i also want to support the a query string
 would i change the bean name to  /studies?{query}

 You should set the bean name to whatever you were formerly passing to
 Router#attach.
At the moment my custom class does something like this

router.attach(/resource?{query}, this.resourceMap.get(uri))

.getTemplate().getVariables().put(query, new Variable(

Variable.TYPE_URI_QUERY, , false, false));

will this still work?


 2. How do i specify a default route for the router.

 This isn't directly supported at the moment.  The easiest thing to do
 right now is to subclass SpringBeanRouter and override
 postProcessBeanFactory something like this:

 @Override
 public void postProcessBeanFactory(ConfigurableListableBeanFactory
 factory) {
   super.postProcessBeanFactory(factory);
   this.attachDefault(createFinder(theDefaultResourceBeanName))
 }

excellent
 Rhett

 beans .. 
  bean name=router class=org.restlet.ext.spring.BeanNameRouter/
  bean name=/studies id=studiesResource autowire=byName
 scope=prototype class=edu.northwestern.myapp.StudiesResource 
 /beans

 cheers
 /jima

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

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


cheers
/jima

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


Re: firstResource example problem

2009-04-14 Thread Thierry Boileau
Hello hudarsono and hnilsen,

as said by hnilsen (and the firstSteps tutorial), the 3 mentionned jars 
must be added the the directory of librairies. We can be more precise 
and refer to /WEB-INF/lib.
Docs are updated.

Best regards,
Thierry Boileau

 Dear all,

 I just starting to learn restlet, and found this problem. I'm following 
 firstResource tutorial with eclipse and glassfish integrated to eclipse.
 After write all the code,and importing :
 - org.restlet.jar
 - com.noelios.restlet.jar
 - com.noelios.restlet.ext.servlet_2.5.jar

 and run the servlet, I got the following error :

 javax.servlet.ServletException: PWC1397: Wrapper cannot find servlet class 
 com.noelios.restlet.ext.servlet.ServerServlet or a class it depends on
 root cause

 java.lang.ClassNotFoundException: 
 com.noelios.restlet.ext.servlet.ServerServlet
 note The full stack traces of the exception and its root causes are available 
 in the Sun GlassFish Enterprise Server v2.1 logs.

 But when I was deploying .war example downloaded from the site, it was 
 deployed successfully. Does anybody know what cause this problem?

 THanks

 Dear hudarsono,

 You'll need to copy the three jar files into /WEB-INF/lib inside your 
 deployment (I use Tomcat + IntelliJ) - I struggled with this as well, and the 
 error message provided didn't exactly point me in the right direction, but I 
 did this and it worked.

 Surely, the tutorial you're reading could contain this information more 
 explicitly. Hope this helps.


 Best regards,
 hnilsen


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


Try get Redirector working in GAE

2009-04-14 Thread Ken Huang
I try to redirect my request from my GAE application to another server, I found 
it might work with Redirector.MODE_DISPACTHER, Here is the example code I used: 

GWT client code: 
final Client client = new Client(Protocol.HTTP); 
Form form = new Form(); 
form.add(name, test); 
form.add(description, test); 
Representation rep = form.getWebRepresentation(); 
Reference itemsUri = new Reference( 
GWT.getHostPageBaseURL()+rest/items); 

Server restlet: 
String realServerUrl = http://example.com/rest/items;; 
Redirector newRedirector = new Redirector(getContext(), realServerUrl, 
Redirector.MODE_DISPATCHER); 
Route newRoute = router.attach(/rest/items, newRedirector); 

web.xml: 
?xml version=1.0 encoding=UTF-8? 
!DOCTYPE web-app 
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN 
http://java.sun.com/dtd/web-app_2_3.dtd; 
web-app 
!-- Application class name -- 
context-param 
param-nameorg.restlet.application/param-name 
param-valuecom.example.FirstResourceApplication/param-value 
/context-param 
!-- Restlet adapter -- 
servlet 
servlet-nameRestletServlet/servlet-name 
servlet-classorg.restlet.util.ServerServlet/servlet-class 
init-param 
param-nameorg.restlet.clients/param-name 
param-valuehttp/param-value 
/init-param   
/servlet 
!-- Catch all requests -- 
servlet-mapping 
servlet-nameRestletServlet/servlet-name 
url-pattern/*/url-pattern 
/servlet-mapping 
/web-app 

I use the latest org.restlet.gae.jarI and I got ClassNotFoundException from the 
server : 
java.lang.ClassNotFoundException: 
org.restlet.gae.engine.http.HttpServerConverter 
at java.net.URLClassLoader$1.run(URLClassLoader.java:200) 
at java.security.AccessController.doPrivileged(Native Method) 
at java.net.URLClassLoader.findClass(URLClassLoader.java:188) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:306) 
at 
com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:142)
 
at java.lang.ClassLoader.loadClass(ClassLoader.java:251) 
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) 
at java.lang.Class.forName0(Native Method) 
at java.lang.Class.forName(Class.java:164) 
at org.restlet.engine.Engine.loadClass(Engine.java:225) 
at 
org.restlet.engine.http.HttpServerHelper.getConverter(HttpServerHelper.java:107)
 

Can anyone tell me, Is possible redirect my HTTP request to another server 
using restlet running on GAE? Am I miss something? 
-- 
View this message in context: 
http://n2.nabble.com/Try-get-Redirector-working-in-GAE-tp2631757p2631757.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Try to get Redirector working in GAE

2009-04-14 Thread Ken Huang
I try to redirect my request from my GAE application to another server, I found 
it might work with Redirector.MODE_DISPACTHER, Here is the example code I used:

GWT client code:
final Client client = new Client(Protocol.HTTP);
Form form = new Form();
form.add(name, test);
form.add(description, test);
Representation rep = form.getWebRepresentation();
Reference itemsUri = new Reference(
GWT.getHostPageBaseURL()+rest/items);

Server restlet:
String realServerUrl = http://example.com/rest/items;;
Redirector newRedirector = new Redirector(getContext(), realServerUrl,
Redirector.MODE_DISPATCHER);
Route newRoute = router.attach(/rest/items, newRedirector);

web.xml:
?xml version=1.0 encoding=UTF-8?
!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
!-- Application class name --
context-param
param-nameorg.restlet.application/param-name
param-valuecom.example.FirstResourceApplication/param-value
/context-param
!-- Restlet adapter --
servlet
servlet-nameRestletServlet/servlet-name
servlet-classorg.restlet.util.ServerServlet/servlet-class
init-param
param-nameorg.restlet.clients/param-name
param-valuehttp/param-value
/init-param   
/servlet
!-- Catch all requests --
servlet-mapping
servlet-nameRestletServlet/servlet-name
url-pattern/*/url-pattern
/servlet-mapping
/web-app

I use the latest org.restlet.gae.jarI and I got ClassNotFoundException from the 
server :
java.lang.ClassNotFoundException: 
org.restlet.gae.engine.http.HttpServerConverter
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at 
com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:142)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at org.restlet.engine.Engine.loadClass(Engine.java:225)
at 
org.restlet.engine.http.HttpServerHelper.getConverter(HttpServerHelper.java:107)

Can anyone tell me, Is possible redirect my HTTP request to another server 
using restlet running on GAE? Am I miss something?

-- 
View this message in context: 
http://n2.nabble.com/Try-to-get-Redirector-working-in-GAE-tp2631103p2631103.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


RE: Spring restlet configuration

2009-04-14 Thread webpost
Forgot to attach the app log, the line INFO: Routes: /sample/locations it's 
added by me and actually checks that the router used by the application 
contains a route for /sample/locations, the request is for /sample/locaions 
but still getting a 404


[INFO] Started Jetty Server
13-abr-2009 23:52:41 
com.yoolab.geolocalization.restlet.GeolocalizationApplication
createRoot
INFO: Routes: 2
13-abr-2009 23:52:41 
com.yoolab.geolocalization.restlet.GeolocalizationApplication
createRoot
INFO: Routes: /sample/locations
2009-04-13 23:52:41.957:/sample:INFO:  SpringServerServlet: [Noelios
Restlet Engine] - Attaching application: 
com.yoolab.geolocalization.restlet.Geoloca
lizationapplicat...@17f5b38e to URI: /sample
13-abr-2009 23:52:41 com.noelios.restlet.LogFilter afterHandle
INFO: 2009-04-1323:52:41127.0.0.1   -   127.0.0.1   
8080
GET /sample/locations   -   404 330 -   0
http://localhost:8080   Mozilla/5.0 (Windows; U; Windows NT 6.0; es-ES; 
rv:1.9.0.8) G
ecko/2009032609 Firefox/3.0.8 (.NET CLR 3.5.30729)  -

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


RE: Redirector: HTTP request to HTTPS request

2009-04-14 Thread webpost
Hi Jerome

Yes, I was able to solve this. It was entirely my fault :( I forgot to add 
libraries for the HTTPS client. RESTlet even printed an error message which my 
eyes refused to see ;)

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


RE: Try to get Redirector working in GAE

2009-04-14 Thread Jerome Louvel
Hi Ken,

Sorry, this is a regression due to packages refactoring, I've uploaded a new
JAR on the wiki page:
http://wiki.restlet.org/docs_1.2/13-restlet/252-restlet.html
 
Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com
 

-Message d'origine-
De : Ken Huang [mailto:ken_...@hotmail.com] 
Envoyé : mardi 14 avril 2009 06:06
À : discuss@restlet.tigris.org
Objet : Try to get Redirector working in GAE

I try to redirect my request from my GAE application to another server, I
found it might work with Redirector.MODE_DISPACTHER, Here is the example
code I used:

GWT client code:
final Client client = new Client(Protocol.HTTP);
Form form = new Form();
form.add(name, test);
form.add(description, test);
Representation rep = form.getWebRepresentation();
Reference itemsUri = new Reference(
GWT.getHostPageBaseURL()+rest/items);

Server restlet:
String realServerUrl = http://example.com/rest/items;;
Redirector newRedirector = new Redirector(getContext(),
realServerUrl,
Redirector.MODE_DISPATCHER);
Route newRoute = router.attach(/rest/items, newRedirector);

web.xml:
?xml version=1.0 encoding=UTF-8?
!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
!-- Application class name --
context-param
param-nameorg.restlet.application/param-name

param-valuecom.example.FirstResourceApplication/param-value
/context-param
!-- Restlet adapter --
servlet
servlet-nameRestletServlet/servlet-name

servlet-classorg.restlet.util.ServerServlet/servlet-class
init-param
param-nameorg.restlet.clients/param-name
param-valuehttp/param-value
/init-param   
/servlet
!-- Catch all requests --
servlet-mapping
servlet-nameRestletServlet/servlet-name
url-pattern/*/url-pattern
/servlet-mapping
/web-app

I use the latest org.restlet.gae.jarI and I got ClassNotFoundException from
the server :
java.lang.ClassNotFoundException:
org.restlet.gae.engine.http.HttpServerConverter
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at
com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(Isol
atedAppClassLoader.java:142)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at org.restlet.engine.Engine.loadClass(Engine.java:225)
at
org.restlet.engine.http.HttpServerHelper.getConverter(HttpServerHelper.java:
107)

Can anyone tell me, Is possible redirect my HTTP request to another server
using restlet running on GAE? Am I miss something?

--
View this message in context:
http://n2.nabble.com/Try-to-get-Redirector-working-in-GAE-tp2631103p2631103.
html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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

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


Re: Spring restlet configuration

2009-04-14 Thread Rhett Sutphin
Hi,

On Apr 13, 2009, at 5:06 PM, webp...@tigris.org wrote:

 Forgot to attach the app log, the line INFO: Routes: /sample/ 
 locations it's added by me and actually checks that the router used  
 by the application contains a route for /sample/locations, the  
 request is for /sample/locaions but still getting a 404


 [INFO] Started Jetty Server
 13-abr-2009 23:52:41  
 com.yoolab.geolocalization.restlet.GeolocalizationApplication
 createRoot
 INFO: Routes: 2
 13-abr-2009 23:52:41  
 com.yoolab.geolocalization.restlet.GeolocalizationApplication
 createRoot
 INFO: Routes: /sample/locations
 2009-04-13 23:52:41.957:/sample:INFO:  SpringServerServlet: [Noelios
 Restlet Engine] - Attaching application:  
 com.yoolab.geolocalization.restlet.Geoloca
 lizationapplicat...@17f5b38e to URI: /sample
 13-abr-2009 23:52:41 com.noelios.restlet.LogFilter afterHandle
 INFO: 2009-04-1323:52:41127.0.0.1   -
 127.0.0.1   8080
 GET /sample/locations   -   404 330 -   0
 http://localhost:8080   Mozilla/5.0 (Windows; U; Windows NT 6.0; es- 
 ES; rv:1.9.0.8) G
 ecko/2009032609 Firefox/3.0.8 (.NET CLR 3.5.30729)  -

A guess: from the log it appears that your Application is mounted at / 
sample.  If you have a route within that application that is attached  
to /sample/location, I think that the effective URI for that resource  
would be /sample/sample/location.

Rhett

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


Re: SpringBeanRouter

2009-04-14 Thread Rhett Sutphin
Hi Jim,

On Apr 14, 2009, at 1:57 AM, Jim Alateras wrote:

 Rhett,

 Thanks for the quick turnaround and suggestions


 On 14/04/2009, at 2:19 PM, Rhett Sutphin wrote:

 Hi Jim,

 On Apr 13, 2009, at 7:56 PM, Jim Alateras wrote:

 I am currently using s custom class to attach routes to  a router  
 but
 am now looking at using the SpringBeanRouter but have a couple of
 questions.

 1.  In the example below if i also want to support the a query  
 string
 would i change the bean name to  /studies?{query}

 You should set the bean name to whatever you were formerly passing to
 Router#attach.
 At the moment my custom class does something like this

 router.attach(/resource?{query}, this.resourceMap.get(uri))
   
 .getTemplate().getVariables().put(query, new Variable(
   
 Variable.TYPE_URI_QUERY, , false, false));

 will this still work?

Ah, I'm not familiar with that sort of construction.  I'm not sure if  
it would work, though my guess is no.  Can you try it and see?  If  
it doesn't work, could you open an issue?

Thanks,
Rhett




 2. How do i specify a default route for the router.

 This isn't directly supported at the moment.  The easiest thing to do
 right now is to subclass SpringBeanRouter and override
 postProcessBeanFactory something like this:

 @Override
 public void postProcessBeanFactory(ConfigurableListableBeanFactory
 factory) {
  super.postProcessBeanFactory(factory);
  this.attachDefault(createFinder(theDefaultResourceBeanName))
 }

 excellent
 Rhett

 beans .. 
 bean name=router class=org.restlet.ext.spring.BeanNameRouter/
 bean name=/studies id=studiesResource autowire=byName
 scope=prototype class=edu.northwestern.myapp.StudiesResource 
 /beans

 cheers
 /jima

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

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


 cheers
 /jima

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

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