1.What is the use of META-INF folder in java web applications?
1.if is generally found in java based web-applications and in java related web servers.
2.files/directories in this folder are recognized and interpreted by the Java platform to configure applications, extensions, class loaders and services.
3. Java will create a default manifest file with every application.
4.META-INF directories related to jar files.they contain the manifest (list of contents) of a jar and are created when you create a jar file. Then when you unpack it, the directory appears. web applications held in .war files, are just special cases of .jars.
5.You should be able to safely delete your META-INF directory and content from an installed web application.
6.META INFORMATION is informing about something
a.A typical .ear(Enterprise Archive) file will probably have :
META-INF/MANIFEST.MF
META-INF/application.xml
b.A typical .jar(JAVA Archive) file will probably have:
META-INF/MANIFEST.MF
META-INF/ejb-jar.xml
META-INF/jboss.xml(dependent on the contaoiner used)
c.A typical .war(Web Archive) file will probably have
META-INF/MANIFEST.ME
7.META-INF/MANIFEST.MF is also where you would specify library dependencies of your application.
8.The .MF file stands for the manifest. It basically contains the information which is contained in the WEB-INF directory.
a.A typical .ear(Enterprise Archive) file will probably have :
META-INF/MANIFEST.MF
META-INF/application.xml
b.A typical .jar(JAVA Archive) file will probably have:
META-INF/MANIFEST.MF
META-INF/ejb-jar.xml
META-INF/jboss.xml(dependent on the contaoiner used)
c.A typical .war(Web Archive) file will probably have
META-INF/MANIFEST.ME
7.META-INF/MANIFEST.MF is also where you would specify library dependencies of your application.
8.The .MF file stands for the manifest. It basically contains the information which is contained in the WEB-INF directory.
9.Usually,existing a MANIFEST.MF file inside the META-INF folder. In this file, you can remark your project information such as :version and .jar refered to. If you package your ejb project, you must remark all .jar which you're refering to,then the container can load your refered classes in the refered package properly. Otherwise, the contianer may generates some errors like "can't find the class xxx"
10.JAR file is basically used to package all the classes of an executable java application.
It can also serve the purpose of electronic signing, version control and others. To specify what all purpose a JAR file serves, we use manifest.mf file inside the META-INF folder. This file contains information about the files contained in the JAR file. By modifying this file, we can use the JAR file to provide different functionality as mentioned above.
when ever a JAR file is created a default manifest.mf file is created inside META-INF folder and it contains the default entries like this:
10.JAR file is basically used to package all the classes of an executable java application.
It can also serve the purpose of electronic signing, version control and others. To specify what all purpose a JAR file serves, we use manifest.mf file inside the META-INF folder. This file contains information about the files contained in the JAR file. By modifying this file, we can use the JAR file to provide different functionality as mentioned above.
when ever a JAR file is created a default manifest.mf file is created inside META-INF folder and it contains the default entries like this:
Manifest-Version: 1.0
Created-By: 1.7.0_06 (Oracle Corporation)
These are entries as “header:value” pairs. The first one specifies the manifest version and second one specifies the JDK version with which the JAR file is created.
Main-Class header:
When a JAR file is used to bundle an application in a package, we need to specify the class serving an entry point of the application. We provide this information using ‘Main-Class’ header of the manifest file,
When a JAR file is used to bundle an application in a package, we need to specify the class serving an entry point of the application. We provide this information using ‘Main-Class’ header of the manifest file,
Main-Class: {fully qualified classname}
The ‘Main-Class’ value here is the class having main method. After specifying this entry we can execute the JAR file to run the application.
Class-Path header:
Most of the times we need to access the other JAR files from the classes packaged inside application’s JAR file. This can be done by providing their fully qualified paths in the manifest file using ‘Class-Path’ header,
Most of the times we need to access the other JAR files from the classes packaged inside application’s JAR file. This can be done by providing their fully qualified paths in the manifest file using ‘Class-Path’ header,
Class-Path: {jar1-name jar2-name directory-name/jar3-name}
This header can be used to specify the external JAR files on the same local network and not inside the current JAR.
Package version related headers:
When the JAR file is used for package versioning the following headers are used as specified by the Java language specification:
When the JAR file is used for package versioning the following headers are used as specified by the Java language specification:
Headers in a manifest
| |
Header
|
Definition
|
Name | The name of the specification. |
Specification-Title | The title of the specification. |
Specification-Version | The version of the specification. |
Specification-Vendor | The vendor of the specification. |
Implementation-Title | The title of the implementation. |
Implementation-Version | The build number of the implementation. |
Implementation-Vendor | The vendor of the implementation. |
Package sealing related headers:
We can also specify if any particular packages inside a JAR file should be sealed meaning all the classes defined in that package must be archived in the same JAR file. This can be specified with the help of ‘Sealed’ header,
Name: {package/some-package/}
Sealed:true
Sealed:true
Here, the package name must end with ‘/’.
Enhancing security with manifest files:
We can use manifest files entries to ensure the security of the web application or applet it packages with the different attributes as ‘Permissions’, ‘Codebae’, ‘Application-Name’, ‘Trusted-Only’ and many more.
META-INF folder:
This folder is where the manifest file resides. Also, it can contain more files containing meta data about the application. For example, in an EJB module JAR file, this folder contains the EJB deployment descriptor for the EJB module along with the manifest file for the JAR. Also, it contains the xml file containing mapping of an abstract EJB references to concrete container resources of the application server on which it will be run.
Comments
Post a Comment