[JEUS] Connection reset by peer 오류 해결

IT/WAS | 2012. 7. 16. 13:48
Posted by 까군

 

[현상]
* 속성조회 시 축척이 1000미만인 경우에는 문제 없었으나 2000부터는 아래와 같은 오류 발생.

ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error

[원인]
"ClientAbortException: java.net.SocketException"으로 구글링 결과 아래 내용 발견

Usually, this kind of behaviour occurs when one of the following happens
1.When user make a request, and suddenly browser get closed by user accidentally or due to browser crash
2.When user make a request, and browser closes the http connection automatically due to exceeded content length size
3.When user make a request, and presses the stop button

1.번은 아니라고 하니 2.번일 가능성이 큼.

[해결방안]
1. response.setHeader("Content-Lenght",2048);
2. 제우스 설정파일 수정
WEBMain.xml
<webtob-listener>
...
<output-buffer-size>2048</output-buffer-size>  //단위는 byte
...
</webtob-listener>
output-buffer-size 값 조정

* <output-buffer-size>는 클라이언트에게 데이터를 내보낼 때 여기에 설정한 사이즈만큼 쪼개서 보내는 역할을 하는 옵션으로 "0"으로 설정할 경우 대용량 파일 다운로드와 같은 경우 OutOfMemory발생의 위험이 있음.
("0"으로 설정하면 모든 데이터를 힙메모리에 저장해둔 다음 처리 한다고함)

 

창조적 발상은 아주 간단하다.

명언 | 2012. 7. 16. 09:59
Posted by 까군

 

창조적 발상은 아주 간단하다.

창조적 발상은 아주 간단하다.
고정관념에서 벗어나는 것이다.
이미 알고 있는 것을 낯설게 만드는 것이다.

-
이어령, ‘우물을 파는 사람’에서
 

[eGovFrame] 쿠키 사용 제한

IT/FrameWork | 2012. 7. 13. 11:58
Posted by 까군

수정중...


[현상]
컨트롤러단에서 쿠키에 값을 집어넣기 위해
response.addCookie(이름,값)해도 쿠키가 생성되지 않아 당황스러움..

[원인]
스프링에서는 컨트롤러에서 쿠키에 값 Set처리하는게 안된다고 함..
인터셉터나 Jsp에서 하는 건 가능하다고 하나..
전자정부표준v2.0에서 제공하는 jsp샘플을 통해 테스트해도 생성되지 않아 더 당황스러움..

[결론]
CookieGenerator 클래스이용..하거나 Service가 아닌 jsp에서 직접 쿠키 생성.

1. CookieGenerator 이용
CookieGenerator cg =
new CookieGenerator();

cg.setCookieName("쿠키이름");
cg.addCookie(response, 값);

참조URL : http://static.springsource.org/spring/docs/1.1.x/api/org/springframework/web/util/CookieGenerator.html 

2. jsp에서 직접 쿠키 이용

EgovCookieProcessCusotm.jsp

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8" session="false" %>
<%@ page import="egovframework.com.utl.cas.service.EgovSessionCookieUtil"  %>
<%@ page import="java.util.*"  %>
<%@ page import="java.net.*"  %>
<%!
    String safeGetParameter (HttpServletRequest request, String name){
        String value = request.getParameter(name);
        if (value == null) {
            value = "";
        }
        return value;
    }
%>
<%!
    void setCookie (HttpServletRequest request, HttpServletResponse response, String cookieNm, String cookieVal, int period){
   
        Cookie cookie = new Cookie(cookieNm, cookieVal);
        cookie.setMaxAge(60*period);
        cookie.setPath("/");
        response.addCookie(cookie);
    }


 
 String getCookie (HttpServletRequest request, String cookieNm ) {  
  Cookie[] cookies = request.getCookies();
  if(cookies == null){
   return "";
  }
  String cookieValue = null;
  
  for (int i=0; i < cookies.length; i++) {
   if(cookieNm.equals(cookies[i].getName())) {
    
    cookieValue = cookies[i].getValue();
   }
  }
  
  return cookieValue;
 }

 void delCookie (HttpServletResponse response, String cookieNm){
    Cookie cookie = new Cookie(cookieNm, "");
    cookie.setMaxAge(-1); // 0 : 쿠키 삭제 , -1 : 쿠키 파일 생성 안됨. 브라우저 닫힌 후 삭제(default)
    cookie.setPath("/");
    response.addCookie(cookie);
}

%>

 

 

블로그 이미지

까군

카테고리

분류 전체보기 (62)
IT (21)
생활 (0)
명언 (41)