Web/Tomcat 2013. 8. 9. 12:28

서블릿에서 get 메소드 호출을 받았을때 request.getParameter("키값") 을 했을때 결과 값이 UTF-8 한글일 경우 글자가 깨지는 증상 발생.


HttpServletRequest 의 getParameter을 쓰지말고 직접 query string을 사용..


String queryString = URLDecoder.decode(request.getQueryString(), "UTF-8");

String filename = Util.getQueryMap(queryString).get("filename");

posted by hani^___^
:
Web/Tomcat 2012. 7. 12. 11:57

아래 XXX를 알맞은 문자셋으로 바꿔주고

catalina.sh 파일의 JAVA_OPTS 에 -Dfile.encoding=XXX 을 추가해준다.

그리고 톰캣 재시작..

'Web > Tomcat' 카테고리의 다른 글

서블릿 get 요청에서 UTF-8 한글 parameter value 깨짐  (0) 2013.08.09
SEVERE: Error listenerStart 발생시 로그로 원인 파악하기  (0) 2012.07.09
톰켓 DIGEST 인증  (0) 2012.07.03
톰캣 인증 추가  (0) 2012.07.03
tomcat 설치  (0) 2012.07.03
posted by hani^___^
:
Web/Tomcat 2012. 7. 9. 15:06


logging.properties


톰캣 구동시 SEVERE: Error listenerStart 가 발생 할경우, 원인을 찾는데 많은 시간을 소비한다.


이를 빨리 캐치하기 위해서 다음 작업을 해준다.


첨부된 logging.properties 파일을 /WEB-INF/classes 폴더에 복사하고 실행한다.


그러면, 톰캣 실행시 실패 로그를 확인할 수 있다. 


대부분 "class-not-found" 관련 오류일 것이다.

posted by hani^___^
:
Web/Tomcat 2012. 7. 3. 16:58

1. $CATALINA_HOME/conf/web.xml 파일을 연다

아래 내용 추가

...

<security-role>

<role-name>member</role-name>

</security-role>

<login-config>
<auth-method>DIGEST</auth-method>

<realm-name>Authorized members only Area</realm-name>

</login-config>
<security-constraint>

<web-resource-collection>
<web-resource-name>Entire Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>

<auth-constraint>
<role-name>member</role-name>
</auth-constraint>
</security-constraint>

...

2. $CATALINA_HOME/conf/server.xml 파일을 열고 볼드체 문장을 추가한다.

<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
digest="MD5" resourceName="UserDatabase"/>

아래의 문장을 둘러싼 주석을 해제한다. 아래가 없으면, 페이지를 오픈할때마다 인증창이 떠서 인증을 해야한다.

<Valve className="org.apache.catalina.authenticator.SingleSignOn" />

3. urPassword를 자신에 맞는 암로호 바꾸고 아래를 실행 해서 나오는 볼드체 문장을 복사

> $CATALINA_HOME/bin/digest.sh -a MD5 myid:"Authorized members only Area":mypassword

myid:Authorized members only Area:mypassword:845ef611d43fe7387ca20c1c0dd76886

4. $CATALINA_HOME/conf/tomcat-users.xml 에 다음을 추가

...

<role rolename="member"/>
<user username="myid" password="845ef611d43fe7387ca20c1c0dd76886" roles="member"/>

...

5. 톰캣 재시작..

희한하게도 SHA 인증은 죽어도 안된다. 오직 MD5만 성공했다.

posted by hani^___^
:
Web/Tomcat 2012. 7. 3. 16:58

web.xml 파일 편집


> vi $CATALINA_HOME/conf/web.xml


아래를 추가..

...


<security-role>

<description/>

<role-name>role 이름</role-name>

</security-role>

<login-config>

<!-- Auth type: BASIC, DIGEST, CLIENT-CERT, FORM -->

<auth-method>DIGEST</auth-method>

<realm-name> DIGEST Authentication </realm-name>

</login-config>

<security-constraint>

<display-name>display-name</display-name>

<web-resource-collection>

<web-resource-name>AdminResource</web-resource-name>

<description/>

<url-pattern>/*</url-pattern>

<http-method>GET</http-method>

<http-method>POST</http-method>

<http-method>HEAD</http-method>

<http-method>PUT</http-method>

<http-method>OPTIONS</http-method>

<http-method>TRACE</http-method>

<http-method>DELETE</http-method>

</web-resource-collection>

<auth-constraint>

<description />

<role-name>Admin</role-name>

</auth-constraint>

</security-constraint>

...


tomcat-users.xml 파일 편집


> vi $CATALINA_HOME/conf/tomcat-users.xml


아래를 추가..


...

<role rolename="role 이름"/>

<user username="아이디" password="패스워드" roles="role 이름" />

...


posted by hani^___^
:
Web/Tomcat 2012. 7. 3. 16:55

http://blog.sixpoly.com/?p=292

posted by hani^___^
: