abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chiradip Narayan Mandal" <chiradip.man...@gmail.com>
Subject Problem with PUT and DELETE
Date Wed, 20 Feb 2008 17:01:39 GMT
* Hello,

Can anybody please help me about the below code? It is mainly taken from the
example written by James. With the same condition POST is going perfectly
well. But I am not able to perform PUT and DELETE operations. I understand
the success status codes for PUT and DELETE are different from POST. I am
getting 400 as the status code and 'Bad request' as the satus code text. I
want to know how PUT and DELETE can be performed.

Chiradip

public* *static* *void* putToBlogger() *throws* Exception {

Abdera abdera = *new* Abdera();

URL url = *new* URL("http://atomsandbox.blogspot.com/feeds/posts/default" );

Parser parser = Abdera.*getNewParser*();

Document<Feed> doc = parser.parse( url.openStream() );

Feed feed = doc.getRoot();

Entry entry = feed.getEntry( "tag:blogger.com,1999:
blog-8038874006622135494.post-6147415018903117917" );

*out*.println( "entry.getTitle() : " + entry.getTitle() );

entry.setUpdated( *new* java.util.Date() );

AbderaClient client = *new* AbderaClient( abdera );

String auth = GoogleLogin.*getAuth*( client, "blogger",
"your_real_user_name", "your_password" );

RequestOptions options = client.getDefaultRequestOptions();

options.setAuthorization( "GoogleLogin " + auth );

BaseRequestEntity bre = *new* BaseRequestEntity( entry, *false* );

Response response = client.put( "
http://atomsandbox.blogspot.com/feeds/posts/default", bre, options );

*out*.println("response.getStatusText() : " + response.getStatus() + " " +
response.getStatusText() );

*if* ( response.getStatus() == 201 )

*out*.println( "Success!" );

*else
*

*out*.println( "Failed!" );

}

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