Tuesday 26 January 2010

GWT development mode and Rails embedded applications

GWT 2.0 has development mode which supports debugging by a cunning use of browser-based JavaScript communicating execution status back to the GWT server.

To enable this, GWT sends a debugging JavsScript package to the browser and relies on you setting the parameter gwt.codesvr. GWT helpfully tells your what the correct value for this should be in the development mode startup message. Usually it is

The GWT payload reads the parameters passed to the web page which poses a problem for embedded GWT applications in Rails with external frameworks such as when using smartGWT. The reason is that the Rails routing system means that embedding
in URLs does fit well and in some cases will break the Rails parameter passing mechanism.

Likewise, attempting to set the parameter in the JavaScript load doesn't work:

Embedding the setting into the rendering and redirect sections of your controllers runs the risk of this code remaining in your system when you deploy. Not only that, but it's messy and requires you to change your code prior to deploying.

And easy solution is to let Rails do the heavy lifting for you. You only want the GWT debugger to be on in the development environment.

Rails 2:
In your environment.rb file, add this at the bottom of the file:
   # Setting for GWT
   if ENV['RAILS_ENV'] == 'development'

Rails 3 and 4:
in the file:
in the files:

This will set the global $GWT_DEBUG which you can then append to the URLs that load up embedded Web 2 applications based on GWT. When you deploy live, no code changes are needed.

Now in your controllers you can simply create URLs like this:
   redirect_to '/myurl'+$GWT_DEBUG


  1. Best Merit Casino App, Best Bonus, Free Play, Deposit & Review 2021
    Best Online Merit Casino App, Best Bonus, Free Play, Deposit worrione & 메리트카지노 Review 2021 - by SVP The only 메리트카지노 way you'll get your money back for free in the US is with the best bonus

  2. Live dealer games combine a real casino expertise with a virtual consumer interface to deliver you leisure at its finest. The action of the true dealers is broadcast in real time to 퍼스트카지노 your laptop or cellular gadget by the most superior know-how. A consumer interface makes it straightforward that you simply can} bet and communicate with the stay dealers. Just like in a land primarily based casino, stay table games include table limits. All NetEnt Casinos supply gamers different tables, precisely masking your playing in} style and risk tolerance levels. In explicit, lovers of traditional casino games opt for the stay casino expertise.