2012-10-30 48 views
0

我使用JBoss 4.2和Java Seam,并且在我的应用程序中实现了一个登录表单。 现在,如果我在GUI中提交表单,参数将通过HTTP-POST发送,但是如果我尝试通过HTTP-GET发送数据,它也会被接受。JBoss Seam只允许通过POST参数

这应该被阻止,但我没有找到如何。 我可以在pages.xml中设置Method,还是需要以编程方式查找Request是Post还是Get。

有没有其他方法可以做到这一点或我应该怎么做?

谢谢!

回答

0

添加的跟随着的声明在web.xml:

<security-constraint> 
    <web-resource-collection> 
     <web-resource-name>Post Pages</web-resource-name> 
     <description /> 
     <url-pattern>/*.xhtml</url-pattern> 
     <http-method>POST</http-method> 
    </web-resource-collection> 
    <user-data-constraint> 
     <transport-guarantee>NONE</transport-guarantee> 
    </user-data-constraint> 
</security-constraint> 

这将只允许POST请求的定义url.patterns