Tomcat will serve any static content from a WAR file using the DefaultServlet. This works great for serving files that are bundled with your Java code inside of a WAR file – it’s fast enough for most purposes and it just works, but with one major drawback: you have to re-deploy the WAR file if you want to add or amend a static file.
Tomcat can be configured to read files from anywhere on the disk and serve on a specific URL. This configuration is completely separate to our application configuration.
You just need to change a single file server.xml that resides under $CATALINA_HOME/config/server.xml.
Just open the server.xml file and make the changes like below.
Remember: You need to take bounce of server after the making the changes to take effect of the changes.
<Host name="localhost" appBase="webapps"
<Context docBase="C:AnkurtestFiles" path="/companyLogo" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
pattern="%h %l %u %t "%r" %s %b" />
A <context> element is added inside the <HOST>