Update session-info.jsp hostname add
This commit is contained in:
@@ -1,69 +1,74 @@
|
|||||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||||
pageEncoding="UTF-8"%>
|
pageEncoding="UTF-8"%>
|
||||||
|
|
||||||
<%@page import="java.util.*" %>
|
<%@page import="java.util.*" %>
|
||||||
<%@page import="java.text.*" %>
|
<%@page import="java.text.*" %>
|
||||||
|
<%@page import="java.net.InetAddress" %>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
||||||
<html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
<head>
|
<html>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<head>
|
||||||
<title>Insert title here</title>
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
</head>
|
<title>Insert title here</title>
|
||||||
<%
|
</head>
|
||||||
HttpSession sess = request.getSession();
|
<%
|
||||||
boolean isNew = session.isNew();
|
HttpSession sess = request.getSession();
|
||||||
String sessionId = session.getId();
|
boolean isNew = session.isNew();
|
||||||
long creationTime = session.getCreationTime();
|
String sessionId = session.getId();
|
||||||
long lastAccessedTime = session.getLastAccessedTime();
|
long creationTime = session.getCreationTime();
|
||||||
int maxInactiveInterval = session.getMaxInactiveInterval();
|
long lastAccessedTime = session.getLastAccessedTime();
|
||||||
int rand_M=(int)(Math.random()*10000);
|
int maxInactiveInterval = session.getMaxInactiveInterval();
|
||||||
int rand_MS=(int)(Math.random()*10000);
|
int rand_M=(int)(Math.random()*10000);
|
||||||
|
int rand_MS=(int)(Math.random()*10000);
|
||||||
|
|
||||||
if (sess.getAttribute("SessionAttr") ==null) {
|
|
||||||
out.println("<h2> session out </h2>");
|
if (sess.getAttribute("SessionAttr") ==null) {
|
||||||
sess.setAttribute("SessionAttr", rand_M+"");
|
out.println("<h2> session out </h2>");
|
||||||
sess.setAttribute("SessionAttr2", rand_MS+"");
|
sess.setAttribute("SessionAttr", rand_M+"");
|
||||||
} else {
|
sess.setAttribute("SessionAttr2", rand_MS+"");
|
||||||
|
} else {
|
||||||
|
|
||||||
out.println("<h2> session exist </h2>");
|
|
||||||
|
out.println("<h2> session exist </h2>");
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
java.util.Enumeration e = sess.getAttributeNames();
|
|
||||||
%>
|
java.util.Enumeration e = sess.getAttributeNames();
|
||||||
<table border=1 bordercolor="gray" cellspacing=1 cellpadding=0 width="100%">
|
String hostname = InetAddress.getLocalHost().getHostName();
|
||||||
<tr bgcolor="gray"><td colspan=2 align="center"><font color="white"><b>Session Info</b></font></td></tr>
|
%>
|
||||||
<tr>
|
<table border=1 bordercolor="gray" cellspacing=1 cellpadding=0 width="100%">
|
||||||
<td width="25%">Session ID</td><td width="75%"><%=sessionId%></td>
|
<tr bgcolor="gray"><td colspan=2 align="center"><font color="white"><b>Session Info</b></font></td></tr>
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<td width="25%">Session ID</td><td width="75%"><%=sessionId%></td>
|
||||||
<td>isNewe</td><td><%=isNew%></td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<td>isNewe</td><td><%=isNew%></td>
|
||||||
<td>Creation Time</td><td><%=new Date(creationTime)%></td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<td>Creation Time</td><td><%=new Date(creationTime)%></td>
|
||||||
<td>Last Accessed Time</td><td><%=new Date(lastAccessedTime)%></td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<td>Last Accessed Time</td><td><%=new Date(lastAccessedTime)%></td>
|
||||||
<td>Max Inactive Interval</td><td><%=maxInactiveInterval%></td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
<tr bgcolor="cyan"><td colspan=2 align="center"><b>Session Vaule List<b></td></tr>
|
<td>Max Inactive Interval</td><td><%=maxInactiveInterval%></td>
|
||||||
<tr>
|
</tr>
|
||||||
<td align="center">NAME</td>
|
<tr>
|
||||||
<td align="center">VAULE</td>
|
<td>hostname</td><td><%=hostname%></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<tr bgcolor="cyan"><td colspan=2 align="center"><b>Session Vaule List<b></td></tr>
|
||||||
String name = null;
|
<tr>
|
||||||
while ( e.hasMoreElements() ) {
|
<td align="center">NAME</td>
|
||||||
name = (String) e.nextElement();
|
<td align="center">VAULE</td>
|
||||||
%>
|
</tr>
|
||||||
<tr><BR><td align="left">sessnion name <%=name%></td><BR> <td align="left"><%=sess.getAttribute(name)%></td></tr>
|
<%
|
||||||
<%
|
String name = null;
|
||||||
}
|
while ( e.hasMoreElements() ) {
|
||||||
%>
|
name = (String) e.nextElement();
|
||||||
</table>
|
%>
|
||||||
|
<tr><BR><td align="left">sessnion name <%=name%></td><BR> <td align="left"><%=sess.getAttribute(name)%></td></tr>
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user