users@jersey.java.net

[Jersey] Re: _at_Context HttpServletRequest request is null

From: Mark Thornton <mthornton_at_optrak.com>
Date: Tue, 15 Dec 2015 15:32:26 +0000

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?
>
> thanks
> Jeff
>