code:     protected String determineTargetUrl(HttpServletRequest request) {
          String targetUrl = request.getParameter("from");
          request.getSession().setAttribute("from", targetUrl);
  
          if (targetUrl == null)
              return getDefaultTargetUrl();
  
          if (Util.isAbsoluteUri(targetUrl))
              return "."; // avoid open redirect
  
          // URL returned from determineTargetUrl() is resolved against the context path,
          // whereas the "from" URL is resolved against the top of the website, so adjust this.
          if(targetUrl.startsWith(request.getContextPath()))
              return targetUrl.substring(request.getContextPath().length());
  
          // not sure when this happens, but apparently this happens in some case.
          // see #1274
          return targetUrl;
      }
  
      /**
       * @see org.acegisecurity.ui.AbstractProcessingFilter#determineFailureUrl(javax.servlet.http.HttpServletRequest, org.acegisecurity.AuthenticationException)
       */
      @Override
  