This is to do with URL Encoding, so a space character is replaced with %20% (there are a bunch of these conversions). I'm not sure if the JDK/JEE SDK come with a method to convert these back and forth, does anyone else know?
e.g. Take the actual URL string and run it through the converter, then do the comparisons.
If there isn't an existing library, you can roll your own (e.g. Convert '%20%' into ' ')