Search code examples
gwtgwt-platform

Server side session management in GWTP


Hello I am using GWTP for my application development. In the application I am in need to server side session instance to put some data in that session instance. I saw some examples of GWT where there is Action class which extends ActionSupport class. There are some method in the examples through which we can have the server side session instance.Like below :

public HttpServletRequest getRequest() {
        return ServletActionContext.getRequest();
    }

public HttpServletResponse getResponse() {
    return ServletActionContext.getResponse();
}

public HttpSession getSession() {
    HttpSession session = getRequest().getSession();
    return session;
}

But I am not getting the similar thing in GWTP. Please help me out. Thanks in Advance.


Solution

  • Finally I got some thing which is helping me.I am sharing this here.

    private Provider<HttpServletRequest> requestProvider;
    private ServletContext servletContext;
    
    
    @Inject
    public LoginCallerActionHandler(
            Provider<HttpServletRequest> requestProvider,
            ServletContext servletContext) {
        super();
        this.requestProvider = requestProvider;
        this.servletContext = servletContext;
    }
    

    Here is my action handler class.In which i can use session.

    servletContext.setAttribute(SessionKeys.LOGGEDIN_USER.toString(), returnObject.getLoggedInUser());