Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Don't understand the concept of a context in Java EE

Ive been learning Spring, JSP and servlets. I don't understand the concept of a context root. There are so many of them. SpringContext root, servlet context root and there may be others.

In a Spring MVC application, how many context roots are there and how to identify them? What do they really mean?

like image 855
Horse Voice Avatar asked Nov 12 '13 21:11

Horse Voice


1 Answers

A context usually refers to the interface used to interact with your runtime environment. This one provides to your program a set of features (like security, request handling, etc...) usually needed by all application running in this kind of domain. Such an environment is generally named container in the java stack (servlet container, ejb one, etc...)

See What exactly is a Context in Java?

The term root can then be used when there are different context set up for a single application with inheritance between them. The one at the root hierarchy (usually holding some general configuration) is the root context .

See JB Nizet answer here : Web-application context/ root application context and transaction manager setup

However in your case the term root has a peculiar signification as it's used for a web container. It refers mainly to the root of the web application path, as there is only one context per web-app we are talking about the context root of a given web-app.

See http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

like image 62
Gab Avatar answered Oct 04 '22 00:10

Gab