Thursday, June 26, 2008

-C-O-N-C-E-P-T- Series : Protocols for interfacing interactive web applications with web servers

In continuation with my previous post [here]

Following are different protocols for interfacing interactive web applications with web servers: SSI, CGI, SCGI, FastCGI, PHP, Java Servlet, JavaServer Pages, ASP, ASP .NET

(1) FastCGI
Web servers using this protocol: Nginx, Apache HTTP server (partial), Lighttpd (partial), etc.

(2) Java Servlet & JavaServer Pages
Web servers using this protocol: Apache Tomcat, WebLogic, WebSphere, etc.

(3) ASP & ASP .NET
Web server using this protocol: Microsoft IIS

Deployed static web application on "NGINX" HTTP server

NGINX which stands for "ENGINE X" is a light weight HTTP server which serves static content (normal HTML pages) efficiently. I was doing some R'n'D from yesterday and was successful in deploying my first Static Web Application on nginx server. Really it was a great experience.

There is some sort of small configuration which is need to be done in "nginx.conf" to navigate between the static pages. You just need to understand the basics of these entries and there you're with the running application on nginx server :)

Some useful pointers:
http://nginx.net
http://www.kevinworthington.com

Stay tuned... :)

Wednesday, June 25, 2008

-C-O-N-C-E-P-T- Series : Web / HTTP Server, Sevlet Container and Application Server

Static Web / HTTP server: It is responsible for handling HTTP requests and sending back static files as HTTP responses
Examples: Apache, lighttpd, nginx, Microsoft IIS, etc.

Servlet container: It handles HTTP requests but also add layers to process those requests, wrap them around Java objects that implement well defined interfaces and implement the servlet container architecture so that a java developer can easily use the API to respond to the requests, manage sessions, cookies, receive GET & POST params, and many more.
Examples: Apache Tomcat, etc.

Application server: It's more than the web server and servlet container. You can find lot of information here
Examples: JBoss, WebLogic, WebSphere, etc.

Tuesday, June 24, 2008

-C-O-N-C-E-P-T- Series : Java

Object's Shallow Copy and Deep Copy in Java:


Understanding concept:
Suppose I have following two objects:



Shallow copy: "obj2" refers to the memory block pointed by "obj1" as shown below.



Deep Copy: Here the data is actually copied over from "obj1" to "obj2" as shown below.



Java code:



(You can click on image to enlarge it)

Output:



Any comments are always welcome :)

Thursday, June 19, 2008

-C-O-N-C-E-P-T- Series : Java

Enhanced for loop:

Code snippet:




Output of the program is:
4
0
0
3
0




Here, "i" is directly assigned the each value from array in each iteration.
Iteration 1: Value of i = 1 (arr[0])
Iteration 2: Value of i = 2 (arr[1])
Iteration 3: Value of i = 3 (arr[2])
Iteration 4: Value of i = 4 (arr[3])



The above diagram is self-explanatory. Really interesting concept & worth learning :)

Wednesday, June 18, 2008

Implemented "SessionListener"

Blogging after a long time :)

Today I implemented Session Listener in our Project. Actually our requirement was to do certain database clean-up after the session time-out takes place. We could have called a Struts action when user clicks on Logout button, but the problem was - if the user closes the browser directly or forcefully closes the browser through Windows Task Manager, then how to call the clean-up code, so there was a need such that this code gets run by the server automatically after the session is about to time-out.

So I wrote a SessionListener class that implements HttpSessionListener. It's really a very cool concept that keeps track of each & every users' session. Even if you close the client browser, the required clean-up code will be fired automatically by the server itself & there you'll also have the access of that respective session data for that particular user :)


Any comments are always welcome :)


_________________________________________________________________________________________________________________

"Look at the sky. We are not alone. The whole Universe is friendly to us and conspires only to give the best to those who dream and work."

- Dr. A P J Abdul Kalam
_________________________________________________________________________________________________________________