When you compile a grails war, I understand that the .groovy code is compiled in to bytecode class files, but I don't understand how the container (say, tomcat), knows how to compile the GSPs when they are requested. Do the containers understand GSP? Does the fact that grails is installed on the server hook into the containers?
Also, when the GSP is used for the first time, it is compiled then on demand and only once. Is this correct? Thanks.
Do the containers understand GSP?
The GSPs are actually compiled into class files when the war is built, and not at runtime by tomcat - if you unzip the war file, you can look at what it does (look at the unzipped WEB-INF/classes directory):
...
gsp_appname_controllerNameviewName_gsp.class
gsp_appname_controllerNameanotherViewName_gsp.class
...
The container doesn't need to do anything at runtime, since everything's pre-compiled.
Does the fact that grails is installed on the server hook into the containers?
It does not; everything needed for the application to run is included in the war, so grails being installed on the container's server makes no difference.
Ok, so just found this on the mailing list:
Since grails 1.2 the gsps are pre compiled when generating the war file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With