티스토리 뷰

반응형


* local의 기본 정보(IP, Name, Port)를 보여줌(local이라 하면 일반적으로 서버를 의미)
Local IP : =request.getLocalAddr()
Local Name : =request.getLocalName()
Local Port : =request.getLocalPort()

* 클라이언트의 정보(IP, Host, Port)
Remote IP : <%=request.getRemoteAddr()%>
Remote Host : <%=request.getRemoteHost()%>
Remote Port : =request.getRemotePort()

* 서버 이름, 포트(일반적으로 local 기본정보와 동일)
Server Name : <%=request.getServerName()%>
Server Port : <%=request.getServerPort()%>

* 지역 정보(대부분 한국을 의미하는 ko가 나옴)
Locale : <%=request.getLocale()%>

* 사용하는 프로토콜("프로토콜/메이저버전.마이너버전" 의 형태)
Protocol : <%=request.getProtocol()%>
http, https, ftp와 같은 것을 의미.
Scheme : <%=request.getScheme()%>

* https와 같은 보안 채널의 사용 여부(true/false 값으로 되어 있음)
Secure Channel : <%=request.isSecure()%>

* 요청에 대한 URI, URL, 컨텍스트 경로, 서블릿 경로, GET/POST등의 메소드를 나타냄
Request's URI : <%=request.getRequestURI()%>
Request's URL : <%=request.getRequestURL()%>

Context Path : <%=request.getContextPath()%>
Servlet Path : <%=request.getServletPath()%>
Method : <%=request.getMethod()%>

* 세션 ID에 대한 정보들
Session ID : <%=request.getRequestedSessionId()%>
Session ID from Cookie : <%=request.isRequestedSessionIdFromCookie()%>
Session ID from URL : <%=request.isRequestedSessionIdFromURL()%>
Session ID is still valid : <%=request.isRequestedSessionIdValid()%>

* Header 정보를 보는 방법
<%
 Enumeration eHeader = request.getHeaderNames();
 while (eHeader.hasMoreElements()) {
 String hName = (String)eHeader.nextElement();
 String hValue = request.getHeader(hName);

 out.println(hName + " : " + hValue + "<br>");
 }
%>


* Request 객체를 통해서 쿠키 정보를 보는 방식
<%
 Cookie cookies[] = request.getCookies();
 for (int i=0; i < cookies.length; i++) {
  String name = cookies[i].getName();
  String value = cookies[i].getValue();

  out.println(name + " : " + value + "<br>");
 }
%>

* HTML 폼을 통해 넘어온 데이터를 받는 부분
<%
 Enumeration eParam = request.getParameterNames();
 while (eParam.hasMoreElements()) {
  String pName = (String)eParam.nextElement();
  String pValue = request.getParameter(pName);

  out.println(pName + " : " + pValue + "<br>");
 }
%>

* 미리 설정한 attribute를 가져오는
<%
 Enumeration eAttr = request.getAttributeNames();
 while (eAttr.hasMoreElements()) {
  String aName = (String)eAttr.nextElement();
  String aValue = request.getHeader(aName);

  out.println(aName + " : " + aValue + "<br>");
 }
%>

 

반응형
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함