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