changing
@Context Request req (which is a org.eclipse.jetty.request) to @Context HttpServletRequest req works even though the first implements the iface.
Question
The following code gives me null pointer exception when I try to get @Context Request req in a jersey resource.
ServletHolder sh = new ServletHolder(ServletContainer.class);
sh.setInitParameter(ServerProperties.PROVIDER_PACKAGES, "com.exchange.server.rest");
Server server = new Server(9999);
ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
server.setHandler(context);
context.addServlet(sh, "/*");
server.start();
server.join();
If I don't mess with the request the resource is working fine.
any thoughts?
Solution
changing
@Context Request req (which is a org.eclipse.jetty.request) to @Context HttpServletRequest req works even though the first implements the iface.