3

I need to get HTTP Headers in my Helidon MP project. How can I get HttpServletRequest object to extract the headers from there?

I have tried to look at the API but I have not found Servlet at all!

greybeard
  • 2,249
  • 8
  • 30
  • 66

1 Answers1

1

Helidon is not a Servlet Container, so there is no Servlet in it, and thus you can't access HttpServletRequest.

Helidon MP is a MicroProfile implementation, which means by definition that it is also a Jakarta RESTful Web Services implementation (formerly JAX-RS)—it packages Jersey. By the time you're talking about requests and responses, you are "in" Jersey, and so you do things the Jersey way;

So then: most, if not all, of the things you can do with an HttpServletRequest you can do with equivalent Jakarta RESTful Web Services constructs. For example, you can @Inject an instance of HttpHeaders to get the HTTP headers you need.

Please check https://github.com/helidon-io/helidon/wiki/FAQ for more details.