Storing web content in a JAR file

后端 未结 6 1693
被撕碎了的回忆
被撕碎了的回忆 2021-02-14 03:16

Is it possible to store web content (such as JSPs, HTML, images, CSS etc) in a JAR file?

I\'ve been looking at various options at modularising our web applications and t

6条回答
  •  孤独总比滥情好
    2021-02-14 03:31

    Absolutely. Heck, you can store content directly in a WAR file, which is basically a JAR file with a few extra bits. Yes, you may need to write a custom resolver to use ClassLoader.getResourceAsStream, but basically as you're given the ability to generate the content however you like, fetching it from a jar file seems perfectly reasonable. You'll probably want to make sure it only fetches a very specific set of extensions though :)

提交回复
热议问题