Hi,

thank you very much for pointing me for using @Context.
It's work...

@PUT
@Produces(MediaType.APPLICATION_JSON)
@Path("doSomething")
public String doSomething(@QueryParam("actionId") Long customerId,
                                 @Context HttpServletRequest request) {
  String ipAddress = request.getRemoteAddr();
}

Best regards,
Yohan Yudanara


2011/12/28 Bård Magnus Kvalheim <mag...@kvalheim.eu>

> Hi Yohan,
>
> Havent tried but you should be able to get it from
> @Context HttpServletRequest request
>
> http://docs.jboss.org/resteasy/docs/2.3.0.GA/userguide/html_single/index.html#_Context
>
> Think context injection works on resource method as well as members.
>
> Then use request.getRemoteAddr()
>
> Guess you could also use tapestry inject for getting httpservletrequest.
>
> Tip
> With resteasy you can register providers that can intercept all resource
> method invocations. That way you can handle logging from a single place.
>
> http://docs.jboss.org/resteasy/docs/2.3.0.GA/userguide/html_single/index.html#Interceptors
>
>
>
> Hope it helps
>
> Cheers and merry christmas
> Magnus
>
> On Tue, Dec 27, 2011 at 9:48 AM, Yohan Yudanara <yohan.yudan...@gmail.com
> >wrote:
>
> > Hi,
> >
> > I want to ask a question about tapestry-resteasy library from tynamo (
> > www.tynamo.org)
> > Is it possible to get client IP Address on tapestry-resteasy resource
> > class?
> > I need the IP address of incoming request for logging purpose.
> >
> > Thanks in advance
> >
> > Best regards,
> > Yohan Yudanara
> >
>

Reply via email to