users@jersey.java.net

Re: [Jersey] HttpServletRequest.getAttributes

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Fri, 10 Sep 2010 11:42:35 +0200

Hi John,

You can inject HttpServletRequest:

  @Context HttpServletRequest hsr;

https://jersey.dev.java.net/nonav/documentation/latest/user-
guide.html#d4e499

Paul.

On Sep 10, 2010, at 12:47 AM, John Calcote wrote:

> Hi all -
>
> Is there any way, from within a Jersey resource handler, to get at
> the attributes of the underlying HttpServletRequest object?
>
> I'm working on a system that has an extremely tight set of container
> constraints. I can't modify things the way I'd be able to if I were
> writing a servlet for a dedicated servlet container. As it is, I'm
> in a jetty container that's controlled by another application and I
> can't go adding code to the server.xml file to enable various
> authentication schemes etc. Thus, I can't turn on certificate
> authentication at the container level. The best I can do is try to
> read the "javax.servlet.request.X509Certificate" attribute from the
> HttpServletRequest object's attribute list, then detect the various
> certificate attributes and authenticate the client from within my
> servlet.
>
> Thanks in advance,
> John