Get query string from a URI in Java
Description
The following code shows how to get query string from a URI.
Example
import java.net.URI;
// www. j a v a2 s. c o m
public class Main {
public static void main(String args[]) throws Exception {
URI u = new URI("http://www.java2s.com/query?key=value");
System.out.println("The query string is " + u.getQuery());
}
}
The code above generates the following result.