title: Error in Basic-Authentication Login (406 Not Acceptable)
body: <p>After implementing Basic-Authentication for my Jersey REST services, I'm implementing Authentication for my Client API using <code>HTTPBasicAuthFilter</code>.
  I'm using Glassfish 3.1.2 and NetBeans.</p>
  
  <p>I've followed the code written in <a href="http://javaevangelist.blogspot.pt/2012/07/jax-rs-tip-of-day-basic-client_27.html" rel="nofollow">http://javaevangelist.blogspot.pt/2012/07/jax-rs-tip-of-day-basic-client_27.html</a>, and just changed the following parameters:</p>
  
  <p><code>erc.setUsernamePassword("blive2", "microio")</code> - this is the correct login</p>
  
  <pre><code>private static final String BASE_URI = "http://localhost:8080/LULServices/webresources"
  
  webResource = client.resource(BASE_URI).path("entities.user")
  </code></pre>
  
  <p>So, when I run this file, the following message appears:</p>
  
  <pre><code>    Mar 11, 2013 5:30:38 PM com.sun.jersey.api.client.filter.LoggingFilter log
  INFO: 1 * Client out-bound request
  1 &gt; GET http://localhost:8080/LULServices/webresources/entities.user
  1 &gt; Accept: text/plain
  1 &gt; Authorization: Basic YmxpdmUyOm1pY3JvaW8=
  
  Mar 11, 2013 5:30:38 PM com.sun.jersey.api.client.filter.LoggingFilter log
  INFO: 1 * Client in-bound response
  1 &lt; 406
  1 &lt; Date: Mon, 11 Mar 2013 17:30:38 GMT
  1 &lt; Content-Length: 1231
  1 &lt; Expires: Thu, 01 Jan 1970 01:00:00 GMT
  1 &lt; Content-Type: text/html
  1 &lt; Server: GlassFish Server Open Source Edition 3.1.2.2
  1 &lt; X-Powered-By: Servlet/3.0 JSP/2.2 (GlassFish Server Open Source Edition 3.1.2.2 Java/Oracle Corporation/1.7)
  1 &lt; Cache-Control: no-cache
  1 &lt; Pragma: No-cache
  1 &lt; 
  &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 3.1.2.2 - 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 406 - Not Acceptable&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;Not Acceptable&lt;/p&gt;&lt;p&gt;&lt;b&gt;description&lt;/b&gt;The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers (Not Acceptable).&lt;/p&gt;&lt;hr/&gt;&lt;h3&gt;GlassFish Server Open Source Edition 3.1.2.2&lt;/h3&gt;&lt;/body&gt;&lt;/html&gt;
  
  Exception in thread "main" com.sun.jersey.api.client.UniformInterfaceException: GET http://localhost:8080/LULServices/webresources/entities.user returned a response status of 406 Not Acceptable
      at com.sun.jersey.api.client.WebResource.handle(WebResource.java:686)
      at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
      at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:507)
      at lulClient.BasicAuthenticationClient$ExampleResourceClient.getMessage(BasicAuthenticationClient.java:38)
      at lulClient.BasicAuthenticationClient.main(BasicAuthenticationClient.java:19)
  Java Result: 1
  BUILD SUCCESSFUL (total time: 1 second)
  </code></pre>
  
  <p>So it is the <strong>406 Not Acceptable</strong> that appears.
  Can you help me to solve it?</p>
  
  <p>Thanks!</p>