Hello there,

Apache Tomcat v9.0.65
Java 11
OS Linux

We have a web app which is embedding tomcat. web-app's context path /product is mapped to docBase /opt/product/codebase folder. The whole web-app content is inside this /codebase folder. The customer of the web-app can customize the web-app by adding their own content. However, they are not allowed to modify/add inside /codebase folder, so their is a separate folder for customers code i.e. /opt/product/custom. The requirement is to make available /opt/product/custom folder's content accessible from the same context i.e., /product. The custom folder has classes, jsp, js, css and image files, etc. I am not sure how to make tomcat access contents outside docBase folder.


I read nested components documentation https://tomcat.apache.org/tomcat-9.0-doc/config/resources.html and tried it however, it was not working for me.

For trying out I have created a html file: /opt/product/custom/test.html
Updated the content configuration:

<Context path="/Product" docBase="/opt/product/codebase"
         reloadable="false" useHttpOnly="true">

  <Loader loaderClass="org.apache.catalina.loader.ParallelWebappClassLoader" delegate="true"/>
  <Resources>
      <PostResources base="/opt/product/custom"
className="org.apache.catalina.webresources.DirResourceSet"
                 webAppMount="/"/>
    </Resources>
</Context>

and tried to access URL: locahost:8080/Product/test.html which returned 404.


My question:
Is nested components the right way to achieve the requirement? If yes, please help me understand what I am missing. If not, please point me the right way.

Thanks a lot in advance!!.
Please let me know if you have any query

Thanks,
Umesh

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to