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();