GWT Projects vs Web Projects w/ GWT

GWT Designer allows you to quickly create the modules, composites, panels, remote services and other elements that comprise Google Web Tookit applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

GWT Projects vs Web Projects w/ GWT

Postby jcmorris-mts » Wed Jul 23, 2008 12:59 am

Hi Eric,

Aside from the puzzling question of when exactly would a GTW app not be a web app, there is this apparent UI contradiction in GWT Designer
Image.

Here, I have created a Web Project using the New... > Other... > Designer > GWT > Web > Web Project command. I noticed that I can choose to convert this to a GWT Project.

However in the online GWT Designer docs, it says

Note that GWT projects and Web projects are distinct entities and should not be mixed. A Web project can reference GWT modules via its Web Project properties. A Web project should not contain any GWT elements directly.


A) Why allow a web project to be converted to a GWT Project if the two "...are distinct entities and should not be mixed"?
B) Would you give your take on what the best-practices should be for deciding when to use a plain vanilla GWT Project vs a full-blown Web Project with GWT modules?

Thanks!
Jason

------------------------------------------
Morris Technical Solutions LLC
Attachments
GWTDesignerGUI.png
Converting web project to GWT Project
GWTDesignerGUI.png (10.16 KiB) Viewed 2278 times
jcmorris-mts
 
Posts: 25
Joined: Wed Feb 06, 2008 12:16 pm

Re: GWT Projects vs Web Projects w/ GWT

Postby Eric Clayberg » Wed Jul 23, 2008 4:13 am

Use a Web project pointing to a GWT project, if you want complete control over the web deployment elements (like the web.xml file).
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: GWT Projects vs Web Projects w/ GWT

Postby adv12 » Mon Jan 12, 2009 3:28 pm

I'm hitting a case that seems to fall in the cracks between "GWT Java Project" and "Web Project." I need to define a GWT client and server that depend on setup done by a series of filters that sit in front of the GWT servlet and hang stuff in request/session scope. The filters are part of an existing infrastructure we have for ensuring connections to a set of domain-specific services used by our web applications. If everything is set up properly, then by the time control reaches the GWT code, everything's where the server-side GWT code expects it, so it can retrieve data from our other servers and return those data to the GWT client.

BUT! A "GWT Java Project" doesn't respect changes I make to the web.xml file when I try to debug my app in Hosted Mode, and a Web Module won't let me include any GWT elements except by linking to an existing module in another project. What am I missing? Is it not possible to use GWT Designer to create a project where GWT code interacts with non-GWT servlets and filters?
adv12
 
Posts: 3
Joined: Mon Jan 12, 2009 2:35 pm

Re: GWT Projects vs Web Projects w/ GWT

Postby Eric Clayberg » Tue Jan 13, 2009 11:40 am

Note that you should be able to use the GWT Designer GUI editor with any project that has gwt-user.jar on the classpath. You can also use the "Convert project into GWT roject" option to add a GWT Designer specific builder and nature to an existing project to take advantage of any GWT Designer provided compilation assistance. You are not limited to using the simple GWT projects created by GWT Designer. Those are provided simply as a convenience applicable to most users.

As far as I know, it should be possible to interact with non-GWT servlets. See http://google-web-toolkit.googlecode.co ... mmary.html to learn how to perform arbitrary HTTP requests. Beyond that, the Google GWT forum is your best source for detailed info on how to accomplish various tasks with GWT.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: GWT Projects vs Web Projects w/ GWT

Postby adv12 » Tue Jan 13, 2009 12:28 pm

Eric,

Thanks for the response. I will experiment with using the designer with other project types.

I think I did a poor job of explaining what I meant by GWT "interacting with non-GWT servlets and filters." I was using that phrase as a description of the scenario I'd described earlier, where code in my GWT service (server-side) depends on setup done by another (non-GWT) servlet in the web application. Here's the control flow I'd like to see:

REQUEST 1 (for, say, MyGwtModule.html)

1) servlet container receives user request
2) container passes control to filter defined in web.xml
3) filter does setup, placing objects in session scope for use by other server-side code
4) filter calls FilterChain.doFilter(); servlet container returns static file MyGwtModule.html

MyGwtModule.html loads, with all additional files; GWT controls get instantiated but need data from the server. So they send an AJAX request,

REQUEST 2 (RPC call to GWT server class exposed by GWT servlet)

5) servlet container receives user request
6) container passes control to same filter as before
7) filter sees that there's no work to do
8) filter calls FilterChain.doFilter(); control passes to GWT servlet
9) GWT servlet calls appropriate method on the service class
10) Service class accesses session-scoped objects created in step 3
11) Using objects set up in step 3, service class generates a response to the client.

I would like to be able to build, test, and deploy such code all within Eclipse. So far I haven't had success, because my GWT code needs the information provided by the non-GWT filter in order to run properly, and the builder specified by the GWT Java Project apparently auto-generates a web.xml (is this right?), leaving me no place to configure my filters. So when I build and run the project, the GWT code all compiles correctly, but at runtime it crashes because the filter isn't installed. This makes it hard to test my GWT client. It's hard to be sure the client is working properly if it never gets a valid response from the server. Additionally, when I deploy the project, I get a war file with no configuration for the filter in the web.xml file.

It looks like I can then make a Web Project that incorporates the code from my GWT Java Project via its Web Project properties. The Web Project allows me to make changes to web.xml that are actually reflected when I build, test, and deploy. So I suppose I could make two projects: a GWT Java Project where I define a GWT client/server that I can't really test because it depends on additional filters, and a Web Project that links against GWT modules defined in that project and additionally configures the filters. I was just hoping there was some other way to combine all the pieces that made for a more intuitive workflow. Maybe there are enough individual pieces that I can mix and match projects and builders until I get what I'm shooting for.
adv12
 
Posts: 3
Joined: Mon Jan 12, 2009 2:35 pm

Re: GWT Projects vs Web Projects w/ GWT

Postby Eric Clayberg » Wed Jan 14, 2009 5:20 am

Here's some additional info that might be useful...

http://code.google.com/support/bin/answ ... swer=55200

At this point, you are well beyind the scope of what we can help you with here. The Google GWT forum would be a better place to ask complex GWT usage or project structuring questions like this.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: GWT Projects vs Web Projects w/ GWT

Postby adv12 » Wed Jan 14, 2009 10:05 am

Thanks for the link; it helps clear some things up. I was thrown onto this project last-minute to integrate it with our existing infrastructure, so I'm working with both GWT, Eclipse, and GWT Designer all for the first time. I'm still figuring out what things are automated by the GWT tools, what's configurable via Eclipse project files, and what the builders provided by GWT Designer do.

The configuration I described seems to "just work" with the gwt4nb NetBeans plugin, but I just read in their documentation that they bypass GWT's embedded Tomcat for the reasons I describe. I don't know what level of integration is available possible with an Eclipse plugin, but maybe you guys could look into doing something similar with GWT Designer projects? (Does that make sense?)

Anyway, I understand that the main emphasis of GWT Designer is the designer itself, and it's really slick. Thanks for a great product.
adv12
 
Posts: 3
Joined: Mon Jan 12, 2009 2:35 pm

Re: GWT Projects vs Web Projects w/ GWT

Postby Eric Clayberg » Thu Jan 15, 2009 5:12 am

The nature/builder added by GWT Designer is there to provide enhanced compilation and refactoring services...

http://download.instantiations.com/Desi ... ation.html

http://download.instantiations.com/Desi ... oring.html

http://download.instantiations.com/Desi ... vices.html
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to GWT Designer

Who is online

Users browsing this forum: No registered users and 3 guests