Ok. thanks Mark
Does anyone know how i can create a servlet container and still use my own ResourceConfig in Jersey?
I just used the Jetty server which failed for the same reason:
Server server = JettyHttpContainerFactory.createServer(BASE_URI, theApp);
I need the HttpServletRequest to be injected. At the same time i want ResourceConfig's ability to create Singleton's out of my resources
thanks
Date: Tue, 15 Dec 2015 15:32:26 +0000
From: mthornton_at_optrak.com
To: users_at_jersey.java.net
Subject: [Jersey] Re: @Context HttpServletRequest request is null
As far as I know there is no requirement for the container to be a servlet container and when it isn't the lack of an HttpServletRequest is not surprising.
Mark Thornton
On 15 December 2015 at 15:03, jeff saremi <jeffsaremi_at_hotmail.com> wrote:
so far i have tried these two containers to no avail:
ResourceConfig theApp = new ApiApp(appParams);
HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, theApp);
SimpleServer server = SimpleContainerFactory.create(BASE_URI, theApp);
From: jeffsaremi_at_hotmail.com
To: users_at_jersey.java.net
Date: Mon, 14 Dec 2015 15:43:32 -0500
Subject: [Jersey] @Context HttpServletRequest request is null
From the printed stack trace i can see the nullpointeexception is throw on the following line:
String addr = request.getRemoteAddr();
which is the first line in my method:
@Path("parse") @POST @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) public String parse(String jsonInput, @Context HttpServletRequest request) {
How can it get the proper object?
thanksJeff