I am creating a contact form for a project that i am doing for school, but in our project we are using jhipster. jhipster uses springboot and angular and even though i have experience with spring boot, angular is giving me problems. My problem in my code is that it is not sending the email that i have made in my java implementation. When i press submit it defaults to my fallback error. Since I am new to angular I am having trouble understanding where the problem is generating from. Please help me, i have been trying for two weeks now with no success.
@RequestMapping requires you to set the allowed HTTP methods when used on a method level. You should use either @RequestMapping(path = "/api/contact", method = RequestMethod.POST), or shorter @PostMapping("/api/contact"). You might then run into 415 errors; that can be solved by setting the consumes property correctly (to HttpMethod.APPLICAITON_JSON_VALUE).
The consumes property is used to define which request Content-Type headers are accepted. Likewise, the produces property is used to define what Content-Type the response has.
I actually don't know what happens if you don't define any consumes for a POST or PUT request. It may accept everything, or it may accept nothing. If you want to accept any Content-Type header you can use MediaType.ALL_VALUE.
Hi, i know this is a long time after but I wanted to ask, I was actually able to get the email sent but now the contents of the message are all null, do you have any idea of a reason that could happen?