tomcatdeploymentplayframeworkservlet-container

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?


Solution

  • 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.