Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I make one servlet for several gwt clients?

 
Dmitry Zhuravlev
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings Gentlemen!

Here is a problem I faced:

I have a GWT servlet and I want to use it as server-side for SEVERAL client sides.
For this purpose my servlet should implement the client interface and its asynchronous version.
I dont want the server-side servlet to be dependent on client-side modules.
Thus, I need to place servlet interface in each of the modules.

How can I do it?

As far as I know there are two ways:

1) Make a reusable GWT module, effectively a jar, containing a gwt.xml and the two servlet interfaces, and add it to Maven classpath.
- OK, but in this case I have to create two modules for handling the server side: servlet itself in WAR, and interfaces it implements in reusable GWT module JAR; and that GWT module JAR will exist only for the purpose of storing that two interfaces (MyServletInterface and its asynchronious version). A bit verbose, from my point of view.
2) Place servlet and GWT client interfaces inside one WAR and add it to the classpath of my webapp as a dependency.
- If I will add some WAR to classpath of another WAR nothing good will happen - files will get mixed. Or may be I can overcome this somehow? Probably Maven can somehow exclude something from dependency provided, but this looks a bit ugly.

So how would you go about it?
Is there something better?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic