Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

resource files under webapp/WEB-INF or src/main/resources?

Tags:

java

In my project i see some xmls under src/main/webapp/WEB-INF while some under src/main/resources. Is there any convention what kind of file should go under these location

like image 435
emilly Avatar asked Mar 17 '15 13:03

emilly


People also ask

What kind of files should be put under folder Web-INF?

The WEB-INF directory contains the deployment descriptors for the Web application (web. xml and weblogic. xml) and two subdirectories for storing compiled Java classes and library JAR files. These subdirectories are respectively named classes and lib.

What is resources in web application?

Web resources are any software artifacts that the web application requires for proper rendering, including images, script files, and any user-created component libraries. Resources must be collected in a standard location, which can be one of the following.

What is the difference between Meta INF and Web-INF?

The META-INF directory is private and can't be accessed from the outside. On the other hand, it also contains the WEB-INF public directory with all the static web resources, including HTML pages, images, and JS files. Moreover, it contains the web. xml file, servlet classes, and libraries.

Where is Web-INF folder in Linux?

WEB-INF folder is under public_html folder. You can configure and add your content to your site yourself with. class files.


1 Answers

src/main/resources contains Application/Library resources.

The Servlet 2.4 specification says this about WEB-INF:

A special directory exists within the application hierarchy named WEB-INF. This directory contains all things related to the application that aren’t in the document root of the application. The WEB-INF node is not part of the public document tree of the application. No file contained in the WEB-INF directory may be served directly to a client by the container. However, the contents of the WEB-INF directory are visible to servlet code using the getResource and getResourceAsStream method calls on the ServletContext, and may be exposed using the RequestDispatcher calls.

like image 183
Rajesh Avatar answered Sep 30 '22 14:09

Rajesh