For a Web project, in addition to the text, pictures, videos and other media elements are also an important part of it. We know that if we use a lot of pictures and video resources in Web projects, we
It is common practice to store only the paths of resources such as pictures and videos in the database, and the Web project directly refers to the corresponding resource through the path, rather than storing the entire picture as a stream in the database.
Of course, for the system does not use a lot of pictures, or the picture quality requirements are not very high some small icons, we can also directly use the form of stay or with Base64 encoding in the form of longtext stored in the database.
The path to these resources can be configured without time and effort. However, his disadvantage is to increase the pressure on the database, only for that pattern is small, the database server performance is not too large requirements of small projects.
The advantage of configuring the external resource path for Tomcat is that he greatly reduces the pressure on the server and the database by only storing the path to the resource, uploading the image to a specified folder outside of Tomcat, and providing
A Web project reference under Wabapps in Tomcat.
Locate the Conf/server.xml file in the Tomcat installation directory and add the configuration to the <Host>......</Host> tab:
<!--video image resources Fload--><context docbase="C:\resources" reloadable="true" debug="0" path="/ Resources"/>
Where Docbase is the physical path to the folder, path is the access path to the folder.
Then restart Tomcat. Suppose there is a picture named Test.jpg under the Resources folder, and only "http://localhost:8080/resources/test.jsp" is required to access the picture resource.
Configure the external resource path for Tomcat (scenario: Web Project access to resources such as picture videos)