title: Sonatype Nexus Rest API 401 Unauthorzed
body: <p>I'm trying to get an artifact from a secured nexus repository from java using the Rest API. I'm getting 401 Unauthorized as a response.</p>
  
  <p>What do I need to do in order to authorize myself?</p>
  
  <pre><code>String url = "http://myNexus.com/service/local/artifact/maven/redirect?r=my-repo&amp;g=my.group&amp;a=my-artifact&amp;v=LATEST";
  
  HttpClient client = new DefaultHttpClient();
  HttpGet request = new HttpGet(url);
  
  HttpResponse response = null;
  
  response = client.execute(request);
  
  System.out.println("Response Code : "
         + response.getStatusLine().getStatusCode());
  </code></pre>