Programming/Java / Jsp2017. 4. 17. 16:40


-------------------------------------------------------


콘솔창에서 JAR파일 압축풀기

jar -xvf fileName.jar


-------------------------------------------------------


<%@ page import="java.util.Enumeration" %>


Enumeration tmp = request.getHeaderNames();


while((tmp != null) && (tmp.hasMoreElements())) {

    String headerName = (String)tmp.nextElement();

    String headerValue = request.getHeader(headerName);

    

    System.out.println("headerName : " + headerName + ", headerValue : " + headerValue );

}


-------------------------------------------------------


<%@ page import="java.net.InetAddress" %>


String serverIp = InetAddress.getLocalHost().getHostAddress();

String ip       = serverIp.equals( request.getRemoteAddr() ) ? request.getHeader("Proxy-Client-IP") : request.getRemoteAddr();


if( !(   ip.startsWith("10.11.12.")

      || ip.equals("10.11.14.11")

      )

  ) {

  out.write("<html><head>");

  out.write("<script type='text/javascript'>alert('허용되지 않는 ip'); top.location = 'about:blank';</script>");

  out.write("</html></head>");

   

    return;

  }



'Programming > Java / Jsp' 카테고리의 다른 글

java 메일발송  (0) 2017.04.17
java파일읽기  (0) 2017.04.13
Posted by jvvj