Authentic voices. Remarkable stories. AOL On Originals showcase the passions that make the world a more interesting place.
Wake up to your world in 2 minutes.
Jews and Money. Asian Drivers. Polish IQ. CPT… that's racist! But where do these stereotypes come from? Comedian Mike Epps explores the backstories of this humor and how history and fact often distorts into a snide – but sometimes funny – shorthand.
"INSPIRED" features celebrities, visionaries and some of the biggest newsmakers of our generation, recounting the stories behind their biggest, life-changing moments of inspiration.
In a compelling series of verite encounters, Win Win provides unique access into the minds and lives of the world’s most-celebrated entrepreneurs and athletes.
Explore what it means to be human as we rush head first into the future through the eyes, creativity, and mind of Tiffany Shlain, acclaimed filmmaker and speaker, founder of The Webby Awards, mother, constant pusher of boundaries and one of Newsweek’s “women shaping the 21st Century.”
Nicole Richie brings her unfiltered sense of humor and unique perspective to life in a new series based on her irreverent twitter feed. The show follows the outspoken celebrity as she shares her perspective on style, parenting, relationships and her journey to adulthood.
Comedy is hard, but teaching comedy to children is hilariously difficult. Kevin Nealon is giving the challenge to some world-famous comedians. As these young minds meet with comedy’s best, get ready to learn some valuable comedy lessons, and to laugh!
James Franco loves movies. He loves watching them, acting in them, directing them, and even writing them. And now, he’s going to take some of his favorite movie scenes from the most famous films of all time, and re-imagine them in ways that only James can.
The story of punk rock singer Laura Jane Grace of Against Me! who came out as a woman in 2012, and other members of the trans community whose experiences are woefully underrepresented and misunderstood in the media.
Executive produced by Zoe Saldana (who will be the subject of one episode), a celebrity travels back to their hometown to pay tribute to the one person from their past (before they were famous) who helped change their life by giving them an over-the-top, heart-felt surprise.
Enter the graceful but competitive world of ballet through the eyes of executive producer, Sarah Jessica Parker. This behind-the-scenes docudrama reveals what it takes to perform on the ultimate stage, the New York City Ballet. Catch NYCB on stage at Lincoln Center.
Park Bench is a new kind of "talking show" straight from the mind of born and bred New Yorker and host, Steve Buscemi.
Go behind the scenes with some of the biggest digital celebrities to see what life is like when the blogging and tweeting stops.
Learn how to implement Http session listener in this E-learning online tutorial.
Tags:How to Implement Http Session Listener,E-learning online training,E-learning online tutorials,E-learning training,IT e-learning,IT online trainig,IT online tutorials,online training
Grab video code:
Implement an Http Session Listener for monitoring session creation and destruction. In the proceeding lesson, we had discussed to various listeners to handle the use of specific Http Session Events. I hope you are familiar with the steps for implementing the listener interface. Well, we will now get directly into discussing the example.
Usually, the session tracking can considerably increase the server’s memory load. For example, if a site that uses session tracking which is 500 unique visitors per hour and the server uses a session time out of two hours, then the system will have approximately 1000 sessions in memory at any one time.
If we reduce the time out to one hour, it would cut the session memory requirements. But there would be the risk that the premature time out of the few active sessions as well. Thus, we need to track typical usage before we can decide on the appropriate solution. So, we need a listener which will keep track of how many sessions are created, how many are destroyed and how many are in memory at any one time.
Here are the codes for the listener called session counter that accomplishes this task. Initially, we implement the listener with the Http Session Listener Interface. We have declared the private variables for calculating the total number of sessions in memory, number of current sessions in the memory and the maximum number of sessions that we can store in the memory at a time.
Next, we need to overwrite the session created and session destroyed methods. Inside the session created method, we increment the two counters, i.e. total session count and current session count. Initially, our maximum session count is zero. We also check whether the current session count is greater than the previous maximum account. If it is greater, then we also increment that max session count variable.
The session counts need to be placed in an easily accessible location for servelets and jsp pages that will display the counts. So, the first time session created is called, it obtains to session object using the get session method and it calls the get servelet context method on the session object to get the context object. Afterwards, it calls set attribute method to store the listener object and to serve that context.
Inside the session destroy method, we must decrement the current session account variable because we exit from session. Actually, we have employed this listener class like a bee, so we also define the ghetto methods for all three variables.
Next, we must declare the listener into deployment descriptor using the listener and listener class elements like this. We must also configure our session time-out details and the deployment descriptor like this. Here we gave the session time out will be two minutes. In our example we need a jsp page to display the session counts. In this jsp page, we’ll retrieve the values of three session count variables from the session counter bean and displayed to us.
First we employ jps:useBean action to make use of the session counter bean. Later, we retrieve the values using the jsp:getProperty action. In order to test our example, we wrote two other jsp pages, i.e., create sessions.jsp and sample.jsp.
Here is the code for free 8 sessions dot jsp page. Here, we simply split the page into 9 frames as all frames are in equal size. The source for all frames has the same source as sample.jsp page. So, each frame will request that the jsp page executes.
In the sample.jsp page, we simply print a message to the user in different colors on successive execution. We have initialized a string array which consists of 9 color names and a retina method, random color generator method.
Inside this method, we are employing the random method in the math class for generating the index for the array randomly. But it does not exceed the array length. This method returns a value, i.e. array variable with specific index like color names of 3. e assigned this value to the color attribute in a font tag for a message. So, the message will display in a color of text.
For the subsequent requests, the value of the index for the array will vary. Thus, the color of the message will also vary, so whenever we make a request for the create sessions.jsp page, it will be forced to recreate nine sessions immediately. Well, let’s get into look at the output.
Here is the output of session counts.jsp. It displays all the three account variables in bold font. Well, let’s execute our free 8 sessions.jsp page. It shows our message in different colors in various frames.
So go back now to the session counts.jsp page. Now we have clearly looked at the increase at the number of sessions. Remember that, jsp pages support session tracking by default. So, we must disable the cookies in your browser. As a result, the making of every request will be requested for new session. Otherwise, all of these requests will be considered as a single session.
I hope you now have a clear understanding on how to use Http Session Listeners.