hello everyone
my code is :
public ResponseEntity Login(String address, Map map) { try { logger.info("Login : " + address); RestTemplate restTemplate = new RestTemplate(); HttpHeaders requestHeaders = new HttpHeaders(); //requestHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8); String bodyData = new JSONObject(map).toString(); HttpEntity requestEntity = new HttpEntity(bodyData, requestHeaders); ResponseEntity response = restTemplate.postForEntity(address, requestEntity, type); logger.info("Login.Response - " + address + " : " + response.getStatusCode() + " : " + (response.hasBody() ? response.getBody() : "")); return response; } catch (Exception ex) { logger.error("Login : " + address, ex); return null; } }
and the exception is : 415 UNSUPPORTED_MEDIA_TYPE
415 : [no body]
and headers :
Content-Length -> {LinkedList@10159} size = 1
Date : Sat, 25 Jan 2020 19:04:01 GMT
when I call it as GET method, it works after many try, and finally I can get the Bonita Api Token. but when I call it with above code, it doesn't work.
please help. please show me your code in java. how can I login to bonita in java?