abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <chetan.kalego...@accenture.com>
Subject facing Issue With Abder post method(file upload to lotus server)
Date Tue, 26 Mar 2013 12:48:19 GMT

Hi  Team

I am new to Lotus connection. I Have requirement to perform antivirus scan on file uploaded
in our project.
We want to upload file to IBM Lotus connection server using apache abdera API. I am able to
hit the lotus connection server set for our application.
I am also able to get nonce key from our lotus server but I am not able to upload File to
the server.
I have tried different overloaded Post method of AbdearClient but all methods give same http
code 302 ans status text is coming as found.

The code I am using is as below.

  FileInputStream fis = new File("H:\\Sample.pdf");
  UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(
    "username", "pwd");
  String auth = BasicScheme.authenticate(credentials, "UTF-8");

  Abdera abdera = new Abdera();
  AbderaClient client = new AbderaClient(abdera);
  try {
   client.addCredentials(SERVER_URI, "", "", credentials);
  } catch (URISyntaxException e) {

  RequestOptions requestOptions = client.getDefaultRequestOptions();

  ClientResponse response = null;
  //nonce key
  response = client.get(SERVER_URI+"basic/api/nonce",requestOptions);
  String nonce = response.getDecodedHeader("X-Update-Nonce");

  RequestEntity  reqEnt = new InputStreamRequestEntity(fis, "application/pdf");
  requestOptions.setHeader("X-HTTP-Method-Override", "POST");
  requestOptions.setHeader("X-Update-Nonce", nonce);

  response = client.post(SERVER_URI++"basic/api/myuserlibrary/feed",reqEnt,requestOptions);

In the above code. get method returns success status as 200 and I get nonce key. But Post
method is returning status as 302 and file is
not uploaded on server. Can any tell me if am missing something or is another way of uploading
file to lotus connection using apache abdera?
Please help me.

This message is for the designated recipient only and may contain privileged, proprietary,
or otherwise confidential information. If you have received it in error, please notify the
sender immediately and delete the original. Any other use of the e-mail by you is prohibited.

Where allowed by local law, electronic communications with Accenture and its affiliates, including
e-mail and instant messaging (including content), may be scanned by our systems for the purposes
of information security and assessment of internal compliance with Accenture policy.



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message