0

I have an issue trying to send an HTTP POST request with Angular 5 and getting it with Jersey 2.26, but for some reason the header params are null.

Do you have any idea what is happening?

I have attached some screenshots of both angular and jersey.

Angular

Angular

Jersey

Jersey

Note: I could not add a new comment (I don't know why) so I publish the solution.

Thanks for your suggestions, I solved the issue adding id_token, use_cases as allowed parameters in Access-Control-Allow-Header tag inside standalone-full.xml (wildfly 11) and filtering only POST, GET, UPDATE, PUT methods in a custom ContainerRequestFilter, as follow:

public void filter(ContainerRequestContext requestCtx) throws IOException {
    if (!requestCtx.getRequest().getMethod().equals(HttpMethod.OPTIONS)) {

        String path = requestCtx.getUriInfo().getPath();
Community
  • 1
  • 1
  • Is this a `Java` or `Javascript` problem? – SedJ601 Mar 06 '18 at 19:30
  • You have a CORS problem. What you're seeing is the preflight OPTIONS request. See https://stackoverflow.com/questions/28065963/how-to-handle-cors-using-jax-rs-with-jersey/28067653#28067653 – Paul Samsotha Mar 06 '18 at 20:55
  • Also you're not even use Jersey, though you think you might be. I see the class `ResteasyHttpHeaders` class in your debugger, which means your using RESTEasy. – Paul Samsotha Mar 06 '18 at 20:57
  • Thanks for your suggestions, I solved the issue adding id_token, use_cases as allowed parameters in Access-Control-Allow-Header tag inside standalone-full.xml (wildfly 11) and filtering only POST, GET, UPDATE, PUT methods in a custom ContainerRequestFilter – Daniel Heraldo Moreno Rojas Mar 06 '18 at 21:57

0 Answers0