• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cookie question

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have some problems regarding the cookie.

I am setting a cookie in the server code as:

name: name:value
path: "/"

When i send an http request, I see that the cookie is received in the response but for all consecutive requests the browser should send the same cookie in the http request right ? I see that the cookie is not sent to the server.

I don't think there is a control in the browser which enables or disables the cookie which is sent in the request.. please correct me if i am wrong.

So my question is, how do I make the browser send the cookie in the request which was previously received and set into the cookie repository??

Thanks in advance.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guy Can you post a piece of code?
You set a cookie in the HttpResponse instance using response.addCookie(Cookie cookie);
and the cookie has a set of fields like name,value,comments.
Cookies are sent from the client to the server for each requestt as key name pair name/value, fields like comments are not sent to the servers.
first of all ensure that you fill the cookie properly.
In further, cookies which has the property httpOnly set to true are not exposed to client side scripting.
so you can transfered them to servers only by an HTTP request.

 
B Mistry
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

elvadas nono wrote:Hi Guy Can you post a piece of code?
You set a cookie in the HttpResponse instance using response.addCookie(Cookie cookie);
and the cookie has a set of fields like name,value,comments.
Cookies are sent from the client to the server for each requestt as key name pair name/value, fields like comments are not sent to the servers.
first of all ensure that you fill the cookie properly.
In further, cookies which has the property httpOnly set to true are not exposed to client side scripting.
so you can transfered them to servers only by an HTTP request.



elvadas,

I figured it out. I was using the ip address in the url instead of full hostname and that was the problem. All my consecutive requests were not picking up the cookie from the browser repository but now its ok.

Thanks for your response.
 
reply
    Bookmark Topic Watch Topic
  • New Topic