• 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

knowing the clients supports cookies or not.

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can any one tell me, how can i know whether the client supports cookies or not not before instantiating a session.
 
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lokesh,
How are things at WebVeda. Any how with respect to your query i think that you have to send a cookie to the client and then invoke another servlet which tries to retrieve the cookie. If the cookie is retreived by this servlet then cookies work else they don't. I will check up further if you really need it.
check out things here http://www.jguru.com/jguru/faq/view.jsp?EID=152
Regds
Rahul P. Mahindrakar
[This message has been edited by Rahul Mahindrakar (edited January 24, 2001).]
 
lokesh reddy
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi rahul sir,
I have done the same thing, but is there any way without doing all these things.
I have done in another way as follows.
HttpSession session=req.getSession(true);
if(req.isRequestedSessionIdFromCookie())
{
out.println("Cookies accepted");
}
else
{
out.println("Cookies rejected");
}
but i dint want to instantiate the HttpSession also.
I hope u can find a solution for this.
Bye.
With regards.
Loke.

[This message has been edited by lokesh reddy (edited January 24, 2001).]
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why cant you just do this?
private Cookie[] cookies = request.getCookies();
if (cookies != null) {
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Randall,
This again would return array of cookies which are already stored on the client side. But say this is the first time my server has been accessed by the client then whats the solution as this method would return null though Cookies may be supported.
Hope i am right in my question.
Thanks
MKBala.
 
Balamurugan Kandasamy
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Randall,
This again would return array of cookies which are already stored on the client side. But say this is the first time my server has been accessed by the client then whats the solution as this method would return null though Cookies may be supported.
Hope i am right in my question.
Thanks
MKBala.
 
Balamurugan Kandasamy
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Would HttpSessions method
public boolean isNew()
useful to determine if the client supports cookie or not. Pls clarify...
Thanks
MKBala.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic