Hi

I am trying to use rest api's in my java/scala code

here is my code
 val httpclient = new DefaultHttpClient()
    val auth = new AuthScope(host, AuthScope.ANY_PORT)
    val credentials = new UsernamePasswordCredentials("admin", "admin")
    httpclient.getCredentialsProvider()
      .setCredentials(auth, credentials)
    val httpget = new HttpGet("
http://localhost:6080/service/public/api/repository/1";)
    httpget.setHeader("Accept", "application/xml")
    val response = httpclient.execute(httpget)
    val entity = response.getEntity
    if (entity != null) {
      val in = new BufferedReader(new
InputStreamReader(entity.getContent()))
      var line = in.readLine()
      var response = new StringBuffer()
      while (line != null) {
        response.append(line + "/n")
        line = in.readLine()
      }
      in.close()
      println(response.toString())
    }


But it is not returning repository details



any suggestion how can i use rest services in my java application?

Thanks

Reply via email to