Java Servlet session in Enterprise Java Part 2
• Java Servlet session in Enterprise Java Pa...
Lifecycle of HTTP Session
The following steps comprise a lifecycle of an HTTP session:-
A visitor, using a web browser, makes a request for resource from the web server.
The webserver delivers the authentication module that results in the visitor’s web browser displaying a login form.
The visitor keys in valid username and password, which is then returned to the web server.
The web server return a valid SESSION ID that allows this visitor to be uniquely identified.
The visitor’s web browser issues any number of requests to the web browser.
The visitor closes the browser without explicitly logging out.
After 30 minute, the web server expires the session by deleting the Session ID.
Session Management Rules.
There are three characteristics that must be followed while managing sessions over the web:-
Information or state must be stored. ex. Shopping cart
Each HTTP request must carry an identifier that allows the web server to process the request in the context of the stored state. Ex. When an order is submitted, it must be processed with the correct items and customer details.
Session need to have a timeout. Otherwise, if a client leaves the website, there is no way the web server can determine when the session ended.
Session tracking with servlet API
The servlet, for each client request, must be able to determine the HTTP session to which the client request is made.
Each client request belongs to just one of the client session being tracked by the servlet.
Servlet API provides a simple, powerful, set of techniques to deal with sessions.
The Servlet API provide developers all that is required to track session using servlet code Spec.
This Session ID is the only state data that is maintained between HTTP request between the web server and a browser.
This means that sensitive data such as password or user details can be safely associated with a session, as this data never leaves the servlet process space.
Methods of Session Tracking
Cookies. :- cookies present a convenient way to store state information on a visitors hard disk.
URL Rewriting :- The client appends some additional data to the end of each URL, which identifies the session and web server associates that identifier with data it has stored
Hidden Form Fields.:- In commercial application occasionally it is necessary to return to the web server some client Information, which is bound specifically to the application running in the client’s browser.about that session.
PLAYLIST ENTERPRISE JAVA #PRACTICAL :-
• ENTERPRISE JAVA PRACTICAL TUTORIAL TYIT MU...
PLAYLIST #EJ #ENTERPRISE #JAVA #THEORY:-
• Enterprise Java THEORY TUTORIAL
#Subscribe the Channel Link :- https://www.youtube.com/c/AjUpgrading...
IF any Query or Doubt DM on #Instagram :-
https://www.instagram.com/bansode_aja...