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-name>org.restlet.application</param-name> 
                <param-value>com.example.FirstResourceApplication</param-value> 
        </context-param> 
        <!-- Restlet adapter --> 
        <servlet> 
                <servlet-name>RestletServlet</servlet-name> 
                <servlet-class>org.restlet.util.ServerServlet</servlet-class> 
        <init-param> 
            <param-name>org.restlet.clients</param-name> 
            <param-value>http</param-value> 
        </init-param>       
        </servlet> 
        <!-- Catch all requests --> 
        <servlet-mapping> 
                <servlet-name>RestletServlet</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=4447&dsMessageId=1706065

Reply via email to