Understanding Tomcat Configuration
Join the DZone community and get the full member experience.
Join For FreeWhen the Tomcat config is this:
<Host name="localhost" appBase="C:/apps/apache-tomcat/null"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="/" docBase="C:/apps/apache-tomcat/DeployedApps/HelloWorld" debug="0" reloadable="false" crossContext="false"/>
Then…
http://localhost/index.jsp yields to the “index.jsp” under HelloWorld folder.
http://localhost/HelloWorld/index.jsp yields to a “404 Page”.
Case #2:
When the Tomcat setup is this:
<Host name="localhost" appBase="C:/apps/apache-tomcat/null"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="/hw" docBase="C:/apps/apache-tomcat/DeployedApps/HelloWorld" debug="0" reloadable="false" crossContext="false"/>
Then…
http://localhost/index.jsp yields to a “blank page”.
http://localhost/HelloWorld/index.jsp yields to a “blank page”.
http://localhost/hw/index.jsp yields to the “index.jsp”.
So if the objective is to deliver “HelloWorld” as the default application for the root context, then the configuration for that instance should like “case #1”. If the objective of a particular application to be bound to a “path”=”application context”, then we need to deploy that instance as “case #2”.
I hope this clarifies the two models.
Published at DZone with permission of Venkatt Guhesan, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Trending
-
Five Java Books Beginners and Professionals Should Read
-
Getting Started With Istio in AWS EKS for Multicluster Setup
-
Integrating AWS With Salesforce Using Terraform
-
10 Traits That Separate the Best Devs From the Crowd
Comments