I've been trying to find solutions to this error and can not find it.
Error:
2018-07-24 16: 44: 50,541 WARN 25695 --- [nio-8080-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver: Resolved caused caused by Handler execution: org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'text / plain; charset = UTF-8' not supported
Algorithm in tscript that is called after a button click:
uploadKeySize(e) {
let keySize = parseInt(e.target.value);
console.log(keySize);
this.fileService.sendInfoToGenKey(keySize).toPromise()
.then(
data => {
console.log(data);
});
}
file service method that is called and that communicates with the back:
sendInfoToGenKey(sizeKey: number) {
return this.http.put('http://localhost:8080/operation/request-RSA-keys', sizeKey);
}
Code:
@RequestMapping(value = "/request-RSA-keys", method = RequestMethod.PUT)
public static KeyPair generateRSAKeys(@RequestBody int sizeKey) throws NoSuchAlgorithmException {
System.out.println(sizeKey);
return KeyGenerator.generateKey("RSA", sizeKey);
}