0
這可能是顯而易見的,但我看不到我的方式到gwt-dispatch ActionHandler.execute()方法中的ServletRequest對象。如何訪問gwt-dispatch ActionHandler <>中的ServletRequest對象?
我需要到servlet的getRemoteHost()方法。
我使用gwt-dispatch v1.0。
這可能是顯而易見的,但我看不到我的方式到gwt-dispatch ActionHandler.execute()方法中的ServletRequest對象。如何訪問gwt-dispatch ActionHandler <>中的ServletRequest對象?
我需要到servlet的getRemoteHost()方法。
我使用gwt-dispatch v1.0。
我想通了這一點......
使用吉斯,注入提供商進入處理程序的構造函數。
Provider<HttpServletRequest> servletRequest
然後在execute方法,使用這樣的供應商...
// request ip address
String ipAddress = servletRequest.get().getRemoteAddr();