Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top