tomcat

How to get the current directory in a Scala application

Depending on your needs there are a couple of ways to get the current working directory in a Scala application.

1) Using System.getProperty

The most obvious/direct approach is to use the Java System.getProperty method, passing in "user.dir" as a parameter:

Tomcat connection pool - a Tomcat JNDI DBCP connection pool example

Here's a quick demonstration of how to create a Tomcat connection pool (database connection pool) using the Tomcat DBCP library.

I'm not going to go into a detailed explanation here of how Tomcat DBCP works, other than to say that it works for me, and I've tried to include everything here that you'll need to implement your own Tomcat DBCP database connection pool in your web applications.

A Tomcat startup script that deletes old log files before starting up

One thing I don't like about using Tomcat in development and test environments is that the log files tend to grow, eventually growing for days on end if you don't clean them out. Having all these old log files hanging around just makes it harder to debug development problems, so I like to delete them all every time I restart Tomcat.

JSP URI/URL - How to get the request URI, URL, and Context from a JSP

JSP URI/URL FAQ: How do I get a URI or URL from a JSP (the request URI or request URL)?

I was just working with a JSP, and trying to remember how to get information that can be very helpful inside of a JSP, specifically how to determine the Context, URI, and URL from within a JSP.

To that end, here's the Java source code for a JSP I wrote that will display the Context, URI, and URL for this JSP when it is accessed from a browser:

Tips about an OpenSSO getting started tutorial

This OpenSSO tutorial is probably the best "getting started with OpenSSO" tutorial around, but I'll add one caveat to it: Until you know what you're doing, just follow this tutorial to the letter, and I mean to the letter. Specifically, when they say "use Glassfish", you want to use Glassfish, and not something else, like Tomcat.

Deploy only your JSP files with this Ant build task

A lot of times when you're working on a Java web application you only need to deploy your JSP files. This happens, for instance, when you're just editing the JSP files to modify the look and feel of your web application. In cases like this there's no need to rebuild your entire application, deploy it, then restart your application server (Tomcat, Glassfish, JBoss, whatever).

My Windows Ant/Tomcat web application build process

I don't like the off-the-shelf process of developing web applications with Ant and Tomcat on Windows computers. Rather than get into my angst, here's the way I think the Ant build process should work with Tomcat:

Tomcat, pathinfo, and servlets

So today I learned that you can't just access PATH_INFO (pathinfo) information from a servlet when you're using Tomcat (at least not Tomcat 3.2.4 running under Apache). I can access the PATH_INFO information okay under Tomcat running standalone on my PC, but for some reason the same config did not work properly using Tomcat under Apache. (I'll investigate this more in the future.)

Specifically, for me to be able to access PATH_INFO (PathInfo) information in a servlet, I had to add this servlet mapping information to my web.xml file: