POST request to a REST server
<p>So, I'm trying to create a simple (and I mean simple) POST request. Here is the class on the server-side.</p>

<pre><code>@Stateless
@Path("cards")
public class CardsFacadeREST extends AbstractFacade&lt;Cards&gt; {

    @POST
    @Path("test")
    @Consumes({"text/plain"})
    public void createTestCard() {
        Cards card = new Cards();
        card.setName("Test Card");

        super.create(card);
    }

    @GET
    @Path("count")
    @Produces("text/plain")
    public String countREST() {
        return String.valueOf(super.count());
    }
}
</code></pre>

<p>The GET method works just fine, but the POST method isn't working for me. I'm using Chrome's Advanced Rest Client. </p>

<ul>
<li>The URL is <a href="http://localhost:8080/dc-rest/webresources/cards/test" rel="nofollow">http://localhost:8080/dc-rest/webresources/cards/test</a></li>
<li>The type is POST</li>
<li>My header is like so: Content-Type: text/plain</li>
</ul>

<p>And that's it.</p>

<p>I keep getting a "400: Bad Request. The request sent by the client was syntactically incorrect."</p>

<p>When I open the response in the JSON window, all it says is "Unexpected token &lt;"</p>

<p>Here are the request headers if that makes any difference.</p>

<pre><code>User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.103 Safari/537.36
Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
Content-Type: text/plain
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8
Cookie: JSESSIONID=f4c746a32b46244d422800192f04; treeForm_tree-    hi=treeForm:tree:applications

Body is empty.
</code></pre>

<p>And the response:</p>

<pre><code>X-Powered-By: Servlet/3.1 JSP/2.3 (GlassFish Server Open Source Edition 4.0 Java/Oracle Corporation/1.7) 
Server: GlassFish Server Open Source Edition 4.0 
Access-Control-Allow-Origin: * 
Access-Control-Allow-Methods: GET, POST, PUT, DELETE 
Allow: GET,DELETE,OPTIONS,PUT,POST 
Access-Control-Allow-Headers: content-type 
Content-Language:  
Content-Type: text/html Date: Thu, 11 Feb 2016 20:48:12 GMT 
Connection: close Content-Length: 1105

Body:
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;head&gt;&lt;title&gt;GlassFish Server Open Source Edition  4.0  - Error report&lt;/title&gt;&lt;style type="text/css"&gt;&lt;!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}HR {color : #525D76;}--&gt;&lt;/style&gt; &lt;/head&gt;&lt;body&gt;&lt;h1&gt;HTTP Status 400 - Bad Request&lt;/h1&gt;&lt;hr/&gt;&lt;p&gt;&lt;b&gt;type&lt;/b&gt; Status report&lt;/p&gt;&lt;p&gt;&lt;b&gt;message&lt;/b&gt;Bad Request&lt;/p&gt;&lt;p&gt;&lt;b&gt;description&lt;/b&gt;The request sent by the client was syntactically incorrect.&lt;/p&gt;&lt;hr/&gt;&lt;h3&gt;GlassFish Server Open Source Edition  4.0 &lt;/h3&gt;&lt;/body&gt;&lt;/html&gt;
</code></pre>