当前位置:网站首页>What are meta-inf and WEB-INF respectively?
What are meta-inf and WEB-INF respectively?
2022-06-12 19:19:00 【Charter1】
1. summary
I'm learning spring.factories When I found myself for META-INF and WEB-INF The role of , So here is a supplement .
META-INF The main function of is to Jar A description of the package . Its meaning is (meta information) Signature folder . Packing jar It will be generated automatically , Of course, you can also modify the configuration manually .
WEB-INF yes Java Of WEB Security directory of application . The so-called security is that the client cannot access , Only the server can access the directory .
2. detailed
2.1 Explanation on Baidu
META-INF It's like a packet , The files and directories in the directory get Java 2 Recognition and interpretation of the platform , Used to configure applications 、 add-in 、 Class loaders and services manifest.mf file , In use jar Automatically generated when packaging .
WEB-INF yes Java Of WEB Security directory of application . The so-called security is that the client cannot access , Only the server can access the directory . If you want to access the files directly in the page , Must pass web.xml The file can only be accessed by mapping the file to be accessed .
2.2 mainfest.mf file
Means manifest file ,manifest Every line in the file is key-value Corresponding : Property name starts with , Next is “:” , Then there is the attribute value , The most in each line 72 Characters , Add if necessary , You can continue on the next line , The continuation line begins with a space , A line that begins with a space is considered a continuation of the previous line . There are usually these fields :
Manifest-Version: 1.0
Built-By: Dxy
Created-By: IntelliJ IDEA
Build-Jdk: 1.8.0_144
The message is jar Description of the document :
Manifest-Version: Generated manifest.mf Version of a file
Built-By: The creation of the file is named by the user , stay IDEA Can be set in the configuration file
Created-By: The generator of the file , Generally by jar Command line tool generation , When shown here idea
Bulid-Jdk: What is used JDK Environmental Science
And these properties :
One 、 General properties
1:Signature-Vresion: Definition jar Signed version of the document
2:Class-Path: Internal class search path , Provided to the application or class loader
Two 、 Application related properties
1、Main-Class: Definition jar File entry class , This class must be executable ! Once this attribute is defined, you can use
java -jar The program name .jar To run the jar file
2.3 and WEB-INF The difference between
META-INF Deposit is jar Package label information ,jar There will be this folder ,war There will be .
and WEB-INF yes java web A folder unique to the application , Belong to web Security directory of application , The directory client cannot access , Only the server can access . If you want to access the files directly in the page , Must pass web.xml The file can only be accessed by mapping the file to be accessed . So if there are hyperlinks in our pages <a> Labels or <script></script> Under the script location.href Go straight to WEB-INF Next one jsp perhaps html page , Then you can't quote , Because such a request mode is the request of the client .css/js/html There is no need to put it in WEB-INF Next . Finally, these will be displayed intact on the client , So access security won't be a problem at all .
jsp Put it in web-inf Next , There are two main reasons
The patterns of ancient times will put the business logic , Database connection and other sensitive information are written in jsp Inside , Being directly accessed by users will have security problems .
This is no longer a problem in the modern model , Should not be a problem .
jsp It runs on the server side , And it usually needs other programs to support —— For example, the data can be processed in the background jsp Apply colours to a drawing etc. , It doesn't make sense for users to directly access one , Second, the exception will be thrown , All this wastes server resources .
For systems with strict safety requirements , You are not allowed to visit your jsp file , You can put it in web-inf below , For systems with less stringent security requirements , You can put it directly in webroot below .
3. summary
META-INF comparison WEB-INF It is usually used less in daily development , Generally, the fields are construction tools or IDE Automatically generated .
边栏推荐
- On how to make digital transformation after the loan of large policy banks- Yixinhuachen
- Redis中的事务
- 超级重磅!Apache Hudi多模索引对查询优化高达30倍
- How to download proxystrike in China
- 3GPP RAN第一次F2F会议,都干了些啥?
- Cookie & Session & kaptcha验证码
- Jenkins各配置选项介绍原创
- Research Report on current market situation and investment prospect of China's tobacco RFID industry 2022-2027
- 基於分布式數據庫本身的定時備份方法
- 什么是网络代理
猜你喜欢

kali局域网ARP欺骗(arpspoof)并监听(mitmproxy)局域内其它主机上网记录

vc hacon 聯合編程 GenImage3Extern WriteImage

In 2021, the global revenue of chlorinated polyvinyl chloride (CPVC) was about $1809.9 million, and it is expected to reach $3691.5 million in 2028

VC Hacon Joint Programming genimage3extern writeimage

Transactions in redis

kali2022如何安装w3af

Méthode de sauvegarde programmée basée sur la base de données distribuée elle - même

Attack and defense world (WEB) -- supersqli

In 2021, the global revenue of electro-optical modulator (EOM) is about USD 360.3 million, and it is expected to reach USD 704.4 million in 2028

RT-Thread 模拟器 simulator 搭建 LVGL 的开发调试环境
随机推荐
Jenkins各配置选项介绍原创
leetcode:6094. Company name [group enumeration + cannot repeat set intersection + product Cartesian product (repeat indicates length)]
Exploration of a flexible injection scheme for istio sidecar
Six stone cognition: the apparent and potential speed of the brain
软件确认测试知识分享,上海第三方软件测试机构有哪些?
The 14th five year development plan and investment prospect analysis report of China's oil and gas pipeline engineering construction 2022-2027
Embedded development: 6 necessary skills for firmware engineers
chrome浏览器解决跨域问题
嵌入式开发:固件工程师的6项必备技能
Leetcode 474. One and zero
Kali LAN ARP Spoofing and monitoring other hosts' Internet access records in the LAN
Cookie & session & kaptcha verification code
PHP converts total seconds to hours, minutes and seconds
DACOM G150 dual-mode earphones make sound for love and protect the healthy growth of children's hearing
Research Report on current market situation and investment prospect of China's tobacco RFID industry 2022-2027
Istio 1.14 发布
On how to make digital transformation after the loan of large policy banks- Yixinhuachen
What are the third-party software testing organizations in Shanghai that share knowledge about software validation testing?
Can't understand kotlin source code? Starting with the contracts function~
no available service ‘null‘ found, please make sure registry config correct