javaspringsap-commerce-cloudbackofficeimpex

login and checkout user redirecting to home page how to redirect to cart page in sap hybris


here in my case. in this method

onAuthenticationSuccess(final HttpServletRequest request, final HttpServletResponse response, final Authentication authentication) throws IOException, ServletException {
     final RequestCache requestCache = new HttpSessionRequestCache();
     final SavedRequest savedRequest = requestCache.getRequest(request, response);

i am getting savedRequest is NULL how to get my expected result


Solution

  • In CheckoutLoginController.java, add private static final String REFERER = "referer";

    In doCheckoutLogin method, add request.getSession().setAttribute("redirectTargetUrl", request.getHeader(REFERER));

    After this, the request will be added to the session.