Play Framework application bind address and port

I have recently begun experimenting with the Play Framework and I think it is great. Definitely something worth looking into. This post is based on my experience with Play 2.1.2, but I am convinced that it applies to 2.0.x versions as well (and quite possibly to older versions too). I am using an embeded Netty server that is a build in default server in Play Framework.
Play works just fine if you are satisfied with the defaults, but the alternative configuration can pose a challenge.
The default bind address is 0.0.0.0:9000 and it fine, but I needed it to change to meet the OpenShift's demands. I wanted to bind a Play application on one specific address along with a non standard port.
The configuration described in the Play's documentation works, but only from the Play's console and I needed to launch the application directly from the command line and that is where I got stuck for quite a while. And this is what I found out.



If you want your application to bind to a different port and address while launching it directly from a command line by a following command, you have to use a quotation marks to group all the parameters together.
This is how you start your application using defaults (0.0.0.0:9000).
$ play start
This is how you bind your application to the 8080 port (still all addresses).
$ play "start 8080"
And finally this is how you bind the application to a specific address and a port.
$ play "start -Dhttp.port=1234 -Dhttp.address=127.0.0.1" 
Please note that the quotation marks are vital. You don't need them when you are launching your application from the Play's console, but you have to use them from the command line. If you omit the quotation marks, everything after the first word (start in this case) is disregarded.

Comments

  1. This is good piece of writing and pleasant urging commented
    here, I am really enjoying by these.
    kajal agarwal hot

    ReplyDelete
  2. Most would advise towards this though, as the bets effectively cancel one another out. The green pocket is also be|can be} in play that means there’s a chance you’d lose on both bets regardless. The ‘house edge’ is the benefit that a casino has over a participant. For each 카지노사이트 casino sport, the house edge is written as a share.

    ReplyDelete

Post a Comment

Popular posts from this blog

Automatic jsp recompile on Jboss AS 7

Running scripts written in Clojure as an executable using Inlein

Password hashing in Java