Extending Java Web Applications with plugins

后端 未结 8 1111
一向
一向 2021-02-09 14:10

I have this web application that has grown to an unmanageable mess.

I want to split it into a common \"framework\" part (that still includes web stuff like pages and im

8条回答
  •  灰色年华
    2021-02-09 14:51

    I also been trying develop a common or abstract framework where I can add plugins (or modules) at runtime and enhance existing running webapp.

    Now, as you said, preferred ed way to do it using WAR or JAR file. Problem with WAR file is, you can't deploy as plugin to existing app. Tomcat will deploy it as separate web context. Not desirable.

    Another option is to JAR file and write some custom code to copy that JAR file to WEB-INF/lib folder and load the classes into existing classloader. Problem is, how to deploy non-java files like JSP or config files. For that, there r two solutions, a. Use velocity templates instead of JSP (b.) write some custom code to read JSP from classpath instead of context path.

    OSGI or Spring Dynamic modules are nice, but at this time, they look overly complex to me. I will look into that again, if I get feel of it.

    I am looking for simple API, which can take care of life cycle of plugin and still able to use JSPs in my packaged JAR file.

    May be, you can use un jar the plugin at time deployment and copy files to right directories.

提交回复
热议问题