Dynamically add a servlet to the servletConfig

后端 未结 3 925
不知归路
不知归路 2020-12-16 20:13

I have a Java web application that uses a plugin architecture. I would like to know if anyone has a solution where by one could add a servlet, with serlvet mapping to the se

3条回答
  •  一生所求
    2020-12-16 20:33

    I don't think you can do that dynamically, but you might try making the servlet active or inactive using a filter that's preconfigured. Make the filter check for a value that you can alter dynamically, in either a database or the file system, and tell it how to reroute the request if the servlet is "turned off."

    I think it'd be rude to simply turn off a servlet without giving users some kind of feedback.

提交回复
热议问题