Can anyone explain what happens when a play! app is deployed as a war file?
Play framework doesn't support the servlet specification, nevertheless among it's deployment options there's the possibility to package the whole app in a war file and deploy it to any servlet container.
From verson 1.1开发者_开发知识库, play uses netty as integrated web server.
I was wondering what happens when a play app is deployed in a war file.
Does it still uses netty inside the servlet container and wraps it up? Does it have any noticeable performance cost? Or it simply acceses the servlet container?
As Niels says, Play does not use Netty for deploying to the other platforms.
If you run Play using the play run
or play start
commands, it uses Netty to manage the requests, and then pass them on to the Play framework.
If you want to deploy to another application server however, this is not possible. So, Play wraps the HTTP handling around a ServletWrapper, which effectively converts the normal way Play works and makes it available on a J2EE stack conforming to the Servlet specification.
The specific code for this wrapper can be found here. When you build your WAR file, play effectively places this ServletWrapper as the exposed Servlet (much like Struts does with the ActionServlet) and it handles the necessary work to route the request through to the right place.
As far as I know it doesn't use netty. It has a special servlet which delegate the work to the play-classes. Only glassfish has a native play-container. It has obviously negative impact on performance.
As this page suggests,
In Play 1.2, You can take the .war
file with play war myapp -o myapp.war
command and deploy in one of the Java EE Servers listed in that page.
精彩评论