You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@abdera.apache.org by Woody Anderson <wo...@xoopit.com> on 2007/10/24 06:33:25 UTC

having trouble doing posting an image using AbderaClient.post

1st, I am probably missing something really obvious here, but i'll be
verbose in case i'm not.

I'm working on some code based on the provided postToBlogger() example.

i'm looking to post some number of images etc. get the blog based uri for
them,
create an actual blog entry and post that.

i have been able to post a text entry to the example blog (after some issues
with GoogleLoginAuthScheme...)
  i had to add this line into the mix (with code from the example)
   client = new AbderaClient(ABDERA);
   GoogleLoginAuthScheme.register( client, true ); // this was missing i
think

Anyway, that worked.
so for images i tried (btw, this is the very first thing i do with the
client after i create it and add creds etc.):

        Entry entry = FACTORY.newEntry();
        entry.setUpdated( new Date() );
        entry.setTitle( title );
        entry.setContent( new FileInputStream( "..." ), "image/jpg" );
        return client.post( getUri(), entry, options );

got this:
response = 415 : Unsupported Media Type

i found some rather older looking code on the ibm site:
http://www.ibm.com/developerworks/xml/library/x-atommedia/index.html

so i tried something like:

        options.setContentType("image/jpg");
        return client.post( getUri(), new FileInputStream( "..." ), options
);

i got the same response (at least relative to status code)


i'm hoping there is a really simple way to be posting images using Abdera,
could someone give me some assistance on that?
thanks a lot.
-w