Extracting argument keys and values from the query part of a Java URL

When parsing URLs from Java agents in Domino, there is no simple way to get the argument keys/values from them. I know there is a class in the javax.servlet package, but here is a class that handles it without the need of importing that package. It can be used like this:

 URL URL = new URL("http://server.com/?Open&key1=value1&key2=value2"); URLQuery query = new URLQuery(url.getQuery()); System.out.println("value of key2: " + query.getArgument("key2");