Archive for April, 2008





The Technique of Virtual Deployment in Tomcat

Posted on April 26th, 2008 in Java EE, Tutorials | 9 Comments »

The most common ways of deploying a web application to Tomcat are either straightaway copy the exploded war file structure to $CATALINA_HOME/webapps or to do the more cumbersome task of compiling the web application to a war file and then using the tomcat manager to upload it. Both ways are the most used ones. But did you know there are other ways to deploy a web application to Tomcat. If you consider production environments, then applications are deployed using the deployment commands, if at all Tomcat is used. They can be made more simpler using the ant tasks.

But I am not going to discuss the production environment over here. The topic under scrutiny is how would you deploy your web application virtually to Tomcat. For that we have to know what is virtual deployment and learn about its advantages.

What is virtual deployment?

Virtual deployment in simple terms means deploying a web application from a different physical location. In this case, you are not required to put the web application in its exploded war structure to the webapps directory. Most of the beginners, tend to develop their web applications directly in the webapps directory itself. This technique might prove the most simplest and the quickest but it is the most hazardous. This is because the moment you Undeploy the web application from Tomcat’s manager the web application gets Read the rest of this entry »

Mystery of Accessibility in Local Inner Classes

Posted on April 14th, 2008 in Concepts, Java | 26 Comments »

Here is an interesting concept which I came across just recently and considered it worth sharing. I was reading about inner classes concepts where in, there is a type of inner class called the local inner class. Local inner classes are those classes which reside within the function of a method belonging to an outer class. The code can be something shown like this.

public class LocalInnerClassTest {
	public void defineInnerClass() {
		class MyLocalInnerClass {
			public void doSomething() {				
			}
		}
 
	}
}

Now lets suppose we want to pass a variable in the defineInnerClass() and pass it to the doSomething() for some computation, then according to the specifications on local inner classes methods we must declare the variables as final or else it will result in a compile time error. So the resulting code must be something as follows: Read the rest of this entry »