登录并结账用户后重定向到主页,如何重定向到SAP Hybris中的购物车页面。

huangapple go评论89阅读模式
英文:

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

问题

在我的情况下在这个方法中
```java
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);

我得到的savedRequest为NULL,如何获取我期望的结果


<details>
<summary>英文:</summary>

here in my case. in this method  
```java
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

答案1

得分: 1

CheckoutLoginController.java中,
添加private static final String REFERER = "referer";

doCheckoutLogin方法中,添加request.getSession().setAttribute("redirectTargetUrl", request.getHeader(REFERER));

之后,请求将被添加到会话中。

英文:

In CheckoutLoginController.java,
add private static final String REFERER = &quot;referer&quot;;

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

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

huangapple
  • 本文由 发表于 2020年4月6日 17:28:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/61056675.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定