facebookarchive / nifty

Thrift on Netty

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how can i get the client ip address?

cnJun opened this issue · comments

how can i get the client ip address from my service implement?

There is now a way as of the merge of #57:

RequestContext.getCurrentContext().getRemoteAddress()

It uses a static thread-local, so it will of course only work if you ask for the context from the thread on which nifty original calls your handler.

RequestContexts.getCurrentContext().getRemoteAddress();