Handling session defines how session should be managed internally. Session is meant for keeping track of user's information which is required further for the next proceeding requests. Scope of a session is alive from its creation till user finishes its consequent requests for a particular task. With the introduction of HttpSession interface session is get destroyed either by calling invalidate() or by setting the timer using setMaxInactiveInterval(int seconds). Session management is completely at the developer level, Servlet Container is not at all responsible for it. 

Session data can be handled or managed by following four way .

1. URL Re-writing.      --> To know more about URL Rewriting Click here
2. Hidden Form Field  --> To know more about Hidden Form Field Click here
3. Cookies                  --> To know more about Cookies Click here
4. HTTP Session         --> To know more about HTTP Session Click here

Step by step evaluation of each session tracking mechanism

At very first URL Rewriting technique was used to handle all the required session data by the client for the next consequent requests. With its many advantages and one of the major advantage of keeping the session data visible to the end users to the requested URL, next technique i.e Hidden Form field comes into existence which over comes the problem of keeping data visible but was only possible with the HTML form elements, cannot be used in servlet requesting for another servlet. Then a class is designed termed as Cookie which is capable of carrying session data to the client machine which reduces the server traffic, but was client dependent. All the session data was stored in the client machine in the form of a cookie. If by mistaken it gets  disabled or deleted then all the previous session data get destroyed, which is a big drawback. So to make it at the server side a new interface was designed i.e HttpSession which is capable of managing session data effectively using the session object. 

Both client and server having required information to track the session with every HTTP request over period of time with the use of HttpSession interface.

Note:
*Cookie  is a class and HttpSession is an interface.
*Internally, Web container is using cookie for storing the jsessionid generated with the creation of session object and uses URL rewriting for managing jsessionid in case if
   a. cookie is get disabled in the client's browser
   b. its get deleted from the client machine.

To know more about jsessionid --- > Click Here..!!



Related Posts:

  • ServletConfig Object in Servlet ServletContext object is common to all the servlet but ServletConfig object is different for all the servlets and must be created at the time of container start-up for every Servlet. ServletConfig object of one servlet is a… Read More
  • What is a Web Container After developing Servlet Application we need to deploy and run our application at theWeb-Server. When a Web-server starts it internally starts a web-container which is also termed as servlet container.  What is a we… Read More
  • ServletContext Object in Servlet ServletContext is only a single object to a whole Servlet Application. It is once created and initialized by the web container at the container start-up. A Web application has many Servlet classes and for every servlet… Read More
  • What Happens at Container Start-Up in Servlet There are many task happening internally inside the Web-Server. Following are the list of task performed at the container start-up : 1. Reads the web.xml file or Annotations specified on various web components and stores al… Read More
  • HttpSession Object in Servlet In servlet we are getting the session Object in terms of HttpSession by calling getSession() method with the HttpServletRequest object. What is a session ? Session is a object which uniquely identifies the active user so t… Read More

0 comments:

Post a Comment

Ads 468x60px

.

Ads

.

Featured Posts

Popular Posts

Like Us On FaceBook

Total Pageviews

201976

Online Members

Live Traffic