dev.kanngard.net make sure you visit my new blog at: johankanngard.net

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

by Johan Känngård / [Java] / 2004-12-14 / #65


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");


Floppy icon URLQuery.java4 Kb