I am using the gdata-media-1.0-1.47.1.jar function to retrieve multimedia data using the com.google.gdata.client.media.MediaService.getMedia (IMediaContent mediaContent) method. For some requests, I get a RedirectRequiredException. When I redo the getMedia request using the url I get from RedirectRequiredException.getRedirectLocation (), I get an IllegalArgumentException ("Trying to set someone else's cookie") exception.
From what I see, the reason is that the domain in the response header for the cookie does not match the domain of the redirect location. In com.google.gdata.client.http.GoogleGDataRequest.matchDomain (), the first argument is ".docs.google.com" and the second is "docs.google.com", which causes the domain to fail.
Is this the right behavior? Why is this happening? Is there anything I can do about it? Am I doing something wrong here? Can this problem be avoided?
SitesService sitesService = new SitesService("SomeAppName");
try {
MediaContent mc = new MediaContent();
mc.setUri(aURI);
return sitesService.getMedia(mc);
} catch (RedirectRequiredException e) {
MediaContent mc = new MediaContent();
mc.setUri(e.getRedirectLocation());
return sitesService.getMedia(mc);
}
source
share