How to enable directory listing in tomcat
来源:互联网 发布:ubuntu 优麒麟区别 编辑:程序博客网 时间:2024/05/16 01:20
试了这个方法,完全可行。
原文http://wso2.org/node/1096/print
Step 1 : Create a folder inside TOMCAT_HOME/webapps(eg: TOMCAT_HOME/webapps/my-files )Add some content(files,images) to this folder.Step 2 :Add folder 'WEB-INF' inside my-files folder.(eg: TOMCAT_HOME/webapps/my-files/WEB-INF )Step 3 :Add a web.xml file inside WEB-INF folder with following contents.(for tomcat-5.5.20)
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2eehttp://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>default-myfiles</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>default-myfiles</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
Step 4 :Start tomcat & navigate to http://localhost:PORT/my-files/.You will see the contents of the directory.Try changing the value of listing to 'false'.Step 5 :Check TOMCAT_HOME/conf/web.xml for more configuration options.(eg: welcome file, mime settings, url patterns)可以看到目录下面的所有文件,但是只有txt文件能打开。其他ppt,doc文件都打不开。另外通过配置虚拟目录似乎也可行,可以这样可以显示硬盘上的任何一个目录,而不是局限于显示tomcat目录结构下的东西。
- How to enable directory listing in tomcat
- Tomcat 开启 Directory Listing
- Tomcat之Directory Listing
- Tomcat 如何允许directory listing
- how to enable debug in eclipse + weblogic
- How To Enable Apache Modules in Ubuntu
- How to enable IP Forwarding in Linux
- how to enable debug in configure?
- How to Enable IP Forwarding in Linux
- How to enable cURL in PHP / XAMPP
- How-to: enable fair scheduler in hadoop
- How to enable guest posting in phpBB3
- How to enable TRACE_EVENT in WebRTC codes
- How to enable IOMMU in Fedora
- 更改Tomcat 'Directory Listing For' method
- Tomcat 5.5 显示Directory Listing的问题
- 更改 Tomcat 'Directory Listing For' method
- tomcat安全配置之禁用Directory Listing
- 写时复制原理分析
- 布局篇-Grid布局
- DIY经验谈 家中云存储组建NAS经验谈
- java 操作 MongoDB 快速入手
- SQLyog中文乱码的解决方法
- How to enable directory listing in tomcat
- 【Boost】基于boost::lexical_cast的to_string函数
- MySQL与MongoDB的操作对比
- error PRJ0019: A tool returned an error code from "Performing Post-Build Event..." 解决方法
- 名词-简称-扫盲
- java.lang.UnsupportedClassVersionError: Bad version number in .class file解决办法
- MongoDB 基础java数据类型
- 最小生成树
- 关于php学习笔记三