Here is a nice trick to know if your GWT application runs on hosted mode (development mode) or does it runs in production mode on a real web site.
Why do you need this? Because your access to the server side is different between development and production modes, and because you might your application behave differently between this two modes.
So to do this you would need to have two main html files one for development mode and another one for production mode, the two html are the same expect in the production mode you would put this following line:
‹iframe id="production" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; WIDTH: 0px; BORDER-BOTTOM: 0px; HEIGHT: 0px"›‹/iframe›
and you can also put your advertisements like Google AdSense and Google analytics and other production stuff.
after you put this write this code in your main module class:
public void onModuleLoad() {
Object isProduction = RootPanel.get("production");
if (isProduction!=null) {
ClientUtil.setProduction(true);
}
Also create this ClientUtil class:
public class ClientUtil {
private static boolean isProduction = false;
public static boolean isProduction() { return isProduction; }
public static void setProduction(boolean isProduction) {
ClientUtil.isProduction = isProduction;
}
}
Now in every place in the code user ClientUtil.isProduction() to know if you are in production or not.
Sunday, January 6, 2008
GWT Development or Production Mode
Posted by
blogger
at
12:10 AM
5
comments
Labels: Development, GWT, Mode, Production
Saturday, December 8, 2007
J2EE Rapid Development
Developing in J2EE environment should be fast and rapid, I have been working with all this J2Ee Servers - WebSphere, WebLogic, Netweaver, JBoss. All this application servers except JBoss take a lot of time to finish their startup, some of them take few minutes and some more then 10 minuets, this is pretty frustrating making some small change in the code and then wait more then 10 minutes for the server to start and then to wait some more minutes for the deploy to finish.
In JBoss it is pretty fast it take about one minute for the startup to finish, and about two minutes for the deploy to finish, This may save a lot of time to develop in J2EE Environment,
Not to mention the great feature of hot-deployment in which the code inside the method can be change without the need to restart the application server.
Many development managers doesn't take in consideration this thing when choosing application server, In my opinion this can save a lot of time and improve the development speed.
Posted by
blogger
at
2:42 AM
2
comments
Labels: Development, J2EE, JBoss, Netweaver, Rapid, WebLogic, WebSphere
