When we upload a .class file or a servlet to the server, the webserver restarts. This does开发者_JAVA百科 not happen when we upload a JSP. Is there a way to configure Resin so that it dynamically loads the class without restarting the web server?
To my knowledge, Resin is the only servlet engine that can reload classes if they change. To do that, you need to use the <compiling-loader>
that configures an auto-compiling WEB-INF/classes-style class loader. This compiling-loader will automatically compile Java code into .class files loading them.
Below, an example of WEB-INF/web-resin.xml
:
<web-app xmlns="http://caucho.com/ns/resin">
<prologue>
<class-loader>
<compiling-loader path="WEB-INF/classes"
source="WEB-INF/src"/>
</class-loader>
</prologue>
</web-app>
My understanding is that Resin will check each and every source file and, if they have changed from the .class time/date/size in WEB-INF/classes
, then Resin unloads the current class from the JVM, recompiles the .java file, then reloads that class.
精彩评论