On May 14, 2008, at 1:33 PM, Zach Cox wrote:
> I'm new to Jersey, just playing around to learn more (using 0.8). I'm
> currently just using the simple HttpServer to launch my little test
> app:
>
> HttpServer server = HttpServerFactory.create("http://localhost:
> 9998/");
> server.start();
>
> I then have a resource class that gets a HttpServletRequest field
> injected:
>
> @Path("something")
> public class MyResource
> {
> @Context
> HttpServletRequest request;
> }
>
> That request field is always null. Is this just an effect of using
> HttpServer and not using a proper container like Jetty or Tomcat? Or
> am I doing something wrong?
>
As you guessed, HttpServletRequest is only available when running in a
Servlet container.
Marc.
---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.