
sudo apt-get install python-setuptools
easy_install pip
pip install <package name>
Google Web Toolkit is an open source set of tools for Front End support of your web applications. It provides great features such as Dynamic and reusable User Interface components, Remote Procedure Calls (RPC), Browser history management etc. It is licensed under Apache License 2.0.
GWT on development mode runs on Jetty Server. But you can configure GWT to run on Tomcat container. Here’s a brief walkthrough the process:
[Make sure you have GWT Eclipse Plugging installed]
https://developers.google.com/eclipse/

Note : Adding separate source folder is helpful to manage your GWT code base.




<script type="text/javascript" language="javascript" src="DRExplorer/DRExplorer.nocache.js"></script>
Now Your project is ready for using GWT plugging.
Make sure you have your entry point class ready and onModuleLoad method setup properly with respect to the HTML file.
I always try with Window.alert(“Hello World”); on the entry point just to make sure GWT pluggin is loaded property before moving forward.
SignOn features using Google Web Services is easy and efficient way to authenticate users. It’s pretty common these days to have authentication via Google UserServices. Google App Engine provides UserServiceFactory api for this purpose. I tried implementing this API within Google Web Toolkit and here’s the code snippet for reference.
The code is divided to Server Side Code and Client Side Code. Server side code provides the implementation of the actual API call while the Client side code provides interface to those RPC calls and you can make asynchronous call to the server side api. Deeper understanding of RPC call can be found in my previous weblogs.
Connection Pooling provides efficient way of using database connections. It uses shared pool of connections to perform database activities. With a connection pool, user doesn’t need to get a connection by itself, use a shared pool of connection.
Apache Commons DBCP provide efficient way to perform this task. his Commons package provides an opportunity to coordinate the efforts required to create and maintain an efficient, feature-rich package under the ASF license.
Apache commons provides framework for connection pooling code base, which makes it really easy to manage the pool.
http://commons.apache.org/dbcp/
log4j Hello World Example
Hello World Example of log4j. This instantiates a log4j logger class and logs with ERROR level on the logger class.
To run this you need log4j.jar which can be downloaded from
http://logging.apache.org/log4j/1.2/download.html
And Add log4j jar to the Java Class Path ( Eclipse : Right Click on Project > Bulid Path > Add External Archives … )
package com.aayush.logging;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
public class Intro1 {
public static Logger logger = Logger.getLogger(Intro1.class);
public static void main(String[] args) {
System.out.println("Hello World, Sorry I would be using log4j");
BasicConfigurator.configure();
logger.error("Hello log4j");
}
}
Using log4j.xml to add appenders to the logging configuration.
You can see that three types of appenders are used
As name specifies, the rolling file appender have features to rolling file based on certain criteria. In this following log4j.xml we setup has file roling based on 10KB and limit the Backup Index to 5.
Similarly we can use org.apache.log4j.DailyRollingFileAppender to roll logs on daily basis as well. Log4j has various appenders support, and you can also create your own appenders as well.
Besides that in RollingFileAppender, filter is also being used to filter LevelMin and LevelMax we want to filter in the appender.
package com.aayush.logging;
import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;
public class Intro1 {
public static Logger logger = Logger.getLogger(Intro1.class);
public static void main(String[] args) {
System.out.println("Hello World, Sorry I would be using log4j");
DOMConfigurator.configure("src/log4j.xml");
for ( int i=0; i <= 1000; i++ ) {
logger.error("Hello log4j");
logger.debug("Hello log4j");
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
<log4j:configuration>
<appender name="file" class="org.apache.log4j.FileAppender">
<param name="file" value="log.out" />
<param name="immediateFlush" value="true" />
<param name="threshold" value="debug" />
<param name="append" value="false" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %5p %c{1}:%L - %m%n" />
</layout>
</appender>
<appender name="debugfile" class="org.apache.log4j.RollingFileAppender">
<param name="maxFileSize" value="10KB" />
<param name="maxBackupIndex" value="5" />
<param name="File" value="debug.log" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %5p %c{1}:%L - %m%n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="debug" />
<param name="LevelMax" value="debug" />
</filter>
</appender>
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %c{1} - %m%n" />
</layout>
</appender>
<appender name="mail" class="org.apache.log4j.net.SMTPAppender">
<param name="SMTPHost" value="relay.int.westgroup.com" />
<param name="From" value="aayush.tuladhar@gmail.com " />
<param name="To" value="aayush.tuladhar@gmail.com" />
<param name="Subject" value="[LOG] ..." />
<param name="BufferSize" value="1" />
<param name="threshold" value="error" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %5p %c{1}:%L - %m%n" />
</layout>
</appender>
<root>
<priority value="all"></priority>
<appender-ref ref="console"/>
<appender-ref ref="debugfile" />
<appender-ref ref="file" />
</root>
</log4j:configuration>
Distraction is the only thing that consoles us for our miseries, and yet it is itself the greatest of our miseries.
Blaise Pascal
Theme: Shocking Blue Green. Blog at WordPress.com.