title: Java: Simple HTTP Server application that responds in JSON
body: <p>I want to create a very simple HTTP server application in Java.</p>
  
  <p>For example, if I run the server on <strong>localhost</strong> in port <strong>8080</strong>, and I make to following call from my browser, I want to get a Json array with the string 'hello world!':</p>
  
  <pre><code>http://localhost:8080/func1?param1=123&amp;param2=456
  </code></pre>
  
  <p>I would like to have in the server something that looks like this (very abstract code):</p>
  
  <pre><code>// Retunrs JSON String
  String func1(String param1, String param2) {
      // Do Something with the params
      String jsonFormattedResponse = "['hello world!']";
  
      return jsonFormattedResponse;
  }
  </code></pre>
  
  <p>I guess that this function should not actually "return" the json, but to send it using some HTTP response handler or something similar...</p>
  
  <p>What it the simplest way to do it, without a need to get familiar with many kinds of 3rd party libraries that have special features and methodology?</p>