<%--
Author : francis lee
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="false"%>
<%@ page import="java.util.Enumeration"%>
<%@ page import="java.lang.reflect.Field"%>
<%@ page import="java.lang.reflect.Method"%>
<%@ page import="org.springframework.util.ReflectionUtils"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8">
<title>request information</title>
<link rel="stylesheet" href="">
<style type="text/css">
</style>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.7.2.min.js" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
});
</script>
</head>
<body>
<div>
<h2>request</h2>
<table border="1" width="100%">
<tr>
<th width="30%">name</th>
<th width="70%">value</th>
</tr>
<%
Method[] methods = request.getClass().getDeclaredMethods();
//Method[] methods = ReflectionUtils.getAllDeclaredMethods(request.getClass());
//Method[] methods = ReflectionUtils.getUniqueDeclaredMethods(request.getClass());
for (Method method : methods){
if(method.getParameterTypes().length == 0 && (method.getReturnType().getSimpleName().equals("String") || method.getReturnType().getSimpleName().equals("boolean"))){
Object object = ReflectionUtils.invokeMethod(method, request);
out.print("<tr>");
out.print("<td>" + method.getName() + "</td>");
out.print("<td>" + object + "</td>");
out.print("</tr>");
}
}
%>
</table>
<h2>request header</h2>
<table border="1" width="100%">
<tr>
<th width="30%">name</th>
<th width="70%">value</th>
</tr>
<%
Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
out.print("<tr>");
out.print("<td>" + headerName + "</td>");
out.print("<td>" + request.getHeader(headerName) + "</td>");
out.print("</tr>");
}
%>
</table>
</div>
</body>
</html>