У меня есть веб-приложение, развернутое как WAR файл в Tomcat 7. Приложение построено как многомодульный проект:
- Ядро
- упакованное как JAR, содержит большую часть бэкэнд-кода
- core-api - упакован как JAR, содержит интерфейсы к ядру
- webapp - упакован как WAR, содержит код интерфейса и зависит от ядра
- клиентские расширения - дополнительный модуль, упакованный как JAR
Обычно мы можем помещать наши JSP файлы в проект webapp и ссылаться на них относительно контекста:
/WEB-INF/jsp/someMagicalPage.jsp
Вопрос в том, что мы делаем с JSP файлами, специфичными для проекта расширения клиентов, который не всегда должен быть включен в WAR. К сожалению, я не могу ссылаться на JSP внутри JAR файлов, похоже. Попытка classpath:jsp/customerMagicalPage.jsp
приводит к тому, что файл не найден в JspServlet, так как он использует ServletContext.getResource()
.
Традиционно мы "решаем" это, когда maven распаковывает JAR клиента-расширений, размещает JSP и помещает их в WAR при ее создании. Но идеальной ситуацией является то, что вы просто бросаете JAR в взорванную WAR в Tomcat и обнаруживаете расширение - которое работает для всего, кроме JSP.
Есть ли способ решить это? Стандартный способ, способ Tomcat, взломать или обходной путь? Например, я думал о распаковке JSP при запуске приложения...