문제

I need to access HttpRequest object in Action handlers in server side of GWTP.

how can I access this information.

For every interaction with server, I need request object.

Please help me.

Using RPC with servlets its absolutely fine we can, but I need it with ActionHandler in GWTP.

도움이 되었습니까?

해결책

public class MyHandler extends
  AbstractActionHandler<MyAction, MyResult> {


  @Inject
  Provider<HttpServletRequest> requestProvider;

  @Override
  public MyResult execute(MyAction action,  ExecutionContext context) throws ActionException 
  {
      HttpSession session = requestProvider.get().getSession();
  }
}

If you use Spring, you need also

<listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>

in web.xml

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top