I've already put in the request to combine the spreadsheets and document downloads into a single servlet :)
Eric On Mar 2, 11:59 pm, Mattia Avancini <[email protected]> wrote: > I'm using Client Login and I'm sorry, I hadn't see the line with the comment > that is neccessary to use another service. > I suggest to add this information in the API where you describe download > requirements so it's quicky to find. > Another suggestion if it's possible it's to istantiate only one service > because I'm writing a "general" wrapper in my thesis for a bachelor degree > to interact with Google Docs and manage all kind of basic documents. > I suppose that it can be usefull for other people, who are trying to do the > same. > Thank you so much for the help, very usefull. > Mattia > > 2009/3/3 Eric (Google) <[email protected]> > > > > > > > Hi, > > > Is this ClientLogin or AuthSub? > > > You'll need an auth token that is valid for > > the Spreadsheets and Documents List API to download > > both documents/presentations AND spreadssheets. > > > In AuthSub, that's just requesting a token with: > > scope=http://spreadsheets.google.com/feeds+http://docs.google.com/ > > feeds/<http://spreadsheets.google.com/feeds+http://docs.google.com/%0Afeeds/> > > and hitting the appropriate Export URI. > > > With ClientLogin, it's a bit tricker. You need to instantiate a > > service > > object for both DocsService and SpreadsheetsService. The sample app > > does that: > > >http://code.google.com/p/gdata-java-client/source/browse/trunk/java/s... > > > See the download code where it switches between services (and > > therefore, tokens): > > >http://code.google.com/p/gdata-java-client/source/browse/trunk/java/s... > > > Eric > > > On Mar 2, 1:03 am, "[email protected]" <[email protected]> wrote: > > > I build this http call to download a generic file. > > > It works with documents and presentations but not with spreadsheets. > > > I know that spreadsheets have a different address > > > (spreadsheets.google.com). > > > I control the entire url and it's correct and equal to API. > > > When I try to download I retrieve a pages that suggests me to make an > > > account. > > > The response code is 200. > > > I try to substitute the part where I retrieve the Input stream from > > > the call with service.getStreamFromLink(link) but the response is a > > > moved error from something that I don't know what it is because the > > > file exits. > > > Please help me because I don't understand where the problem is. > > > Sorry for my English. > > > > // Retrieve connection to the feed of the document to download > > > conn = (HttpURLConnection) > > documentFeedUrl.openConnection(); > > > > /* > > > * The HttpAuthToken represents a token used to > > authenticate an > > > HTTP > > > * request. It encapsulates the functionality to > > create the > > > * "Authorization" header to be appended to a > > HTTP request. Here we > > > * retieve this token, which is related to the > > service > > > */ > > > HttpAuthToken authToken = (HttpAuthToken) service > > > .getAuthTokenFactory().getAuthToken(); > > > > // Create the "Authorization" header related to > > this feed to be > > > // appended to HTTP request > > > String header = > > authToken.getAuthorizationHeader(documentFeedUrl, > > > "GET"); > > > > // Attach the header > > > conn.setRequestProperty("Authorization", header); > > > // Attach user agent > > > conn.setRequestProperty("User-Agent", > > DEFAULT_USER_AGENT); > > > > // Send the http request > > > conn.connect(); > > > > // Map the connection to a stream > > > InputStream is = conn.getInputStream(); > > > > // Read the response, download implementation > > > httpToFile(is); > > > > // Retrieve response code > > > responseCode = conn.getResponseCode(); > > > > conn.disconnect(); > > -- > Avancini Mattia --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Docs Data APIs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Docs-Data-APIs?hl=en -~----------~----~----~----~------~----~------~--~---
