Cambiata
Cambiata

Reputation: 3845

GWT frontend (hosted mode) & PHP backend (apache) simultaneously on localhost?

Being a GWT newbie, I want to create GWT frontend and a PHP backend, communicating via JSON. The GWT Getting started docs (http://code.google.com/intl/sv-SE/webtoolkit/doc/latest/tutorial/JSONphp.html) suggests

  1. compiling the GWT frontend, and
  2. moving it to an Apache/IIS server

Is there a way to avoid this roundtrip? Could Jetty and a localhost Apache be set up to run simultaneously so that GWT frontend development (hosted mode) could be done in parallell with PHP backend dev?

Alternatively, could GWT Host mode be setup to use localhost Apache/Tomcat instead of Jetty?

Upvotes: 4

Views: 1486

Answers (2)

Peter Knego
Peter Knego

Reputation: 80340

Browsers pages (javascript) are normally only allowed to communicate to their origin servers. There are ways around it, but require changing your html pages, which makes no sense since you only need this for developments.

A better solution would be to just copy necessary files to your PHP project directory after every GWT compile. Ant can do this and your IDE maybe too.

Upvotes: 1

Bogdan
Bogdan

Reputation: 5406

Yes it's possible. You have to do the following:

  • compile once the gwt project and copy it to the php server (you can compile directly to the php server -war option
  • run dev mode with the -noserver option (this way you won't use the embedded jetty server)
  • make sure your php project loads the appropriate gwt host file
  • you should have the apache/IIS server running while in dev mode.
  • set the appropriate url in the gwt run configuration (if you use eclipse) to load the page with the hosted file on your apache server

Upvotes: 2

Related Questions