Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How can I make one servlet for several gwt clients?

 
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?
    Bookmark Topic Watch Topic
  • New Topic