Quantcast
Channel: Active questions tagged servlets - Stack Overflow
Viewing all articles
Browse latest Browse all 717

Access UriInfo from a HttpServlet [duplicate]

$
0
0

I need to acess the UriInfo from my HttpServlet, but whenever I try to inject it, the object is null.

Is there a way to access it from a HttpServlet? Am I missing something?

import javax.servlet.http.HttpServlet;@Slf4j@Configurationpublic class CustomServlet extends HttpServlet {    @Autowired    private OpenApiConfig openApiConfig;    @Autowired    SwaggerModelConfig swaggerModelConfig;    @Context    UriInfo uriInfo;    @Override    public void init(ServletConfig config) throws ServletException {        super.init(config);        SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext());    }    @Override    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {        // need to access UriInfo here    }}

Viewing all articles
Browse latest Browse all 717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>