title: Restlet is returning HTTP 415 for every POST request I make
body: <p>I am getting this error every time I try to post data to my server:</p>
  
  <p><img src="https://i.imgur.com/yliNehu.png" alt="enter image description here"></p>
  
  <p>Server logs:</p>
  
  <pre><code>Starting the internal [HTTP/1.1] server on port 9192
  Starting facilitymanager.api.rest.FacilityManagerAPIRestWrapper application
  2015-06-22  13:18:11    127.0.0.1   -   -   9192    POST    /devices/rename -   415 554 45  64  http://localhost:9192   Java/1.7.0_79   -
  Stopping the internal server
  </code></pre>
  
  <p>However In the service handler I am stating that I will handle JSON messages as you can see here:</p>
  
  <pre><code>public static final class RenameDevice extends ServerResource {
  
      @Post("application/json")
      public String doPost() throws InterruptedException, ConstraintViolationException, InvalidChoiceException, JSONException {
          configureRestForm(this);
          final String deviceId = getRequest().getAttributes().get("device_id").toString();
          final String newName = getRequest().getAttributes().get("new_name").toString();
          return renameDevice(deviceId, newName).toString(4);
      }
  }
  
  /**
       * Enables incoming connections from different servers.
       * 
       * @param serverResource
       * @return
       */
      @SuppressWarnings({ "unchecked", "rawtypes" })
      private static Series&lt;Header&gt; configureRestForm(ServerResource serverResource) {
          Series&lt;Header&gt; responseHeaders = (Series&lt;Header&gt;) serverResource.getResponse().getAttributes()
                  .get("org.restlet.http.headers");
          if (responseHeaders == null) {
              responseHeaders = new Series(Header.class);
              serverResource.getResponse().getAttributes().put("org.restlet.http.headers", responseHeaders);
          }
          responseHeaders.add("Access-Control-Allow-Origin", "*");
          responseHeaders.add("Access-Control-Allow-Methods", "GET, POST, PUT, OPTIONS");
          responseHeaders.add("Access-Control-Allow-Headers", "Content-Type");
          responseHeaders.add("Access-Control-Allow-Credentials", "false");
          responseHeaders.add("Access-Control-Max-Age", "60");
          return responseHeaders;
      }
  </code></pre>
  
  <p>What am I missing here?</p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p><strong>Edit:</strong> This is the full log concerning the request:</p>
  
  <pre><code>Processing request to: "http://localhost:9192/devices/rename"
  Call score for the "org.restlet.routing.VirtualHost@54594d1d" host: 1.0
  Default virtual host selected
  Base URI: "http://localhost:9192". Remaining part: "/devices/rename"
  Call score for the "" URI pattern: 0.5
  Selected route: "" -&gt; facilitymanager.api.rest.FacilityManagerAPIRestWrapper@d75d3d7
  Starting facilitymanager.api.rest.FacilityManagerAPIRestWrapper application
  No characters were matched
  Call score for the "/devices/list" URI pattern: 0.0
  Call score for the "/groups/rename" URI pattern: 0.0
  Call score for the "/devices/rename" URI pattern: 1.0
  Selected route: "/devices/rename" -&gt; Finder for RenameDevice
  15 characters were matched
  New base URI: "http://localhost:9192/devices/rename". No remaining part to match
  Delegating the call to the target Restlet
  Total score of variant "[text/html]"= 0.25
  Total score of variant "[application/xhtml+xml]"= 5.0E-4
  Converter selected for StatusInfo: StatusInfoHtmlConverter
  2015-06-22  13:28:31    127.0.0.1   -   -   9192    POST    /devices/rename -   415 554 45  67  http://localhost:9192   Java/1.7.0_79   -
  POST /devices/rename HTTP/1.1 [415  Unsupported Media Type] ()
  KeepAlive stream used: http://localhost:9192/devices/rename
  sun.net.www.MessageHeader@2bf4dee76 pairs: {null: HTTP/1.1 415 Unsupported Media Type}{Content-type: text/html; charset=UTF-8}{Content-length: 554}{Server: Restlet-Framework/3.0m1}{Accept-ranges: bytes}{Date: Mon, 22 Jun 2015 12:28:31 GMT}
  </code></pre>
  
  <p>To obtain a full log one must invoke this line of code anywhere before opening the restlet/component server:</p>
  
  <pre><code>// Create a new Component.
  component = new Component();
  // Add a new HTTP server listening on default port.
  component.getServers().add(Protocol.HTTP, SERVER_PORT);
  Engine.setLogLevel(Level.ALL); /// &lt;----- HERE
  component.start();
  </code></pre>