• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Sending email through springboot and angular

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.







 
Sheriff
Posts: 22818
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@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).
 
Henna Ghayas
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for replying, could you explain what the complains property is? I have never heard of it
 
Henna Ghayas
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I mean consumes
 
Rob Spoor
Sheriff
Posts: 22818
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Henna Ghayas
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Rob Spoor
Sheriff
Posts: 22818
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Open your browser's development tools and check what the POST request actually contains.
 
I love a woman who dresses in stainless steel ... and carries tiny ads:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic