Websphere 8.5过滤器

时间:2015-11-01 02:27:07

标签: websphere

我只在Websphere 8.5中遇到问题。我有一个登录页面,在用户输入用户名/密码后,对authTest / j_security_check进行Ajax调用.oauthTest是应用程序的上下文根。

在服务器端,我有2个过滤器和几个servlet。

<web-app>
  <servlet>
    <servlet-name>JSceurityCheck</servlet-name>
    <servlet-class>provider.oauth.servlet.JSceurityCheck</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>JSceurityCheck</servlet-name>
    <url-pattern>/j_security_check</url-pattern>
  </servlet-mapping>
<filter>
    <display-name>OAuthFilter</display-name>
    <filter-name>OAuthFilter</filter-name>
    <filter-class>oauth.filter.OAuthFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>OAuthFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
</filter-mapping>

<filter>
    <display-name>DispatchFilter</display-name>
    <filter-name>DispatchFilter</filter-name>
    <filter-class>dispatcher.filter.DispatchFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>DispatchFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>

控制到达OAuthFilter,从而调用chain.doFilter(请求,响应)。后来的控制到达DispatchFilter,它也调用chain.doFilter(请求,响应)。

现在控件假设到达JSceurityCheck servlet,但在控制到达该servlet之前,websphere应用程序服务器正在抛出异常。

Caused by: java.lang.IllegalArgumentException: Location cannot be null in javax.servlet.http.HttpServletResponse.sendRedirect(location)
at com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext.sendRedirectWithStatusCode(WebAppDispatcherContext.java:539)
at com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext.sendRedirect(WebAppDispatcherContext.java:527)
at com.ibm.ws.webcontainer.srt.SRTServletResponse.sendRedirect(SRTServletResponse.java:1350)
at com.ibm.ws.security.web.FormLoginExtensionProcessor.formLogin(FormLoginExtensionProcessor.java:734)
at com.ibm.ws.security.web.FormLoginExtensionProcessor.formLogin(FormLoginExtensionProcessor.java:228)
at com.ibm.ws.security.web.FormLoginExtensionProcessor.handleRequest(FormLoginExtensionProcessor.java:206)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
at com.teamcenter.lis.provider.dispatcher.filter.DispatchFilter.doFilter(DispatchFilter.java:178)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at com.teamcenter.lis.provider.oauth.filter.OAuthFilter.doFilter(OAuthFilter.java:144)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:928)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025)

相同的代码适用于JBOSS 7,Tomcat 7和weblogic服务器12.只有在websphere 8.5中它才会破解。 如果有人有任何线索请告诉我。

1 个答案:

答案 0 :(得分:1)

/ j_security_check URI触发WebSphere的FormLoginExtensionProcessor(一些信息here),它使用HttpRequest中的j_username / j_password参数来验证用户。如果信息丢失,它会尝试重定向到错误页面。您是否可以尝试更改url-pattern以不包含j_security_check并查看它是否有所作为?