abhijeet
abhijeet

Reputation: 879

Referencing jar's web.xml inside project's xml

I have a jar(not war) having web.xml inside its WEB-INF folder which contains servlet-mapping(Dispatcher servlet and reference to the config.xml containing REST related controller details). Now, I have to put this jar in the classpath of different project and I want to use the servlet mapping of the jar inside the project.

Is it possible to load jar's web.xml through the project's web.xml? Or any other way for solving this problem

Upvotes: 2

Views: 4436

Answers (1)

JB Nizet
JB Nizet

Reputation: 692131

This blog post explains it.

This is only possible in a servlet 3.0 application.

The jar file must be under WEB-INF/lib, and its descriptor must be called web-fragment.xml and be under META-INF/ in the jar file.

Follow the blog post and the link to the spec for more details.

Upvotes: 3

Related Questions