[Jsp]HttpServletRequest

Programing 2013.10.18 14:29 Posted by 애플자라

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<%@ page import="java.util.*" %>

<script>
 alert(document.cookie);
</script>
<html>
<body>
<%
HttpServletRequest req = (HttpServletRequest) request;
  
  out.println("ServerName - " + request.getServerName() + "<br>");
  out.println("ServerPort - " + request.getServerPort() + "<br>");
  out.println("Protocol - " + request.getProtocol() + "<br>");
  out.println("remoteAddr - " + request.getRemoteAddr() + "<br>");
  out.println("remoteHost - " + request.getRemoteHost() + "<br>");
  out.println("remotePort - " + request.getRemotePort() + "<br>");
  out.println("localName - " + request.getLocalName() + "<br>");
  out.println("localPort - " + request.getLocalPort() + "<br>");
  out.println("localAddr - " + request.getLocalAddr() + "<br>");
  out.println("Scheme - " + request.getScheme() + "<br>");
  

  
  Enumeration header_enum = req.getHeaderNames();
  while (header_enum.hasMoreElements()) {
   String header = (String) header_enum.nextElement();
   String header_value =  req.getHeader(header);
   out.println(header + " --> " + header_value + "<br>");
  }
%>
</body>
</html>

댓글을 달아 주세요