dev@jersey.java.net

How to retrieve user info from your WS

From: Jerry Atrick <jjunos_at_gmail.com>
Date: Mon, 17 Nov 2008 15:37:07 -0500

So normally in a servlet, I'd do a simple:

HttpServletRequest request;

request.getRemoteAddr();

to retrieve the user currently hitting my WS.


How would I do the same from a jersey webservice?

I originally attempted to do something like:

@GET
    @ProduceMime("text/xml" )
    @Path("/ftpRestart" )
    public String echoCallingIP(@Context HttpRequestContext context ) {

context.getRequest();

}

But the HttpRequestContext reveals nothing useful at all here.

I'm sure there's a way to do this, but perhaps I'm just going about it the
wrong way. Anyone have any clues on how to do this (I swear this should be a
lot simpler than I'm making it out to be).

Junos