The Web. XML file under the Conf directory in the Tomcat installation directory has many configurations, such as:
<init-param> <param-name>debug</param-name> <param-value>0</param-value> </init-param>
Debug is set to debug level, 0 indicates minimum information, and 9 indicates the most information provided.
The following parameters are Important:
<init-param> <param-name>listings</param-name> <param-value>false</ Param-value></init-param>
In the Web development phase, you typically want to list all the pages under the Web path, which makes it easy to choose which JSP page to debug,listings when set to true to indicate that the page is listed, or false to indicate that the display of the directory structure is not supported
<load-on-startup>1</load-on-startup>
1) The Load-on-startup element flags whether the container loads the servlet at startup (instantiating and invoking its init () method).
2) its value must be an integer indicating the order in which the servlet should be loaded
2) a value of 0 or greater than 0 o'clock indicates that the container loads and initializes the servlet when the application is started;
3) when the value is less than 0 or unspecified, the container will not load until the servlet is Selected.
4) the lower the value of a positive number, the higher the precedence of the servlet, and the more loaded it will be when the app Starts.
5) at the same time, the container will be loaded in its own order of Choice.
<servlet> <servlet-name>jsp</servlet-name> <servlet-class> org.apache.jasper.servlet.jspservlet</servlet-class> <init-param> <param-name>fork </param-name> <param-value>false</param-value> </init-param> < init-param> <param-name>xpoweredBy</param-name> <param-value>false</ param-value> </init-param> <load-on-startup>3</load-on-startup> </ Servlet>
Parameters |
Describe |
Development |
The default value is true, which means that the JSP file is still in development, so Jasper should check the JSP file by the Modificationtestinterval parameter and recompile it when the JSP changes |
Fork |
The default value is True. Instructs the JSP to be compiled with a different jvm, which eliminates resource contention and class loader conflicts during the development phase |
Checkinterval |
Units in seconds, specify Jasper at this interval to check whether the JSP needs to recompile, the default is 0, indicating the use of background program processing |
Modificationtestinterval |
It works primarily when development is true, and the default value is 4. Jasper will check to see if the JSP file can verify if it has been modified at this Frequency. |
Compiler |
Cache size used when reading resources, default is 2KB |
Classdebuginfo |
Cache size used when writing resources, default is 2KB |
keepgenerated |
The default value is True. Instructs Jasper to keep the servlet in the working directory between two calls to the servlet, which can greatly improve tomcat efficiency |
Mappedfilegenstraschararray Dumpsmaptrimspaces Supresssmap |
These are the optimization and debugging options used by JSP Developers. |
ScratchDir |
Jasper the temporary folder used when compiling the jsp, default to a temporary folder under $catalina_home/work |
Xpoweredby |
The default is False. function for generating x-power-by header (header) |
Compilertargetvm |
To compile the target VM for the generated servlet |
Compilersourcevm |
Generate the source VM for the servlet |
<mime-mapping> <extension>zip</extension> <mime-type>application/zip</ Mime-type> </mime-mapping>
Mime-mapping is a node in Web. XML that specifies the format of the browser processing, and can also be used to configure the static page open encoding:
<mime-mapping> <extension>htm</extension> <mime-type>text/html;charset=gb2312 </mime-type> </mime-mapping> <mime-mapping> <extension>html</extension> <mime-type>text/html;charset=gb2312</mime-type> </mime-mapping>
If your Web application contains some infrequently used files, you need to ensure that some MIME types are assigned, which is what the mime-mapping element is designed for. Add Mime-type mappings such as Rar,iso to avoid opening directly in the browser
<mime-mapping> <extension>rar</extension> <mime-type>application/octet-stream </mime-type> </mime-mapping> <mime-mapping> <extension>iso</extension > <mime-type>application/octet-stream</mime-type> </mime-mapping>
Common MIME Types:
Hypertext Markup Language Text. htm,.html text/html
Plain Text. txt Text/plain
RTF Text. RTF application/rtf
GIF graphics. gif image/gif
JPEG Graphics. ipeg,.jpg image/jpeg
Au sound file. au audio/basic
Midi Music files Mid,.midi Audio/midi,audio/x-midi
RealAudio Music files. ra,. Ram Audio/x-pn-realaudio
MPEG Files. mpg,.mpeg Video/mpeg
Avi File. avi Video/x-msvideo
Gzip File. GZ Application/x-gzip
Tar File. tar Application/x-tar
Server.xml configuration reference for Tomcat: https://www.cnblogs.com/qlqwjy/p/8722529.html
"tomcat" Tomcat container Web. XML detailed