title: How to obtain the query string in a GET with Java HttpServer/HttpExchange?
body: <p>I am trying to create a simple HttpServer in Java to handle GET requests,
  but when I try to get the GET parameters for a request I noticed the HttpExchange class does not have a method for that.</p>
  
  <p>Does anybody know an easy way to read the GET parameters (query string)?</p>
  
  <p>This is how my handler looks like:</p>
  
  <pre><code>public class TestHandler{
    @Override
    public void handle(HttpExchange exc) throws IOxception {
      String response = "This is the reponse";
      exc.sendResponseHeaders(200, response.length());
  
      // need GET params here
  
      OutputStream os = exc.getResponseBody();
      os.write(response.getBytes());
      os.close();
    } 
  }
  </code></pre>
  
  <p>.. and the main method:</p>
  
  <pre><code>public static void main(String[] args) throws Exception{
    // create server on port 8000
    InetSocketAddress address = new InetSocketAddress(8000);
    HttpServer server = new HttpServer.create(address, 0);
  
    // bind handler
    server.createContext("/highscore", new TestHandler());
    server.setExecutor(null);
    server.start();
  }
  </code></pre>