开发者

RESTEasy and client IP address

I'm using RESTEasy services in my application and now I'm forced to get the clients IP addresses. So the 开发者_StackOverflowquestion is... how can I do that?. Thanks in advance

EDITED I've just came to a solution with servlet filter... but still.. can that be done inside of RESTEasy service?


You can annotate a Context in your resource like this:

@GET
@Path("/{id}")
public Response getMe(
            final @PathParam("id") String id,
            @Context HttpServletRequest req) {

     System.err.println(req.getRemoteAddr());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