Reading a document's content from the gdata API?

Posted by user246114 on Stack Overflow See other posts from Stack Overflow or by user246114
Published on 2010-02-04T05:23:38Z Indexed on 2010/03/18 7:51 UTC
Read the original article Hit count: 485

Filed under:
|

Hi,

I'm using the java library to access the gdata api. I just want to be able to print the contents of a document. I setup my project to list all the docs in my feed, now that I have a document listing, I want to print its contents:

for (DocumentListEntry entry : feed.getEntries()) {
    // Ok, how do we print the doc's contents now?
    entry.getContents();
}

It looks like we're supposed to get the URL from the entry, then read the contents at the URL ourselves. I found a post stating that this is how we get that URL:

MediaContent content = (MediaContent)entry.getContent(); 
String url = content.getUri();

but when I try to read from it, I get an html response saying 'this content has moved'. I read that this is because we have to authenticate our http-read method, but I'm not sure how to do that. Is there really no built-in way to do this?

Thanks

© Stack Overflow or respective owner

Related posts about gdata-api

Related posts about google-data-api