Well that's kind of a cheat. I ran the compile (using the gwt-maven-
plugin) which creates the gwt.rpc file in target/mvn_module-1.0-
SNAPSHOT/.gwt-tmp/shell/com.some.gwt.Module/

Then I copied the gwt.rpc files (there's one for each gwt module you
compile) into src/main/resources. Then I added the following to my
pom.xml:
                        <build>
                                <plugins>
                                        ...
                                        <plugin>
                                                
<artifactId>maven-antrun-plugin</artifactId>
                                                <executions>
                                                        <execution>
                                                                
<id>policyCopy</id>
                                                                
<phase>process-resources</phase>
                                                                <configuration>
                                                                        <tasks>
                                                                                
<copy toDir="${basedir}/target/tomcat/webapps/ROOT/
com.some.gwt.Module">
                                                                                
        <fileset dir="${basedir}/src/main/resources/">
                                                                                
                <include name="**/*.rpc" />
                                                                                
        </fileset>
                                                                                
</copy>
                                                                        </tasks>
                                                                </configuration>
                                                                <goals>
                                                                        
<goal>run</goal>
                                                                </goals>
                                                        </execution>
                                                </executions>
                                        </plugin>
                                </plugins>
                        </build>


Not the smoothest way of doing things. It works, but I'm trying to
find a way of doing the copy from the place where it is generated the
file into the tomcat dir automagically but I haven't got there yet.

On Jan 30, 4:32 am, Arthur Kalmenson <[email protected]> wrote:
> Hi danox,
>
> This looks great! I'm trying it out right now, but could you tell me
> where you were copying the .gwt.rpc file to to get it to run in hosted
> mode? I'm also using Maven (with the gwt-maven plugin), so can you
> post that part of your Maven configuration? Thank you very much!
>
> --
> Arthur Kalmenson
>
> On Tue, Jan 27, 2009 at 6:14 PM, danox <[email protected]> wrote:
>
> > Sorry for the late response. A series of user errors led to my
> > previous attempts to update the thread being eaten up.
>
> > The crux of the problem I was having is that the example I was
> > following (linked by Arthur) was written pre-gwt 1.5. It copies an
> > older version of the <code>processCall</code> method that ignores
> > serialisation policies. This resulted in the GWT code behind the
> > HandlerAdapter code falling back to the LegacySerializationPolicy
> > which meant that any user object that didn't implement IsSerializable
> > was rejected.
>
> > Its really very easy to fix, I simply copied the current GWT
> > implementation of RemoteServiceServlet, so now my <code>processCall</
> > code> method looks like this:
>
> > try {
> >        //get the current handler
> >        Object handler = handlerHolder.get();
>
> >        //decode the request data into a GWT request instance
> >        req = RPC.decodeRequest(data, handler.getClass(), this);
>
> >        //do the actual invoking and get an encoded response
> >        String retVal = RPC.invokeAndEncodeResponse(handler, req.getMethod
> > (),
> >        req.getParameters(), req.getSerializationPolicy());
>
> >        //return the encoded response.
> >        return retVal;
>
> > } ....
>
> > This ensures that the StandardSerialisationPolicy is used and
> > everything works.
>
> > The one snag I got was that using Spring's DispatcherServlet leads to
> > GWT not finding the .gwt.rpc file in hosted mode testing. This was
> > easy to fix with maven by just copying the file into the right place.
>
> > The result is an application that is as platform agnostic as possible
> > and can take advantage of spring IOC.
>
> > On Jan 22, 11:37 am, tomekp <[email protected]> wrote:
> >> Hi guys!
> >> Thanks for all the answers.
>
> >> I just wanted to confirm that problems which I observe are indeed very
> >> similar to what danox and Arthur have reported.
> >> I'm also using spring framework and I also wanted to keep some part of
> >> my code GWT-agnostic (the module is a command line client, so it
> >> should be GWT independent).
> >> That's why I wanted to switch from IsSerializable to
> >> java.io.Serializable.
> >> I cannot invest to much time in investigating the Spring issues, so I
> >> will probably create my own
> >> com.google.gwt.user.client.rpc.IsSerializable marker interface and I
> >> will attach it to the command line client module. It's not the
> >> cleanest, but the quickest solution.
>
> >> Anyway it's good to know that Spring is the reason of the problems,
> >> not me doing something stupid :) Thanks again for help.
>
> >> Greetings
> >>   Tomek
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to