Restlet GWT callback refactoring

11 messages Options
Embed this post
Permalink
jlouvel

Restlet GWT callback refactoring

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)

Hi guys,

 

The current Restlet 2.0 edition for GWT now lives in the same « org.restlet » package, but adds an extra “callback : Uniform” parameter to the Uniform interface. This causes issues when developing GWT apps with both Restlet based client and server sides, as Eclipse complains about the extra/missing method parameter.

 

I am looking for a more consistent solution and am inclined to instead add a Request#callback property of type Uniform that would be explicitly set to issue asynchronous calls. Shortcut methods could be provided at higher levels like in the ClientResource and Client classes.

 

This would also open the way for asynchronous support in other Restlet editions like JSE and JEE.

 

Rob and other GWT users, what do you think?

 

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~
http://www.noelios.com

jon hanson

RE: Restlet GWT callback refactoring

Reply Threaded More More options
Print post
Permalink
Hi,

I'm trying to get started with Restlet and GWT and have hit this issue - i can't get both the client-side code and the server-side code to compile - depending on which restlet jar is first in the path one will fail to build.

Is it sensible to have classes of the same name and package in different editions where the class is different - more specifically the methods are different?

Regardless, until this is fixed how do i workaround the problem?

thanks,
Jon

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2413287
jlouvel

RE: Restlet GWT callback refactoring

Reply Threaded More More options
Print post
Permalink
Hi Jon,

An easy way around this issue is to separate your Restlet/GWT client side
from the Restlet server side in two different Eclipse projects.

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 : jon hanson [mailto:[hidden email]]
Envoyé : samedi 31 octobre 2009 20:10
À : [hidden email]
Objet : RE: Restlet GWT callback refactoring

Hi,

I'm trying to get started with Restlet and GWT and have hit this issue - i
can't get both the client-side code and the server-side code to compile -
depending on which restlet jar is first in the path one will fail to build.

Is it sensible to have classes of the same name and package in different
editions where the class is different - more specifically the methods are
different?

Regardless, until this is fixed how do i workaround the problem?

thanks,
Jon

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=24132
87

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2413813
webpost

RE: Restlet GWT callback refactoring

