使用扫描工具扫描出struts项目存放访问 路径:http:host:port/web//struts/webconsole.html,

刚开始以为是在项目的struts.xml配置文件中开启了开发模式,后来发现无论开启与否,甚至显式的关闭开发模式,这个链接都可以访问,

于是上网看看别人的解决办法,从先解决问题出发,按网上的办法进入如下路径:

struts2-core-*.jar\org\apache\struts2\interceptor\debugging\

删除了里面的所有静态文件,ftl,html,js,css,

再访问就变成404了,问题到此基础解决了,先交差吧,但,是否就只有这个“无奈”的解决方法呢?

于是将视线转向国外,在SO上找到如下两个自称解决办法的“办法”:

struts.xml中添加<constant name="struts.action.excludePattern" value="/struts/webconsole.html" />

web.xml中添加

<security-constraint>
<web-resource-collection>
<web-resource-name>OGNLconsole</web-resource-name>
<url-pattern>*/struts/webconsole.*</url-pattern>
</web-resource-collection>
</security-constraint>

经测试,这两种都“不能”解决问题,为什么使用双引号呢,因为如果真一点用的都没有,就干脆不用提了,

这两种方法方法都基于一种思想:权限,

第一种方法是想把某些url排除,而第二种方法也是对url进行详细配置,包括权限,

经过改良,第一种改成,必须使用 * ,不能是详细的后缀等形式

<constant name="struts.action.excludePattern" value="/static/.*" />

第二种改成正好相反,必须详细到后缀,不能使用万用格式 *

<security-constraint>
<web-resource-collection>
<web-resource-name>OGNLconsole</web-resource-name>
<url-pattern>/struts/webconsole.
html</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>

至此,经过改良,已经不需要再对jar包进行修改了,应用的配置功能得以体现。

更多相关文章

  1. 像那种以.html为后缀名的网站使用的是什么技术啊?
  2. MemSQL Start[c]UP 2.0 - Round 1 E - Three strings 广义后缀自

随机推荐

  1. Android Studio3.0新特性及安装详解
  2. android控件的对齐方式
  3. Android(安卓)线性布局(LinearLayout)相关
  4. Android安全加密:对称加密
  5. Kotlin让Android更简单~
  6. Android View布局xml常用 属性详解
  7. Android调用WCF
  8. Android Linux 内核介绍 (转)
  9. Android(安卓)项目实战视频资料 学习充电
  10. android网络编程——使用Android中的网络