HTTPClient를 이용할때,  한글이 깨지는 현상이 있어서..

다음과 같이 처리했다.

 

Before

<%

 

 try {
    HttpClient client = new HttpClient();
   client.setTimeout(3000);
   GetMethod m = new GetMethod(content);
   int status = client.executeMethod(m);
   
   if (status == HttpStatus.SC_OK) {
      
    body = m.getResponseBodyAsString();
    m.releaseConnection();
    out.println("<base href="+dir+">");
    out.println(body);
   }
  }
  catch (Exception e) {
   System.out.println(e);
  }

%>

 

 

 

After

<%

String content = "";  

  if (url.indexOf("/community") != -1 ) {
   content = host + url;
  }
  else {
   content = host + "/static" + url;
  }

%>

 

<c:import url="${content}" charEncoding="MS949"/>

 

 

 

 

 

 

'web' 카테고리의 다른 글

자바 - include 관련  (1) 2007.09.28
외부 컨텐츠를 가져오는 법  (0) 2007.09.28
SSL (c, java)  (0) 2007.09.28
아파치 래퍼럴 (apache referal)  (0) 2007.09.27
외부싸이트에서 호출되는 것 확인하기  (0) 2007.09.22
Posted by '김용환'
,