Sunday, May 4, 2014

Re: javax.servlet.* in non-GWT eclipse projects?



On Sunday, May 4, 2014 10:05:53 AM UTC+2, Magnus wrote:
Hi,

I am moving frequently used code (e. g. login/logout) out of my GWT projects into a separate, server-side library, which is a non-GWT project in eclipse.

Within this library, the packages javax.servlet.* cannot be resolved. I found that in my GWT projects these are located in gwt-user.jar.

This opens several questions to me:
  • How can I provide the missing packages to my non-GWT project?
    What would be a general method? For example, can I avoid copying a specific jar file taken from a specific tomcat installation into my project?

You only need the classes at compile-time, as they'll be provided by your servlet container, so pick whichever JAR you want (from Tomcat, Jetty, Glassfish, etc. or the "reference implementations" right from their respective JSRs, e.g. https://jcp.org//en/jsr/detail?id=154 or https://jcp.org//en/jsr/detail?id=340)
 
  • Why are these server-side packages part of GWT (gwt-user.jar)?

Part legacy, part "better user experience".
RPC and RequestFactory depend on servlets, and one (earlier) goal of GWT was that you'd only have to reference gwt-user.jar to compile your code; so it bundles all direct dependencies that your code would depend on (in addition to the ones needed by GWT generators/linkers at gwt-compile-time)
In the future, GWT is going to be modularized, and those dependencies will probably be split apart, as is the nowaday's best practice.

I'd suggest you look at using tools to resolve and download your third-party dependencies (such as Apache Ivy) and/or use a build tool that manages dependencies (Ant with Ivy, Maven, Gradle)
  • What are the differences between the version in GWT and for example the version in Tomcat?
There shouldn't be any difference, except maybe the version of the Servlets API being used (GWT includes Servlets 3.0 as that's what Jetty –used in DevMode and SuperDevMode– implements)

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment