sitelink1  
sitelink2  
sitelink3  
sitelink4  
sitelink5  
sitelink6  

JSP

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="java.io.*" %>
<%@ page import="java.net.*" %>
<%
    String tfs_url = "요청받을 서비스 페이지 (Servlet 또는 JSP)";
    String patchNums = "넘겨줄 값들(key=value&key=value 형태)";
    
    String stringToReverse = URLEncoder.encode(patchNums, "UTF-8");
    
    URL url = new URL(tfs_url);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
    connection.setDoInput(true);
    connection.setDoOutput(true);

    connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    connection.setRequestMethod("POST");

    OutputStreamWriter osw = new OutputStreamWriter(connection.getOutputStream());
    try {
        osw.write("patchNums=" + stringToReverse);
        osw.flush();
    } finally {
        if (osw != null) osw.close();
    }

    BufferedReader brin = new BufferedReader(new InputStreamReader(connection.getInputStream()));
    String resStr = null;
    StringBuffer resStrBuff = new StringBuffer();
    try {
          while ((resStr = brin.readLine()) != null) {
              resStrBuff.append(resStr);
          }
    } finally {
        if (brin != null) brin.close();
    }
    out.println(resStrBuff);
%>

 

 

 

Servlet

    URL url = new URL("http://[DOMAIN]:[PORT]/tfswit/updatewit?CMD=TFS_PATCH&PP_SEQ=1890");

    HttpURLConnection connection = (HttpURLConnection) url.openConnection();

    connection.setDoInput(true);

 

    BufferedReader brin = new BufferedReader(new InputStreamReader(connection.getInputStream()));

    String resStr = null;

    StringBuffer resStrBuff = new StringBuffer();

    try {

        while ((resStr = brin.readLine()) != null) {

            resStrBuff.append(resStr);

        }

    } finally {

        if (brin != null) {

            brin.close();

            brin = null;

            connection = null;

            url = null;

            resStr = null;

        }

    }

 

    String tfsPatch = null;

    if (resStrBuff != null)

        tfsPatch = resStrBuff.toString();

 

 

번호 제목 글쓴이 날짜 조회 수
251 Calendar, Date, Format, java.time 패키지 황제낙엽 2017.10.31 108
250 날짜, 시간 문자열 값으로 Date 오브젝트로 만들기 >> SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.US) 황제낙엽 2017.10.31 1516
249 시스템 속성(System Property) 클래스를 이용하여 jni 라이브러리 사용하기 황제낙엽 2017.09.22 37
248 Java 실행 옵션들 황제낙엽 2017.08.23 3367
247 HttpsURLConnection 을 사용한 SSL서버 접속 file 황제낙엽 2017.08.02 231
246 서버구동시 주기적으로 동작을 수행하는 스레드를 함께 실행하는 서블릿 황제낙엽 2017.08.02 131
» HttpURLConnection 사용 샘플( JSP , SERVLET ) 황제낙엽 2017.08.01 254
244 HttpURLConnection 사용하기 황제낙엽 2017.08.01 393
243 [HttpURLConnection] POST로 파라미터 넘기기 황제낙엽 2017.08.01 507
242 HttpURLConnection POST 방식 사용하기 황제낙엽 2017.08.01 370
241 Runtime 클래스를 이용한 윈도우 프로그램 실행 예제 황제낙엽 2017.08.01 113
240 JSON Util (JSON 을 다루기 위해 직접 작성한 유틸 클래스) file 황제낙엽 2017.07.10 461
239 자바 리플렉션(Java Reflection) 간단한 설명 및 사용방법 정리 file 황제낙엽 2017.07.10 135
238 Generate random numbers (Random.java) 황제낙엽 2017.07.02 490
237 쓰레드(Thread)를 중간에 종료시키는 방법 황제낙엽 2017.03.15 5127
236 JSON 라이브러리(API) 종류 황제낙엽 2017.01.18 404
235 [JSON기초04] 자바 JSON 데이터에서 KEY 값 알아오기 (TIP) 황제낙엽 2017.01.18 6641
234 [JSON기초03] 자바 JSON Google Simple JSON을 이용한 간단한 JSON DATA 파싱 황제낙엽 2017.01.18 566
233 [JSON기초02] 자바 JSON Google Simple JSON을 이용한 간단한 JSON DATA 생성 황제낙엽 2017.01.18 111
232 [JSON기초01] JSON이란? XML이란? JSON 개념, XML 개념 설명 황제낙엽 2017.01.18 408