当 url 包含字符串“?error”时,WebSphere 不显示网页元素

WebSphere is not displaying webpage element when url contains string "?error "

我正在开发一个 Spring 安全项目,如果用户输入错误的用户 ID - 密码,网页将更新为 "Invalid Login Attempt" 消息。

我正在 AuthenticationFailureHandler.onAuthenticationFailure

上发送重定向

onAuthenticationFailure() 实现的代码片段。

@Override
  public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
      AuthenticationException exception) throws IOException, ServletException {
      //some logic
      response.sendRedirect(String.format("%s?error", getUrl());
    }
  }

资源 Html 页面有 div 标签与 thymeleaf 依赖关系来识别 error 对象和显示消息

<div th:if="${error}" id="loginFailedMessage" class="alert alert-danger">
   Invalid login attempt.
</div>

到目前为止,此实现 适用于 Jboss 应用程序服务器和 WebLogic 应用程序服务器 - 但是 不适用于 websphere。 WebSphere 阻止此类 url 调用是否有原因 - 我缺少任何配置。我已经厌倦了不同版本的 WebSphere 8.5.5.9 到 8.5.5.13

ps。任何日志 ffdc 或应用程序日志中都没有错误。

解决方案是在 url 中使用 error=true。出于某种原因,websphere 不允许 url 参数不赋值。

@Override
  public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
      AuthenticationException exception) throws IOException, ServletException {
      //some logic
      response.sendRedirect(String.format("%s?error=true", getUrl());
    }
  }