get인 경우 분기처리
This commit is contained in:
parent
9c2d1c48af
commit
0cc3baf6aa
@ -40,14 +40,20 @@ public class InterfaceQsp {
|
|||||||
con.setRequestMethod(httpMethod.toString());
|
con.setRequestMethod(httpMethod.toString());
|
||||||
con.setRequestProperty("Content-Type", "application/json");
|
con.setRequestProperty("Content-Type", "application/json");
|
||||||
con.setDoInput(true);
|
con.setDoInput(true);
|
||||||
con.setDoOutput(true); // POST 데이터를 OutputStream으로 넘겨 주겠다는 설정
|
|
||||||
con.setUseCaches(false);
|
con.setUseCaches(false);
|
||||||
con.setDefaultUseCaches(false);
|
con.setDefaultUseCaches(false);
|
||||||
|
|
||||||
ObjectMapper om = new ObjectMapper();
|
if (HttpMethod.GET.equals(httpMethod)) {
|
||||||
osw = new OutputStreamWriter(con.getOutputStream());
|
con.setDoOutput(false);
|
||||||
osw.write(om.writeValueAsString(requestObject)); // json 형식의 message 전달
|
} else {
|
||||||
osw.flush();
|
con.setDoOutput(true); // POST 데이터를 OutputStream으로 넘겨 주겠다는 설정
|
||||||
|
if (requestObject != null) {
|
||||||
|
ObjectMapper om = new ObjectMapper();
|
||||||
|
osw = new OutputStreamWriter(con.getOutputStream());
|
||||||
|
osw.write(om.writeValueAsString(requestObject)); // json 형식의 message 전달
|
||||||
|
osw.flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sb = new StringBuilder();
|
sb = new StringBuilder();
|
||||||
if (con.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
if (con.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user