Why http is a stateless protocol ?, JAVA Programming

 

The "http protocol" is a stateless response or request based protocol.

You may contain the state information between different page requests as given below:

HTTP Sessions are the recommended useful approach. A session finds the requests that originate from the same browser in the mean while the period of conversation. All the servlets may share the similar session. The JSESSIONID is started by the server and may be passed to client through URL re-writing (if cookies are turned off), cookies or built-in SSL process.   Care could be given to minimize size of objects stored in session and objects stored in session could be serializable. In a Java servlet the session may be retrieve as given:

 

HttpSession session = request.getSession(true); //gives a current session or a new session

//To get/put a value in/from the session

Name name = new Name("Parker");

session.setAttribute("lastname", name); //session.putValue(...) is deprecated as of 2.2

session.getAttribute("lastname");//get a value. session.getValue(...) is deprecated

//If a session is no longer needed e.g. user has logged out, etc then it may be invalidated. session.invalidate();

//you may also set the session inactivity lease period on every session basis session.setMaxInactiveInterval(300);

 

 

1079_Untitled.png

Posted Date: 7/25/2012 3:53:24 AM | Location : United States







Related Discussions:- Why http is a stateless protocol ?, Assignment Help, Ask Question on Why http is a stateless protocol ?, Get Answer, Expert's Help, Why http is a stateless protocol ? Discussions

Write discussion on Why http is a stateless protocol ?
Your posts are moderated
Related Questions
Differentiation between an Applet and an Application ?

Two XML configuration files are uses by The Validator Framework validator-rules.xml and validation.xml. The validator-rules.xml shows the standard validation routines, these are re

Question: a) Change the following example, using the Java's conditional operator expression, to solve the duplication problem. public class Demonstrate { public static voi

Conversation to HTML Project Description: We have inner pages to be transformed into html for travel domain. 1. Flight search page for one way and round trip 2. Bus res

Elaborate the ‘+ ' operator and its constraints along with the help of examples? The + Operator Used on Strings. The + operator could also be used to add string variables or te

How to Write Exception Subclasses ? Most exception subclasses inherit all their functionality from the superclass. Each subclass majorly serves as a marker for a various types

Objectives 1. To help you become comfortable with using inheritance and interfaces to construct type hierarchies. 2. To familiarize you with programming from specifications. A

which concept is used to connect the networking in java

i don''t need any code i need analysis and design only -i need 4 use cases - description - activity diagram -sequence diagram -class diagram - data base diagram

require assistance in Java / Grails support We have a project which requires continuous maintenance / support and occasional feature development. Its running on Java 1.7 / Grail