كيفية الوصول إلى كائن ServleTRequest في GWT-Dispatch ActionHandler <>؟

StackOverflow https://stackoverflow.com/questions/2830660

سؤال

قد يكون هذا واضحًا ، لكن لا يمكنني أن أرى طريقي إلى كائن ServletRequest داخل طريقة GWT-Dispatch ActionHandler.execute ().

أحتاج إلى الوصول إلى طريقة Servlet's GetRemoteHost ().

أنا أستخدم V1.0 من GWT-Dispatch.

هل كانت مفيدة؟

المحلول

لقد اكتشفت هذا ...

باستخدام Guice ، حقن مزودًا في مُنشئ المعالج.

Provider<HttpServletRequest> servletRequest

ثم في طريقة التنفيذ ، استخدم الموفر مثل هذا ...

// request ip address
String ipAddress = servletRequest.get().getRemoteAddr();
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top