1. 키파일생성

[root@localhost ellord]# keytool -genkey -alias tomcat -keyalg RSA -validity 3650 -keystore tomcat.keystore
Enter keystore password:  

비밀번호를 두 번 입력한 후 추가 정보를 입력한다.

 

사설인증서이므로 국가코드 외에는 임의의 정보로 입력한다.

What is your first and last name?
  [Unknown]:   Yang
What is the name of your organizational unit?
  [Unknown]:  Devel
What is the name of your organization?
  [Unknown]:  EL
What is the name of your City or Locality?
  [Unknown]:  SE
What is the name of your State or Province?
  [Unknown]:  SE
What is the two-letter country code for this unit?
  [Unknown]:  KR
Is CN=Yang, OU=Devel, O=EL, L=SE, ST=SE, C=KR correct?
  [no]:  y

Enter key password for <tomcat>
	(RETURN if same as keystore password):  

 

키파일 생성시 만들었던 비밀번호를 두 번 입력하면 완료된다.

 

현재 폴더에 tomcat.keystore 라는 파일이 만들어졌다.

다음과 같이 만들어져 있다.

[root@localhost ellord]# pwd tomcat.keystore
/home/ellord
[root@localhost ellord]# 

 

 

 

 

2. 톰캣에 적용

 

톰캣/conf/server.xml 파일을 연다.

    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

 

위와 같이 주석으로 처리된 부분을 찾아 주석을 풀고 끝부분에 아래 항목을 추가한다.

    <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" keystoreFile="/home/ellord/tomcat.keystore" keystorePass="비밀번호"/>

 

비밀번호는 키파일 생성시 만든 비밀번호를 입력한다.

 

 

 

3. 이클립스에서 확인해 본다.

SSL 포트로 8443이 할당되었고, 서버가 시작되었다.

 

 

 

 

 

4. 브라우저에서 확인해 본다.

 

 

된다.

 

'JSP' 카테고리의 다른 글

jsp 형변환  (0) 2015.04.23
JSP 이미지 크기 측정  (0) 2015.04.18
JSP htmlspecialchars  (0) 2015.04.18
JSP 확장자 구하기  (0) 2015.04.18
블로그 이미지

엘로드넷

,

jsp 형변환

JSP 2015. 4. 23. 13:22

int myInt = 0;

String myString = "1";


1. String to Integer


myInt = Integer.parseInt(myString);





2. Integer to String


myString = Integer.toString(myInt);




'JSP' 카테고리의 다른 글

이클립스+톰캣 사설인증서 eclipse + tomcat SSL 적용  (0) 2020.10.25
JSP 이미지 크기 측정  (0) 2015.04.18
JSP htmlspecialchars  (0) 2015.04.18
JSP 확장자 구하기  (0) 2015.04.18
블로그 이미지

엘로드넷

,

JSP 이미지 크기 측정

JSP 2015. 4. 18. 08:27

JSP 이미지 크기 측정

<%@page import=“java.awt.image.BufferedImage” %>
<%@page import=“javax.imageio.ImageIO” %>
<%@page imiport=“java.io.File” %>



String filename = "saved.jpg";
String realFolder = "";
String saveFolder = "filedata/" + filename;            //저장된 파일명
ServletContext scontext = getServletContext();
realFolder = scontext.getRealPath(saveFolder);

int width0 = 0;
int height0 = 0;
File file0 = new File(realFolder);
BufferedImage bi = ImageIO.read(file0);

width0 = bi.getWidth();            //가로크기
height0 = bi.getHeight();          //세로크기



int n_width = 0;
int n_height = 0;


//가로가 세로보다 큰 그림인 경우
if(width0 >= height0){

//가로가 160이상이면 160으로 조정
if(width0 >= 160){
n_width = 160;
n_height = height0*160/width0;
}else{
n_width = width0;
n_height = height0;
}

//세로가 가로보다 큰 그림인 경우
}else{

//세로가 210이상이면 210으로 조정
if(height0 >= 210){
n_width = width0*210/height0;
n_height = 210;
}else{
n_width = width0;
n_height = height0;
}
}

'JSP' 카테고리의 다른 글

이클립스+톰캣 사설인증서 eclipse + tomcat SSL 적용  (0) 2020.10.25
jsp 형변환  (0) 2015.04.23
JSP htmlspecialchars  (0) 2015.04.18
JSP 확장자 구하기  (0) 2015.04.18
블로그 이미지

엘로드넷

,

JSP htmlspecialchars

JSP 2015. 4. 18. 08:21

JSP htmlspecialchars



StringBuffer sb = new StringBuffer();

for(int i=0; i<content.length(); i++){

char c = content.charAt(i);

  switch (c) {

    case '<' : 

      sb.append("&lt;");

      break;

    case '>' : 

      sb.append("&gt;");

      break;

    case '&' :

      sb.append("&amp;");

      break;

    case '"' :

      sb.append("&quot;");

      break;

    case '\'' :

      sb.append("&apos;");

      break;

    default:

      sb.append(c);

}

}



'JSP' 카테고리의 다른 글

이클립스+톰캣 사설인증서 eclipse + tomcat SSL 적용  (0) 2020.10.25
jsp 형변환  (0) 2015.04.23
JSP 이미지 크기 측정  (0) 2015.04.18
JSP 확장자 구하기  (0) 2015.04.18
블로그 이미지

엘로드넷

,

JSP 확장자 구하기

JSP 2015. 4. 18. 08:19

JSP 확장자 구하기 : 


String filePath = "/www/test.jsp";
   int pos = filePath.lastIndexOf( "." );
   String fileExt = filePath.substring( pos + 1 );
   out.println("파일확장자는: "+fileExt);

'JSP' 카테고리의 다른 글

이클립스+톰캣 사설인증서 eclipse + tomcat SSL 적용  (0) 2020.10.25
jsp 형변환  (0) 2015.04.23
JSP 이미지 크기 측정  (0) 2015.04.18
JSP htmlspecialchars  (0) 2015.04.18
블로그 이미지

엘로드넷

,