GET setAttribute 메서드 로 request에 Attribute를 저장 할 수 있다.
POST는 헤더는 물론
body는 HttpsUrlConnetion객체에 OutputStream을 연결해서,
파라미터들을 byte 형식으로 써주는 형식으로 body에 데이터를 전송 가능하다.
con = (HttpsURLConnection) reqestUrl.openConnection();
...생략....
if(isBodyData == true){
DataOutputStream out = null;
try {
out = new DataOutputStream(con.getOutputStream());
out.writeBytes((String)param);
out.flush();// 버퍼 비움. 전송!
} catch (IOException e) {
e.printStackTrace();
} finally {
closeOutStream(out);
}
}else {
HashMap<String, String> header = (HashMap<String, String>)param;
for (String key : header.keySet()){
con.setRequestProperty(key, header.get(key));
}
}
}
'Today I learned' 카테고리의 다른 글
코드를 작성할때, 코드의 이해를 돕기위해 반드시 주석을 달아야 한다. (0) | 2019.01.16 |
---|---|
Mybatis Mapping시 resultType과 parameterType이 같으면, DBMS에서는 쿼리가 정상적으로 동작함에도 제대로 setter/getter를 할 수 없다. (0) | 2019.01.15 |
DB 에서 컬럼타입이 DATA이면 JAVA에서 맵핑해서 가져올 객체는 String이여야 한다. (0) | 2019.01.15 |
반복문에서 break와 switch (0) | 2019.01.13 |
PL/SQL에서 변수명과 프로시저명이 같으면 안된다. (0) | 2019.01.12 |
댓글