title: POST with Restlet framework for Java
body: <p>I can make a GET with no problem at all.
  When trying it with a POST request, I get this message:</p>
  
  <blockquote>
    <p>Internal Server Error <br>
    The server encountered an unexpected condition which prevented it from fulfilling the request</p>
  </blockquote>
  
  <p>I'm testing it with Simple REST Client extension for Chrome, but I get the same message in the real application.</p>
  
  <p>This is my post:</p>
  
  <pre><code>   @Post
     public StringRepresentation pepe(Representation entity) {
        StringRepresentation result = this.users();  
  
        // Parse the given representation and retrieve data
        Form form = new Form(entity);  
        String action = form.getFirstValue("action");  
  
        if(action.equals("add")){
          //nothing
        }
  
        Db.closeConnection();
  
        return result;
     }
  </code></pre>
  
  <p>And this is my @Get working properly:</p>
  
  <pre><code> @Get
     public StringRepresentation pepe() {
        String action = getQuery().getValues("action");
        StringRepresentation result = null;
  
        result = this.users();
  
        Db.closeConnection();
  
        return result;
     }
  </code></pre>
  
  <p>And the funny thing is: whenever I remove the condition <code>if(action.equals("add")){</code>, <strong>(which was empty inside)</strong> the POST works correctly.
  This would work:</p>
  
  <pre><code>   @Post
     public StringRepresentation pepe(Representation entity) {
        StringRepresentation result = this.users();  
  
        // Parse the given representation and retrieve data
        Form form = new Form(entity);  
        String action = form.getFirstValue("action");  
  
        Db.closeConnection();
  
        return result;
     }
  </code></pre>
  
  <p>What's going on? Looks so random!</p>