GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  J2EE  >  Servlets
Go To First  |  Previous Question  |  Next Question 
 Servlets  |  Question 105 of 170    Print  
how can a web container know whether cookies are accepted or not accepted by the browser

  
Total Answers and Comments: 1 Last Update: July 31, 2006     Asked by: venkat 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
July 31, 2006 03:15:03   
Mohit Singhal        

RE: how can a web container know whether cookies are a...
The only way to know for sure is to set a cookie on a response and see if
it comes back on the following request. You have absolutely no clue from
looking just at the current request. Just as an example I run Netscape
6 configured to warn me every time about accepting a cookie -- so you
can't even look at the User-Agent header and predict whether *I* am going
to accept your cookie or not.

This is exactly what the servlet container does for you for session IDs
as long as you use URL rewriting (done with the response.encodeURL()
method) to create all of your hyperlinks. The container will send the
initial session id both ways (encoded in the URLs and as a cookie). If
the session id comes back later as a cookie the container recognizes this
and stops doing the rewriting -- otherwise it continues. But the only
safe thing for your application to do is *always* call encodeURL() to
generate all of your hyperlink destinations that should be part of the
same session.

 
Is this answer useful? Yes | No

 Related Questions

A GET request is a request to get a resource from the server. Choosing GET as the "method" will append all of the data to the URL and it will show up in the URL bar of your browser. The amount 
Latest Answer : 1) Get is Faster than Post..2) Get Is Idempotent i.e same work can be done again and again without harming database...3) Amount of data send is limited to few characters only and are visible in address bar, so sensitive data cannot be sent via GET. ...

destroy() is a servlet life-cycle method called by servlet container to kill the instance of the servlet. The answer to your question is "Yes". You can call destroy() from within the service(). 
Latest Answer : Yes,we can call destroy method,but it is not recommended to call this method from our code since init(),service(),destroy()'s r servlet lifecycle methods.And in destroy()there will be aconfig variable which will be set to null if we override this ...

Latest Answer : The only way to know for sure is to set a cookie on a response, and see ifit comes back on the following request.  You have absolutely no clue fromlooking just at the current request.  Just as an example, I run Netscape6, configured to warn ...
Read Answers (1) | Asked by : venkat

While using cookies, when the browser is shut down. will the data be available at next open of browser. If not available, how to over come that.
Read Answers (5) | Asked by : Srini99

Latest Answer : 20 cookies for per website and 300 cookies per uniqe user, also  they can limit each cookie's size to 4096 bytes. ...
Read Answers (3) | Asked by : enjoy

Latest Answer : In cookies, Session information is stored at client side in a folder called cookie, if the browser is set to cookie disable mode then this approach will not work.In URL rewriting, it is stored within each URL & attached with header. Except then cookies ...

Latest Answer : To send data from one web page to another without being shown to the user hidden fields are used.Http Protocol is a stateless protocol hence it does not remember previous request and the variables and it treats each request as the new request. In order ...
Read Answers (5) | Asked by : chandra

Latest Answer : A Servlet is that portion of your J2EE application which handles ur requets and where the buisness logic is implemented and depending on the request a response object is generated which is sent back to the client.A Servlet container is that portion of ...
Read Answers (7) | Asked by : sujatham

what is difference between servlet container and servlet config? 
Latest Answer : servlet container is part of web server which provides run time environment for servlets i.e it manages the entaire life cycle for the servlets like it creates instance,initialization,processing and destroying it.   ...

What is the Difference Between Web Container and Web Server?(Asked in Polaris Interview , held on April 11, Chennai) 
Latest Answer : The Webserver: Just Receive the request from the client and forward to Webcontainer, and do the Response vice versa.Web Container: Creates HTTP Request and Response for the Servlet, calls the appropriate servlet service method (doGet or doPost) to service ...


 Sponsored Links

 
Related Articles

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

JavaScript Browser Objects Part 2

JavaScript Browser Objects Part 2 In this JavaScript tutorial you will learn about Browser Objects viz button object properties of button object form name value Methods of button object checkbox object properties of checkbox object checked defaultChecked form name type value Methods of checkbox obje
 

JavaScript Browser Objects

JavaScript Browser Objects In this JavaScript tutorial you will learn about browser objects in JavaScript categories of browser based objects additional browser objects anchor object link object properties of link object and methods of link object mosgoogle center JavaScript supports a number of bro
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 

HR Interview - HR Interview Mistakes You Will Want To Avoid

HR Interview Mistakes You Will Want To Avoid The job interview can be a stressful process This is especially true for those who are going after a competitive position Your nonverbal communication combined with the answers you give during the interview will determine if you are hired mosgoogle While
 

HR Interview - Behavioral HR Interviews

Behavioral HR Interviews As the name implies a behavioral interview is an interview that is held by a human resources department to determine if an applicant has the behaviors that are appropriate for a job The company must know how an applicant will behave in a certain situations mosgoogle The logi
 

HR Interview - How To Prepare For Your HR Interview

How To Prepare For Your HR Interview Before you begin thinking about how you are going to dress for the interview it is important to do your research first You should learn everything you can about the company you wish to work for When you have detailed information about your employer you will conve
 

HR Interview - Telephone Interview Etiquette

Telephone Interview Etiquette When you conduct a telephone interview for a job it is important to show the proper etiquette Not only is it important it is critical is you wish to be hired by the company There are a number of things you will want to do and other things should never be done mosgoogle
 

HR Interview - How To Succeed At HR Interviews

How To Succeed At HR Interviews There are a number of things you will need to do in order to make sure you pass the interview process Your appearance is something that you will want to pay close attention to Even if you feel that your appearance shouldn t be a factor in whether or not you re highere
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2010 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape