我想知道是否有辦法爲所有Web應用程序內容提供登錄支持。我的意思是當用戶試圖訪問某個網站(也是靜態內容 - html),並且他沒有登錄或會話過期時,他應該被重定向到登錄網站。 web.xml中的Html過濾器用於記錄幾乎是我需要的,但我也需要驗證html頁面。GWT web.xml - java ee - 登錄和會話
<filter>
<filter-name>AuthenticationFilter</filter-name>
<filter-class>example.AuthenticationFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AuthenticationFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
這不適用於html頁面,只適用於servlet請求。 這應該是通用機制,不像每個servlet會話檢查都寫。 感謝所有resopnes。
這應該與同一個webapp提供的HTML頁面一樣。你的問題是在其他地方引起的。可能它們是由不同的webapp/server服務的?或者您沒有運行您認爲正在運行的過濾器代碼或映射? – BalusC