Spring boot Tomcat – 启用/禁用目录列表 [英] Spring boot Tomcat – Enable/disable directory listing
问题描述
我有 spring boot
应用程序,我使用 embedded tomcat
作为网络服务器.我在列出目录时遇到问题.我现在想知道如何在嵌入式 tomcat 中启用或禁用列表目录
.在 none spring boot 应用程序中,我们可以在 web.xml
中添加以下代码:
I have spring boot
application and i'm using embedded tomcat
as web server.
I have problem with listing directories.
I want to now how could i enable or disable listing directories
in embedded tomcat.
In none spring boot application we can do it adding code below in web.xml
:
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
我如何在 Spring Boot 中启用/禁用
目录列表?
how can i Enable/disable
directory listing in spring boot?
我在 stackoverflow 中只发现了以下问题,但没有帮助.
I have found only question below in stackoverflow but didnt help.
spring-boot 应用程序的嵌入式 Tomcat 目录列表
推荐答案
说到 spring-boot
,几乎所有东西都可以通过配置文件进行微管理.
When it comes to spring-boot
, pretty much everything can be micro-managed via configuration files.
您可以使用以下属性将 init-param
值传递给嵌入式容器
You can pass init-param
values to the embedded container using the following properties
server.servlet.jsp.init-parameters.*= # Init parameters used to configure the JSP servlet.
就你而言,
server.servlet.jsp.init-parameters.listings=false
这篇关于Spring boot Tomcat – 启用/禁用目录列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!