Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 阻止访问WEB\u INF外部的内容(jsp文件)_Java_Websphere_Websphere 8 - Fatal编程技术网

Java 阻止访问WEB\u INF外部的内容(jsp文件)

Java 阻止访问WEB\u INF外部的内容(jsp文件),java,websphere,websphere-8,Java,Websphere,Websphere 8,我在WEB-INF文件夹之外有几个文件夹,这些文件夹包含jsp文件 Sample Directory structure: -WEB-INF -DirA -a.jsp -b.jsp -DirB -c.jsp -d.jsp 如何阻止用户访问WebPhare 8服务器中WEB-INF文件夹外的静态文件(JSP)?您需要在WEB.xml中指定安全约束。有关web应用程序安全性的良好教程,请参见: 基本上,web.xml中需要类似的内容: <security-constraint

我在WEB-INF文件夹之外有几个文件夹,这些文件夹包含jsp文件

Sample Directory structure: 
-WEB-INF
-DirA
  -a.jsp
  -b.jsp
-DirB
 -c.jsp
 -d.jsp

如何阻止用户访问WebPhare 8服务器中WEB-INF文件夹外的静态文件(JSP)?

您需要在WEB.xml中指定安全约束。有关web应用程序安全性的良好教程,请参见:

基本上,web.xml中需要类似的内容:

<security-constraint>
  <display-name>SecurityConstraintForDirA</display-name>
  <web-resource-collection>
    <web-resource-name>DirAResources</web-resource-name>
    <url-pattern>/DirA/*</url-pattern>
  </web-resource-collection>
  <auth-constraint>
    <role-name>dirAUsers</role-name>
  </auth-constraint>
  <user-data-constraint>
    <transport-guarantee>NONE</transport-guarantee>
  </user-data-constraint>
</security-constraint>

SecurityConstraintFordera
直接资源
/迪拉/*
迪劳瑟斯
没有一个

希望这有帮助,安迪

谢谢。我之前查过这个。因为我在WEB-INF目录外有多个文件夹。如果我想使用这种方式,我需要在WEB.xml中添加每个文件夹。在websphare设置中是否有其他方法阻止它?此链接可能也很有用:请注意,您可以在安全约束中指定多个url模式-因此您可以为所有目录(即/*)或某些子集(即/DirA、/DirB、/DirC)设置一个安全约束。我不知道有任何特定于WebSphere的方法来保护多个目录。