我一直在寻找一个特定的 Spring 功能,可以防止用户在注销后使用后退按钮返回受限区域。我没有找到任何东西。
是否有特定的 Spring 功能来处理我的问题,或者我应该使用 response.setHeader(.....
等?
最佳答案
spring中没有直接的特性,可以使用interceptor
来完成这项工作。与您的 servlet 过滤器相同,将 cacheSeconds
设置为 0
<mvc:annotation-driven/>
<mvc:interceptors>
<bean id="webContentInterceptor"
class="org.springframework.web.servlet.mvc.WebContentInterceptor">
<property name="cacheSeconds" value="0"/>
<property name="useExpiresHeader" value="true"/>
<property name="useCacheControlHeader" value="true"/>
<property name="useCacheControlNoStore" value="true"/>
</bean>
</mvc:interceptors>
这解释了 WebContentInterceptor
.还有nice expalanation在这里。
关于java - Spring登录后避免后退按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26301065/