2010-01-05 114 views
2

上没有访问我使用Spring Web Flow的昂春季安全J2EE Web应用程序。我想将用户重定向到页面(可能是错误页面),因为当前我得到错误春季安全重定向如果

错误404 - 未找到 从RFC 2068超文本传输​​协议 - - HTTP/1.1: 10.4.5 404未找到 服务器没有找到任何匹配的Request-URI。没有迹象表明病情是暂时的还是永久性的。

如果服务器不希望提供给客户这些信息,状态代码403(禁止)可以用来代替。如果服务器通过某种内部可配置机制知道旧资源永久不可用并且没有转发地址,则应使用410(Gone)状态码。

如何做到这一点redirection.I试图安全的禁止访问的页面属性:HTTP,但我仍然得到错误。这是我的安全-http配置。

通过way.I正在使用Spring面孔和Facelets。这可能是问题的原因吗?

<!-- Configure Spring Security --> 
<security:http auto-config="true" access-denied-page="/deniedpage.xhtml" 
    session-fixation-protection="newSession"> 
    <security:intercept-url pattern="/main.do" 
     access="ROLE_SUPERVISOR, ROLE_USER" /> 
    <security:intercept-url pattern="/logoutSuccess.do" 
     access="ROLE_SUPERVISOR, ROLE_USER" /> 
    <security:intercept-url pattern="/edit.do" 
     access="ROLE_SUPERVISOR" /> 
    <security:intercept-url pattern="/register.do" 
     access="ROLE_SUPERVISOR" /> 
    <security:intercept-url pattern="/admin_main.do" 
     access="ROLE_SUPERVISOR" /> 
    <security:intercept-url pattern="/*" 
     access="IS_AUTHENTICATED_ANONYMOUSLY" /> 
    <security:form-login login-page="/loginForm.do" 
     default-target-url="/main.do" authentication-failure-url="/loginForm.do?login_error=1" /> 
    <security:logout logout-url="/logout.do" 
     invalidate-session="true" logout-success-url="/logoutSuccess.do" /> 
    <security:concurrent-session-control 
     max-sessions="-1" exception-if-maximum-exceeded="true" expired-url="/loginform.do" /> 

</security:http> 
+0

看起来不错给我。你可以在日志中看到它是否试图重定向到/deniedpage.xhtml?像“重定向到...”,然后是错误。 – rodrigoap 2010-01-05 15:20:28

+0

明白了。当我访问受限制的页面时,我已经根据访问被拒绝页面中设置的内容进入了我想要的页面。 但是如果我就已经进入了网络流量,同时仍然在流动限制我改变我仍然可以操纵那里。所以我创建了另一个状态重新检查访问ROLE的关键状态。当然,除非有限制州级的方法 – cedric 2010-01-06 03:03:23

回答

5

禁止访问的页面属性安全:HTTP应该够了,告诉我们您正在使用Spring的配置。
同时尝试添加这web.xml中

<error-page> 
    <error-code>404</error-code> 
    <location>notfound.jsp</location> 
</error-page> 
+0

我在上面添加了我的配置 – cedric 2010-01-05 14:43:11