Actually i used to think if the url has something like "cgi" or "cgi-bin" then CGI is used. With what did they replace it..
CGI is mainly used for transferring handling of a web request to an external process (like a Perl interpreter). Modern servers (like GlassFish and
Tomcat) handle all that internally, though, with no external processes to fire up. And even if more than one process is involved (like in an Apache httpd/Tomcat combination, or if using FastCGI), both processes are running already, which makes for much smaller overhead.
If they have replaced then why is that in the head first servlets book they still talk about that heavy weight issue?
It would help if you quoted the passage you're talking about.