Session destroyed after redirection

48 Views Asked by At

I'm facing an issue in a new application I'm working on it. I made a new entry point (used for a non logged user) and I want to store a value in the user session (value comes from a path param).

So, my entry point like this :

@GET
@Path(MYPATH + "/{" + VALUE + "}")
public Response myEntryPoint(@PathParam(VALUE) String value, @Context HttpServletRequest httpServletRequest, @Context HttpServletResponse response) {
    httpServletRequest.getSession().setAttribute(URL, value);
        LOGGER.info(HttpServletRequest.getSession().getId());
        return Response.seeOther(new URI(the login system)).build();
}

The "login system" is another application and will perform some actions like the login of the user and then call another endpoint of my application. My goal is to retrieve the value put on the session. So, I wrote the following code :

@GET
@Path(action)
public Response action(@Context HttpServletRequest request) {
    LOGGER.info(request.getSession().getId());
    String value = (String) request.getSession().getAttribute(URL);

}

I would expected the value contained the value given on parameter on the myEntryPoint call. But, as you can imagine, the String value is empty and if I check the session ids of the requests (myEntryPoint & action) are differents. When the action method is called, a lot of filter chained are called. Do you know what I did wrong? I tried the same exercice with cookies in place of session, but without success. Value is still empty.

Do you have any idea / suggestion?

Thanks in advance

0

There are 0 best solutions below