I'm using the following method to fetch a page that I need to supply a
cookie in order to view:

        public static String fetchPage(String urlString) {
                StringBuilder page = new StringBuilder();
                try {
                        URL url = new URL(urlString);
                        URLConnection conn = url.openConnection();
                        conn.setRequestProperty("Cookie", "somekey=somevalue;
someotherkey=someothervalue");
                        BufferedReader reader = new BufferedReader(new
InputStreamReader(conn.getInputStream()));
                        String line;
                        while ((line = reader.readLine()) != null) {
                                page.append(line);
                        }
                        reader.close();
                } catch (MalformedURLException e) {
                        e.printStackTrace();
                } catch (IOException e) {
                        e.printStackTrace();
                }
                return page.toString();
        }

It works great for the first request, but subsequent requests don't
seem to supply the cookie. If I restart my dev app server, the first
request works fine again, but the rest don't. Why is this method
returning inconsistent results?

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to