admin管理员组

文章数量:1123886

My current situation is that I have a maven project which I'm deploying to Tomcat as a .war file. Part of my project contents are actually third-party frontend pages (html/js/css) which result in two-way communication (I allow the user to navigate to these files using something like <a href="external/index.html">, and as a result of user interaction these pages result in some kind of call back to my application via javascript).

The project structure resembles this:

- app/
|-- index.html
|-- js/
|-- css/
|-- external/
|---- index.html
|---- js/
|---- css/

What I would like to do is pull the external contents out of my project/war file and instead link to them as some type of web resource. So far all of the solutions I've found seem to be focused on either externalizing the entire webapps directory, or setting single-page resources such as .pdf files. Ideally these files wouldn't need to be hosted as a separate web application due to resource constraints and other concerns.

I've been trying to get something working that uses the answer posted in Simplest way to serve static data from outside the application server in a Java web application, but have been going in circles so wanted to verify this approach would work for what I was attempting.

EDIT: Redirecting or forwarding won't work because this is data exists outside of my web application, but simply writing the html contents to the response will lose all the markup/scripts. Wondering if there might be something that could read this external directory as a jsp, or if Spring has something for this, or if I'd need to flatten/minify the contents first?

本文标签: htmlIs it possible to externalize nested componentsStack Overflow