728x90
반응형

Spring RestTemplate으로 양식 데이터를 POST하는 방법
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
MultiValueMap<String, String> map= new LinkedMultiValueMap<String, String>();
map.add("email", "first.last@example.com");
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<MultiValueMap<String, String>>(map, headers);
ResponseEntity<String> response = restTemplate.postForEntity( url, request , String.class );
https://stackoverflow.com/questions/38372422/how-to-post-form-data-with-spring-resttemplate
How to POST form data with Spring RestTemplate?
I want to convert the following (working) curl snippet to a RestTemplate call: curl -i -X POST -d "email=first.last@example.com" https://app.example.com/hr/email How do I pass the email parameter
stackoverflow.com
728x90
반응형
'Framework > Spring' 카테고리의 다른 글
| spring mybatis 특정 sql log 숨기기 (0) | 2023.08.04 |
|---|---|
| Interceptor에서 request url에 jsp 경로로 여러번 호출될때 (0) | 2023.08.04 |
| 톰캣 9.0 한글 깨짐 및 logback 한글깨짐 (0) | 2023.07.26 |
| spring 전자 정부 파일이미지 (0) | 2023.04.01 |
| Spring 서버 to 서버 파일 전송 (0) | 2023.04.01 |