Hi, It is considered a correct behavior if the request removed a 302 redirect, as stated in the protocol spec - http://code.google.com/apis/calendar/developers_guide_protocol.html
"When you send that GET request, Calendar may return an HTTP 302 redirect; the redirect URL has a new query parameter, gsessionid, appended to it. (Note that some methods of sending the GET request may not show you the response headers by default; if you receive a blank response, check your HTTP utility's documentation to find out how to view response headers.) That gsessionid parameter is the way that Calendar keeps track of your session, to improve speed of response." You should use the Java client library we developed, it automatically follow these redirection for your request - http://code.google.com/apis/gdata/clientlibs.html Hope that helps, Austin On Wed, Mar 5, 2008 at 9:30 AM, jack nicolson <[EMAIL PROTECTED]> wrote: > Hi all, > > I am using the below code to obtain the feed URL for calendar However > getting the Moved Temporarily issue, could any body look at the code and let > me know where I am making mistake. > URL url = new URL(CALENDAR_DEFAULT_FEED); > > connection = (HttpURLConnection) url.openConnection(); > connection.setRequestProperty("Content-Type", > > "application/x-www-form-urlencoded"); > // Form AuthSub authentication header > > String authHeader = null; > authHeader = AuthSubUtil.formAuthorizationHeader(sessionToken, > null, > url, > "GET"); > connection.setRequestProperty("Authorization", authHeader); > connection.setInstanceFollowRedirects(false); > int responseCode = connection.getResponseCode(); > if (responseCode == HttpURLConnection.HTTP_MOVED_PERM || > responseCode == HttpURLConnection.HTTP_MOVED_TEMP) { > CALENDAR_DEFAULT_FEED = connection.getHeaderField("Location"); > > > } > > > try { > BufferedReader reader = > new BufferedReader(new InputStreamReader( > connection.getInputStream())); > String line; > > while((line = reader.readLine()) != null) { > out.println(line); > > } > } catch(IOException e) { > // Ignore > } > > > I am eagerly waiting for reply. > > Thanks > Jack, > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Calendar Data API" 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-calendar-help-dataapi?hl=en -~----------~----~----~----~------~----~------~--~---
