안녕하세요

 

시스템 구성:

 - 테스트서버: 톰캣

 - 리얼서버: 아파치 + 톰캣

 

 

아파치 프로젝트중 httpcomponent을 사용하고 있습니다.

 

테스트서버에서는 정확하게 XML값이 리턴이 되고 있는데, 리얼서버에서는

<html><script lang=javascript>
document.cookie = '_accessKey2=3tSXJ0RQg9dOLarw36fdjQMV1eysHmO8'
window.location.reload();
</script></html>

이런식으로 리턴이 되고 있습니다.

 

구글이나 네이버쪽을 찾아봐도 어떻게 코딩을 수정해야될지 감을 못잡고 있습니다.

쿠키 어쩔고 하는데, 무슨 말인지 이해불가네요..

검색을 하면서 나오는 소스로 테스트를 해봤느데  해결이 안되고 있네요....

어떻게 처리해야 되느지 말로만 하지 마시고, 소스부분도 어떻게 수정해야되는지 설명좀 부탁드립니다.

 

감사합니다.

 

밑에는 소스입니다.

 

 
public class RestClient {
 private static String convertStreamToString(InputStream is) throws IOException {
  BufferedReader reader = new BufferedReader(new InputStreamReader(is));
  StringBuilder sb = new StringBuilder();
  String line = null;
  
  try {
   while ((line = reader.readLine()) != null) {
    sb.append(line + "\n");
   }
  } catch (IOException e) {
   e.printStackTrace();
  } finally {
   if(reader != null) {
    reader.close();
   }
  }
  return sb.toString();
 }
 
 public static void main(String[] args)
 {
  InputStream inputStream = null;
  
  String url="";//로그인 데이타라 삭제 합니다.
  HttpClient httpclient = new DefaultHttpClient();
  HttpGet httpget = new HttpGet(url); 
  HttpResponse response;
  try {
   response = httpclient.execute(httpget);
   System.out.println("Praeda: " + response.getStatusLine().toString());
   HttpEntity entity = response.getEntity();
   if (entity != null) {
    inputStream = entity.getContent();
    String result= convertStreamToString(inputStream);
    System.out.println("result: " + result);
   }

  } catch (ClientProtocolException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (IOException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } finally {
   if(inputStream != null) {
    try {
     inputStream.close();
    } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
    }
   }
  }
 }
}