Virtual Position Forum
Please register to watch content in detail
Thanks
Admin virtual position


Join the forum, it's quick and easy

Virtual Position Forum
Please register to watch content in detail
Thanks
Admin virtual position
Virtual Position Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

CS506 Assignment No. 5 Solution

View previous topic View next topic Go down

GMT + 3 Hours CS506 Assignment No. 5 Solution

Post by Rao Muhammad Aftab Fri Sep 02, 2011 10:02 am

Code:
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class STimerOut extends HttpServlet {
// Handles the HTTP <code>GET</code> method.

// use rq to read incoming HTTP headers
// use rs to specify the HTTP response status
public void doGet(HttpServletRequest rq, HttpServletResponse rs)
throws ServletException, IOException {

// tell the browser that we are sending back html
rs.setContentType(“text/html”);

// used to modify println() statements to build a legal web page
PrintWriter out = rs.getWriter();

int t = 60;

/*
system extracts a user ID from a cookie or attached URL data, then uses
that as a key into a table of previously created HttpSession objects.
*/
HttpSession s = rq.getSession();

/*
following statements build a legal webpage
*/
out.println(“<HTML>”);
out.println(“<HEAD>”);
out.println(“<TITLE >”);
out.println(“Session TimeOut “);
out.println(“</TITLE>”);
out.println(“</HEAD>”);

out.println(“<BODY>”);
out.println(“<H1>”);
out.println(“Session TimeOut “);
out.println(“</H1>”);

out.println(“gaining the old time out ” +
s.getMaxInactiveInterval());/* getMaxInactiveInterval() gets the maximum
time in seconds for which the session remained
inactive.

out.println(“<BR>”);
out.println(“<BR>”);

s.setMaxInactiveInterval(2*t*t); /* sets the maximum time in seconds for which the
session can remain inactive.
out.println(“giving new time to get out ” +
s.getMaxInactiveInterval());

out.println(“</BODY>”);
out.println(“</HTML>”);
Rao Muhammad Aftab
Rao Muhammad Aftab
Monstars
Monstars

Pisces Snake
Posts : 1091
Join date : 2011-02-11
Age : 35

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum