Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is this class "HttpContext" exist in glassfish jersey 2.9?

Tags:

jersey

Where is this class "HttpContext" exist in glassfish jersey 2.9 . I was using jersey 1.17.1 to use HttpContext where it was exist in package com.sun.jersey.api.core.HttpContext. But i did't find it in jersey 2.9.

like image 962
TechnoTech Avatar asked Oct 26 '25 12:10

TechnoTech


1 Answers

The direct replacement for HttpContext is not available in Jersey 2.x versions and unfortunately, this breaking change detail hasn't been mentioned anywhere in the migration guide. Instead of searching for direct replacement, if we dig deeper into the interface HttpContext, based on the following method summary method summary refer

we can infer that instead of using HttpContext, we can simply use the following out-of-the-box alternatives.

  • Instead of HttpContext#getRequest use @Context ContainerRequestContext crc
  • Instead of HttpContext#getResponse use @Context ContainerResponseContext crc
  • Instead of HttpContext#getUriInfo use @Context UriInfo uriInfo
  • Instead of HttpContext#getProperties use ContainerRequestContext#getProperty
like image 154
Prasanth Rajendran Avatar answered Oct 28 '25 02:10

Prasanth Rajendran



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!