Compiling Gils Grails?

When you compile the Grails war, I understand that the .groovy code is compiled for the bytecode of the class files, but I don’t understand how the container (say tomcat) knows how to compile GSP on request, Do containers understand GSP? Does the fact that grails is installed on the server hook in containers mean?

In addition, when the GSP is used for the first time, it compiles on demand and only once. It's right? Thanks.

+7
source share
3 answers

Do GSP containers know?

GSPs are actually compiled into class files when the war is built, and not during tomcat runtime - if you unzip the war file, you can see what it does (look at the unpacked WEB-INF / classes directory)

... gsp_appname_controllerNameviewName_gsp.class gsp_appname_controllerNameanotherViewName_gsp.class ... 

The container does not need to do anything at runtime, since everything is precompiled.

Is there any fact that grails is installed on the server in containers?

This is not true; everything necessary to run the application is included in the war, so the rake installed on the container server does not matter.

+12
source

Ok, so just found this on the mailing list:

Since grails 1.2 gsps are precompiled when creating a war file.

+3
source

GSPs are like JSPs; they are ultimately servlets.

So, when you create the .war file, your GSP is pre-compiled into servlets and included in your WEB-INF / classes.war folder. (they start with gsp_controlleraction _ **. class)

So no, Tomcat doesn't know how to compile GSP, but it can execute servlets.

Vincent.

+1
source

All Articles