abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Calavera" <david.calav...@gmail.com>
Subject Re: Problem with PUT and DELETE
Date Wed, 20 Feb 2008 17:37:20 GMT
Hi Chiradip, I think that currently Google atom services specification is
obsolete, they are working on update it to
rfc5023 and I suppose that can be a problem in order to test
your client application.

If you don't want to create your own atomPub server, wordpress
supports rfc5023 and you can use it instead of blogger.

Regards

On 2/20/08, Chiradip Narayan Mandal <chiradip.mandal@gmail.com> wrote:
>
> * 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!" );
>
> }
>



-- 
David Calavera
http://www.thinkincode.net

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