2016-06-10 50 views
0

下面是,應用程序在我面對的WebSphere 8.5websphere的歡迎,文件過濾器沒有得到回升

<filter> 
    <filter-name>securityFilter</filter-name> 
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 
</filter> 

<filter-mapping> 
    <filter-name>CheckFilter</filter-name> 
    <url-pattern>/index.jsp</url-pattern> 
</filter-mapping> 
<welcome-file-list> 
    <welcome-file>index.jsp</welcome-file> 

問題depployed我的web.xml的內容時,我打我的CheckFilter是沒有得到調用url就像https://servername:portNumber/contextPath/?QueryParam 同樣在tomcat上工作正常& weblogic。

但是,如果我輸入網址https://servername:portNumber/contextPath/index.jsp?QueryParam

我的過濾器越來越invoked.To獲得第一url我應該怎麼需要改變的響應。

即沒有給index.jsp過濾器應該被調用。

回答

0

所以,你必須根據你的要求

1)兩個選項上/添加URLPATTERN這樣的(因爲,如果你打電話只是應用上下文存在的圖案中沒有的index.jsp)

<filter-mapping> 
     <filter-name>RootFilter</filter-name> 
     <url-pattern>/index.jsp</url-pattern> 
     <url-pattern>/</url-pattern> 
</filter-mapping> 

2)由於請求轉發index.jsp,您可以添加FORWARD到您的過濾器映射,像這樣:

<filter-mapping> 
    <filter-name>RootFilter</filter-name> 
    <url-pattern>/index.jsp</url-pattern> 
    <dispatcher>REQUEST</dispatcher> 
    <dispatcher>FORWARD</dispatcher> 
</filter-mapping> 
+0

對不起@煤氣,它沒有工作。 – Rogger296

+0

因此,您的應用程序出現問題,因爲它們都可以在我的示例應用程序上正常運行。檢查你的web.xml(也許附加完成)和日誌(也許你有一些錯誤)。 – Gas

+0

Hi @Gas,我發現在兩個URL中index.jsp都被調用。但是url中沒有index.jsp的一個不會調用過濾器並直接調用index.jsp。而另一個在其中的index.jsp存在時,調用濾波器的第一和然後的index.jsp – Rogger296