title: 405 Error when sending HTTP request throw JAVA
body: <p>I try to send http request and get the result with a Java code</p>
  
  <p>this is the Server side:</p>
  
  <pre><code>public class Testws {
  @GET
      @Path("/test/{id}")
      @Produces("application/xml")
      public Integer getAssets(@PathParam("id") int id){
          }
  }
  </code></pre>
  
  <p>And this is the Client side:</p>
  
  <pre><code>URL url = new URL("http://xxx/route/test/1");
  HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
  connection.setDoOutput(true);
  connection.connect();
  final int responseCode = connection.getResponseCode();
  </code></pre>
  
  <p>when i run this java code i got an 405 status code but when i put the link (<a href="http://xxx/route/test/1" rel="nofollow">http://xxx/route/test/1</a>) directly in the browser it works fine i got 200 as a response code.
  How can i fix this ?</p>