'SessionStorage is Null

First of all I'm saving a user in SessionStorage in React. The problem is that I'm trying to make a filter that validates some data in the user saved in SessionStorage.

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterchain)
            throws IOException, ServletException {
        HttpServletRequest httpServletRequest = (HttpServletRequest) request;
        String urlRequest = String.valueOf(httpServletRequest.getRequestURL());
        HttpSession sesion = ((HttpServletRequest) request).getSession();

        
        System.out.println(sesion.getAttribute("id")); // This is null

        
        filterchain.doFilter(request, response);
    }

The thing is that the session always returns null



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source