Reply Threaded More More options
Print post
Permalink
Hello,
I propose the team update the GWT example on the wiki to match the new scheme (http://wiki.restlet.org/docs_2.0/13-restlet/275-restlet/144-restlet.html). It is a little bit outdated (especially the source code to download.
Actually I splitted the code into two eclipse projects, one for the GUI with Restlet for GWT, and one for the server with Restlet for JSE.
It works the I had to refactor the code (for instance DomRepresentation doesn't exist anymore)...
It could also great to have an exemple using the ObjectRepresentation because it is the one that matches the usual way of doing RPC calls in GWT..
regards
Xavier

> Hi Jon,
>
> An easy way around this issue is to separate your Restlet/GWT client side
> from the Restlet server side in two different Eclipse projects.
>
> 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 : jon hanson [mailto:[hidden email]]
> Envoyé : samedi 31 octobre 2009 20:10
> À : [hidden email]
> Objet : RE: Restlet GWT callback refactoring
>
> Hi,
>
> I'm trying to get started with Restlet and GWT and have hit this issue - i
> can't get both the client-side code and the server-side code to compile -
> depending on which restlet jar is first in the path one will fail to build.
>
> Is it sensible to have classes of the same name and package in different
> editions where the class is different - more specifically the methods are
> different?
>
> Regardless, until this is fixed how do i workaround the problem?
>
> thanks,
> Jon
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=24132
> 87

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2414427
webpost

RE: Restlet GWT callback refactoring

Reply Threaded More More options
Print post
Permalink
In reply to this post by jlouvel
Hi,

Easy for Eclipse experts maybe. I have no idea how to split a GWT/Servlet eclipse project into two separate projects which both build a single WAR file. Are there any resources on the web for mere mortals? The closest i could find is this:

http://blog.springsource.com/2008/11/07/deploying-gwt-applications-in-springsource-dm-server-part-1/

which is a year out date, makes no mention to the Google Eclipse plugin, and doesn't look easy!

Alternatively I could just use the GWT RequestBuilder on the client to make HTTP requests, though i'd prefer to use Restlet both ends.

anyway thanks,

jon

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2414527
jlouvel

RE: Restlet GWT callback refactoring

Reply Threaded More More options
Print post
Permalink
In reply to this post by webpost
Hi Xavier,

Thanks for pointing to those issues. We'll need to fix the doc ASAP.

We are currently working on a major update to the GWT edition to provide more transparent serialization using deferred binding. Our plan is to make the ClientResource class also available in GWT.

Thierry has also done some work over this week to port the JSON and XML extension to GWT:
http://www.restlet.org/documentation/snapshot/gwt/ext/

We hope to have something to test for 2.0 M6 due soon.

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 : [hidden email] [mailto:[hidden email]]
Envoyé : mercredi 4 novembre 2009 15:53
À : [hidden email]
Objet : RE: Restlet GWT callback refactoring

Hello,
I propose the team update the GWT example on the wiki to match the new scheme (http://wiki.restlet.org/docs_2.0/13-restlet/275-restlet/144-restlet.html). It is a little bit outdated (especially the source code to download.
Actually I splitted the code into two eclipse projects, one for the GUI with Restlet for GWT, and one for the server with Restlet for JSE.
It works the I had to refactor the code (for instance DomRepresentation doesn't exist anymore)...
It could also great to have an exemple using the ObjectRepresentation because it is the one that matches the usual way of doing RPC calls in GWT..
regards
Xavier

> Hi Jon,
>
> An easy way around this issue is to separate your Restlet/GWT client side
> from the Restlet server side in two different Eclipse projects.
>
> 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 : jon hanson [mailto:[hidden email]]
> Envoyé : samedi 31 octobre 2009 20:10
> À : [hidden email]
> Objet : RE: Restlet GWT callback refactoring
>
> Hi,
>
> I'm trying to get started with Restlet and GWT and have hit this issue - i
> can't get both the client-side code and the server-side code to compile -
> depending on which restlet jar is first in the path one will fail to build.
>
> Is it sensible to have classes of the same name and package in different
> editions where the class is different - more specifically the methods are
> different?
>
> Regardless, until this is fixed how do i workaround the problem?
>
> thanks,
> Jon
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=24132
> 87

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

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2416523
jlouvel

RE: Restlet GWT callback refactoring

Reply Threaded More More options
Print post
Permalink
In reply to this post by webpost
Hi Jon,

That's a good point; we need to better explain how to use this Restlet
edition for GWT. I've added a comment on this RFE:
http://restlet.tigris.org/issues/show_bug.cgi?id=831

Basically, the idea is to launch your Eclipse/GWT project in the "no server"
mode. Then you need to create a separate JEE/Servlet project in Eclipse and
configure the ServerServlet as usual. If you don't use GWT-RPC in parallel,
then you can just run Restlet in the Java SE mode (without a Servlet
container).

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 : [hidden email] [mailto:[hidden email]]
Envoyé : mercredi 4 novembre 2009 22:53
À : [hidden email]
Objet : RE: Restlet GWT callback refactoring

Hi,

Easy for Eclipse experts maybe. I have no idea how to split a GWT/Servlet
eclipse project into two separate projects which both build a single WAR
file. Are there any resources on the web for mere mortals? The closest i
could find is this:

http://blog.springsource.com/2008/11/07/deploying-gwt-applications-in-spring
source-dm-server-part-1/

which is a year out date, makes no mention to the Google Eclipse plugin, and
doesn't look easy!

Alternatively I could just use the GWT RequestBuilder on the client to make
HTTP requests, though i'd prefer to use Restlet both ends.

anyway thanks,

jon

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=24145
27

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2416527
Bruno Harbulot

Re: Restlet GWT callback refactoring

Reply Threaded More More options
Print post
Permalink
In reply to this post by webpost
Hi,

I'm trying to upgrade a project from Restlet 1.1 to Restlet 2 (latest
trunk). Most things work, but the GWT side is causing a few problems.

The project is split into a number of Maven modules. I use Eclipse,
M2Eclipse and the Google plugin for Eclipse for GWT development.
To simplify, I have the following projects (using Restlet 1.1):

- artifactId=myApp: the one with the main Restlet Application.

      <dependency>
         <groupId>org.restlet</groupId>
         <artifactId>org.restlet</artifactId>
         <version>1.1.5</version>
      </dependency>

- artifactId=myServer: the standalone server.
      <dependency>
         <groupId>myGroup</groupId>
         <artifactId>myApp</artifactId>
      </dependency>
      <dependency>
         <groupId>org.restlet</groupId>
         <artifactId>org.restlet</artifactId>
         <version>1.1.5</version>
      </dependency>
      <dependency>
         <groupId>com.noelios.restlet</groupId>
         <artifactId>com.noelios.restlet</artifactId>
         <version>1.1.5</version>
      </dependency>
      <dependency>
         <groupId>com.noelios.restlet</groupId>
         <artifactId>com.noelios.restlet.ext.jetty</artifactId>
         <version>1.1.5</version>
      </dependency>

- artifactId=myGwtUi: the GWT user interface.
      <dependency>
         <groupId>myGroup</groupId>
         <artifactId>myApp</artifactId>
      </dependency>
      <dependency>
         <groupId>com.noelios.restlet</groupId>
         <artifactId>org.restlet.gwt</artifactId>
         <version>1.1.5</version>
      </dependency>
      <dependency>
         <groupId>com.noelios.restlet</groupId>
         <artifactId>com.noelios.restlet.ext.gwt</artifactId>
         <version>1.1.5</version>
      </dependency>


For myGwtUi, the POM file uses *jar* packaging (as I then load the
GWT-generated JavaScript using CLAP from the application when it's
deployed) and uses this:
        <build>
                <outputDirectory>${basedir}/war/WEB-INF/classes</outputDirectory>
                <resources>
                        <resource>
                                <directory>src/main/resources</directory>
                        </resource>
                        <resource>
                         
<directory>${project.build.directory}/${project.build.finalName}</directory>
                                <includes>
                                        <include>${gwt.module.alias}/**/*</include>
                                </includes>
                        </resource>
                </resources>

                <plugins>
                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>gwt-maven-plugin</artifactId>
                                <version>1.1-SNAPSHOT</version>
                                <executions>
                                        <execution>
                                                <goals>
                                                        <goal>compile</goal>
                                                        <goal>generateAsync</goal>
                                                        <goal>test</goal>
                                                </goals>
                                        </execution>
                                </executions>
                                <configuration>
                                        <runTarget>${gwt.module.alias}/${gwt.module.alias}/</runTarget>
                                </configuration>
                        </plugin>
                </plugins>
        </build>



I also use the Google plugin within Eclipse on the myGwtUi project, and
the WEB-INF/web.xml file contains this:
        <servlet>
                <servlet-name>gwtShellServletWrapper</servlet-name>
                <servlet-class>org.restlet.ext.gwt.GwtShellServletWrapper</servlet-class>
                <init-param>
                        <param-name>org.restlet.application</param-name>
                        <param-value>myApp</param-value>
                </init-param>
                 ...
        </servlet>




This works fine with Restlet 1.1, since the GWT client code is in
package org.restlet.gwt and the JSE/JEE client code is in package
org.restlet.

With the current version of Restlet 2.0 and the GWT editions, this
causes some problems.
Although the GWT code shouldn't really depend on the JSE/JEE code, it
does when it's used with the Google plugin. Because this code uses
Restlet as client code, org.restlet.gwt:org.restlet is a dependency, but
because I also want to be able to load myApp from the
GwtShellServletWrapper, org.restlet.jee:org.restlet is also a
dependency. Both editions are on the classpath and clash.

I'm not quite sure how to split this. This might work with different
classloaders, but I don't know how to tell the Google plugin to use a
different jars for the GWT libraries. I'd be happy to specify the jar
files of the GWT edition by hand, but I'm not even sure there's a way to
do this. It looks like the whole point of GWT is to blend in with the
rest of the Java code, and as such, it's a feature to have its required
jars on the project's classpath.
Alternatively, it might be possible to tweak something in the
GwtShellServletWrapper load the Application classes and dependencies
from other jars (but this might in turn make things much more complex
from the Maven point of view).


Any ideas how to solve this?


Best wishes,

Bruno.

Jerome Louvel wrote:

> Hi Jon,
>
> That's a good point; we need to better explain how to use this Restlet
> edition for GWT. I've added a comment on this RFE:
> http://restlet.tigris.org/issues/show_bug.cgi?id=831
>
> Basically, the idea is to launch your Eclipse/GWT project in the "no server"
> mode. Then you need to create a separate JEE/Servlet project in Eclipse and
> configure the ServerServlet as usual. If you don't use GWT-RPC in parallel,
> then you can just run Restlet in the Java SE mode (without a Servlet
> container).
>
> Best regards,
> Jerome Louvel
> --
> Restlet ~ Founder and Lead developer ~ http://www.restlet.org
> Noelios Technologies ~ Co-founder ~ http://www.noelios.com

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2418479
jlouvel

RE: Restlet GWT callback refactoring

Reply Threaded More More options
Print post
Permalink
Hi Bruno,

I think that this package issue with GWT is going to be really annoying,
even if we find workarounds. We will try to automatically rename the
packages of the GWT edition back to "org.restlet.gwt" until a proper
solution is provided by GWT.

Does anyone know if GWT 2.0 better handle this situation where both client
and server sides rely on the same packages?

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 : news [mailto:[hidden email]] De la part de Bruno Harbulot
Envoyé : lundi 16 novembre 2009 13:41
À : [hidden email]
Objet : Re: Restlet GWT callback refactoring

Hi,

I'm trying to upgrade a project from Restlet 1.1 to Restlet 2 (latest
trunk). Most things work, but the GWT side is causing a few problems.

The project is split into a number of Maven modules. I use Eclipse,
M2Eclipse and the Google plugin for Eclipse for GWT development.
To simplify, I have the following projects (using Restlet 1.1):

- artifactId=myApp: the one with the main Restlet Application.

      <dependency>
         <groupId>org.restlet</groupId>
         <artifactId>org.restlet</artifactId>
         <version>1.1.5</version>
      </dependency>

- artifactId=myServer: the standalone server.
      <dependency>
         <groupId>myGroup</groupId>
         <artifactId>myApp</artifactId>
      </dependency>
      <dependency>
         <groupId>org.restlet</groupId>
         <artifactId>org.restlet</artifactId>
         <version>1.1.5</version>
      </dependency>
      <dependency>
         <groupId>com.noelios.restlet</groupId>
         <artifactId>com.noelios.restlet</artifactId>
         <version>1.1.5</version>
      </dependency>
      <dependency>
         <groupId>com.noelios.restlet</groupId>
         <artifactId>com.noelios.restlet.ext.jetty</artifactId>
         <version>1.1.5</version>
      </dependency>

- artifactId=myGwtUi: the GWT user interface.
      <dependency>
         <groupId>myGroup</groupId>
         <artifactId>myApp</artifactId>
      </dependency>
      <dependency>
         <groupId>com.noelios.restlet</groupId>
         <artifactId>org.restlet.gwt</artifactId>
         <version>1.1.5</version>
      </dependency>
      <dependency>
         <groupId>com.noelios.restlet</groupId>
         <artifactId>com.noelios.restlet.ext.gwt</artifactId>
         <version>1.1.5</version>
      </dependency>


For myGwtUi, the POM file uses *jar* packaging (as I then load the
GWT-generated JavaScript using CLAP from the application when it's
deployed) and uses this:
        <build>
       
<outputDirectory>${basedir}/war/WEB-INF/classes</outputDirectory>
                <resources>
                        <resource>
                                <directory>src/main/resources</directory>
                        </resource>
                        <resource>
                         
<directory>${project.build.directory}/${project.build.finalName}</directory>
                                <includes>
       
<include>${gwt.module.alias}/**/*</include>
                                </includes>
                        </resource>
                </resources>

                <plugins>
                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>gwt-maven-plugin</artifactId>
                                <version>1.1-SNAPSHOT</version>
                                <executions>
                                        <execution>
                                                <goals>
                                                        <goal>compile</goal>
       
<goal>generateAsync</goal>
                                                        <goal>test</goal>
                                                </goals>
                                        </execution>
                                </executions>
                                <configuration>
       
<runTarget>${gwt.module.alias}/${gwt.module.alias}/</runTarget>
                                </configuration>
                        </plugin>
                </plugins>
        </build>



I also use the Google plugin within Eclipse on the myGwtUi project, and
the WEB-INF/web.xml file contains this:
        <servlet>
                <servlet-name>gwtShellServletWrapper</servlet-name>
       
<servlet-class>org.restlet.ext.gwt.GwtShellServletWrapper</servlet-class>
                <init-param>
                        <param-name>org.restlet.application</param-name>
                        <param-value>myApp</param-value>
                </init-param>
                 ...
        </servlet>




This works fine with Restlet 1.1, since the GWT client code is in
package org.restlet.gwt and the JSE/JEE client code is in package
org.restlet.

With the current version of Restlet 2.0 and the GWT editions, this
causes some problems.
Although the GWT code shouldn't really depend on the JSE/JEE code, it
does when it's used with the Google plugin. Because this code uses
Restlet as client code, org.restlet.gwt:org.restlet is a dependency, but
because I also want to be able to load myApp from the
GwtShellServletWrapper, org.restlet.jee:org.restlet is also a
dependency. Both editions are on the classpath and clash.

I'm not quite sure how to split this. This might work with different
classloaders, but I don't know how to tell the Google plugin to use a
different jars for the GWT libraries. I'd be happy to specify the jar
files of the GWT edition by hand, but I'm not even sure there's a way to
do this. It looks like the whole point of GWT is to blend in with the
rest of the Java code, and as such, it's a feature to have its required
jars on the project's classpath.
Alternatively, it might be possible to tweak something in the
GwtShellServletWrapper load the Application classes and dependencies
from other jars (but this might in turn make things much more complex
from the Maven point of view).


Any ideas how to solve this?


Best wishes,

Bruno.

Jerome Louvel wrote:
> Hi Jon,
>
> That's a good point; we need to better explain how to use this Restlet
> edition for GWT. I've added a comment on this RFE:
> http://restlet.tigris.org/issues/show_bug.cgi?id=831
>
> Basically, the idea is to launch your Eclipse/GWT project in the "no
server"
> mode. Then you need to create a separate JEE/Servlet project in Eclipse
and
> configure the ServerServlet as usual. If you don't use GWT-RPC in
parallel,
> then you can just run Restlet in the Java SE mode (without a Servlet
> container).
>
> Best regards,
> Jerome Louvel
> --
> Restlet ~ Founder and Lead developer ~ http://www.restlet.org
> Noelios Technologies ~ Co-founder ~ http://www.noelios.com

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=24184
79

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2419385
Bruno Harbulot

Re: Restlet GWT callback refactoring

Reply Threaded More More options
Print post
Permalink
In reply to this post by Bruno Harbulot
Hi Jerome,

I've just asked on the GWT mailing list:
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/caf1be26f3ba99d5#

Best wishes,

Bruno.

Jerome Louvel wrote:

> Hi Bruno,
>
> I think that this package issue with GWT is going to be really annoying,
> even if we find workarounds. We will try to automatically rename the
> packages of the GWT edition back to "org.restlet.gwt" until a proper
> solution is provided by GWT.
>
> Does anyone know if GWT 2.0 better handle this situation where both client
> and server sides rely on the same packages?
>
> Best regards,
> Jerome Louvel

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2419462
jlouvel

RE: Restlet GWT callback refactoring

Reply Threaded More More options
Print post
Permalink
Hi Bruno,

Thanks for posting this message. I'll follow with great interest.

For now (2.0 M6), Thierry has changed our porting logic to use the
"org.restlet.gwt" base package again, but we would definitely prefer staying
with "org.restlet" in the future if possible.

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 : news [mailto:[hidden email]] De la part de Bruno Harbulot
Envoyé : mercredi 18 novembre 2009 12:22
À : [hidden email]
Objet : Re: Restlet GWT callback refactoring

Hi Jerome,

I've just asked on the GWT mailing list:
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/caf1b
e26f3ba99d5#

Best wishes,

Bruno.

Jerome Louvel wrote:

> Hi Bruno,
>
> I think that this package issue with GWT is going to be really annoying,
> even if we find workarounds. We will try to automatically rename the
> packages of the GWT edition back to "org.restlet.gwt" until a proper
> solution is provided by GWT.
>
> Does anyone know if GWT 2.0 better handle this situation where both client
> and server sides rely on the same packages?
>
> Best regards,
> Jerome Louvel

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=24194
62

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