abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jalal U Mahmud <jumah...@us.ibm.com>
Subject About posting Atom using Apache Abdera
Date Tue, 02 Dec 2008 21:17:06 GMT


Hello

 I am trying to post atom entry using apache abdera (still learning it).
 I am having some problems while posting (but I can read from it).

. Here is the code fragment I am using:

abdera = new Abdera();
AbderaClient abderaClient = new AbderaClient(abdera);

Factory factory = abdera.getFactory();
Entry entry = factory.newEntry();

entry.setId(FOMHelper.generateUuid());
entry.setUpdated(new java.util.Date());

entry.addAuthor("Jalal");
entry.setTitle("Posting to Blogger");
entry.setContentAsXhtml("<p>This is an example post to the new blogger
beta</p>");

// using real username and password.
String auth = BasicScheme.authenticate(new UsernamePasswordCredentials(
"username", "password"));

RequestOptions rOptions = new RequestOptions();
rOptions.setAuthorization(auth);

ClientResponse resp = abderaClient.post(
"http://buetcse96.blogspot.com/feeds/posts/default", entry, rOptions);


      if (resp.getType() == ResponseType.SUCCESS) {
                // success
              System.out.println("it is a success");
                    System.out.println("hello world" + resp.getStatusText()
+ "and" + resp.getLastModified());
                    //ResponseType.

              } else {
                // there was an error
                    System.out.println("it is an error" + resp.getType() +
"and: " + resp.getStatusText() +
                                           " and:" + resp.getUri() + "
and:" + resp.getServerDate());
              }



Output:

Dec 2, 2008 1:06:15 PM org.apache.commons.httpclient.HttpMethodBase
writeRequest
INFO: 100 (continue) read timeout. Resume sending the request
Dec 2, 2008 1:06:15 PM org.apache.commons.httpclient.HttpMethodDirector
isAuthenticationNeeded
INFO: Authentication requested but doAuthentication is disabled
it is an error CLIENT_ERROR and: Unknown authorization header



However, reading from that feed works...

Any idea why I am getting this error ?


-jalal.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message