How are you determining that the cookie is not being set? I'm testing your
code against an app I have in production that just does this:

class GetRequestHeaders(webapp.RequestHandler):
  def get(self):
     self.response.out.write(self.request.headers)

The cookie is definitely being sent.


On Tue, Mar 23, 2010 at 3:38 PM, fletcher <[email protected]> wrote:

> The snippet I posted works fine outside of GAE. Anybody know what is
> going on?
>
> On Mar 19, 12:18 pm, fletcher <[email protected]> wrote:
> > Anyone? This is really frustrating!
> >
> > On Mar 17, 1:10 pm, fletcher <[email protected]> wrote:
> >
> > > 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
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine-java%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
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 [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-appengine-java?hl=en.

Reply via email to