P.S. Vedi se questo fa al caso tuo:

http://forum.java.sun.com/thread.jspa?threadID=576390

in particolare la risposta 12