简体   繁体   中英

Helidon HttpServletRequest headers

I heed to get 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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM