Play Framework

Heroku at JavaZone 2012

I’m really looking forward to being back at JavaZone in Oslo this September! I’ll be speaking about Running Java, Play! and Scala Apps on the Cloud. This session will teach you how to get started deploying Java and Scala apps on Heroku. I’ll be around for the whole conference, so if anyone wants to grab a drink, deploy some apps, or write some code with me, then let me know. See you there!

Edge Caching With Play 2, Heroku, and CloudFront

Web applications are primarily comprised of data, services, and the User Interface (UI). The UI is comprised of HTML, CSS, images, and probably JavaScript. In the traditional web architecture all of the UI assets are static files except the HTML which is dynamically generated by the server. In the modern web architecture the entire UI is static files that consume RESTful / JSON services. The static files for the UI must be downloaded to the client so the less time it takes for them to be downloaded, the better the overall performance of the application.

Getting Started with Play 2, Scala, and Squeryl

My friend Ryan Knight and I co-authored an article which has just been published on Artima: Getting Started with Play 2, Scala, and Squeryl. This article will help you get started building a Play 2 application from scratch that uses Scala and Squeryl for ORM. The article also covers how use ScalaTest, JSON, jQuery, CoffeeScript, and deployment on Heroku. Give it a try and let me know how it goes!

Optimizing Play 2 for Database-Driven Apps

Update: There is now a detailed doc in Play’s documentation about configuring Play’s thread pools.

Last week Matt Raible and I presented the Play vs. Grails Smackdown at ÜberConf. The goal of the session was to compare Play 2 + Java with Grails by creating the same app with each framework. We used a number of criteria for the comparison including some benchmarks. You can read more about the results in Matt’s session recap blog. After presenting the results we learned that it’s pretty important to optimize Play 2’s Akka threading system in these types of applications. Play 2 is optimized out-of-the-box for HTTP requests which don’t contain blocking calls (i.e. asynchronous). Most database-driven apps in Java use synchronous calls via JDBC so Play 2 needs a bit of extra configuration to tune Akka for these types of requests.

Play 2 Scala Console on Heroku

I’ve been working on a Play 2 application that I’ll be using for the Grails vs Play Smackdown at ÜberConf next week. The app is running in production on Heroku but since I don’t have an admin UI yet, I needed a quick and easy way to create a new entity. I could have gone straight to the database but thought it would be better to run Play 2’s Scala Console on Heroku and then just run some arbitrary Scala code. The Scala Console in Play 2 is really just the Scala REPL in SBT but it allows you to interact with a Play application.

Play 2 Java Tutorial

Update: This tutorial is a bit old. For more up-to-date tutorials see: https://www.playframework.com/documentation/2.3.x/Tutorials

I’ve created a Play 2 Tutorial and posted it on GitHub! The tutorial covers how to:

Each section has a corresponding branch in git so you can diff against my version to see if you’ve done everything correctly. Right now this is just for Play 2 with Java and Ebean but I’m working on doing this for Play 2 with Scala as well.

Heroku, Java, Play and Neo4j Presos: Denver JUG, Atlanta JUG, London Flash UG & Webinar

Over the next couple weeks I’ll be doing two Java User Group presentations, a Flash Platform User Group presentation and one Webinar. Hope to see you at one of these events:

  • Thursday May 10 - Webinar hosted by Neo4j:
    Graphs in the Cloud: Neo4j and Heroku
  • Tuesday May 15 - Atlanta Java User Group:
    Running Java, Play! and Scala Apps on the Cloud
  • Thursday May 24 - London Flash Platform User Group:
    HTML5 Apps in Java & Scala with the Play Framework
    Deploying Apps on the Cloud with Heroku
  • Introducing WebJars – Web Libraries as Managed Dependencies

    Update: I’ve created a Spring MVC WebJars example.
    Update 2: Ukrainian translation here - http://softdroid.net/vvedennya-webjars by Eclipse Android.
    Update 3: WebJars.org has been officially launched! Learn more.

    Our web apps are using more and more web libraries like jQuery, Backbone.js and Twitter Bootstrap. The traditional way to use those libraries is to locate & download the JavaScript and CSS source then just copy it into a project. To me this resembles how we used to just copy JAR files into a project’s WEB-INF/lib dir. But why not do with web libraries like we now do with Java libraries and specify them as managed dependencies? This allows us to declaratively set the version, use a consistent version across an application, and easily deal with transitive dependencies. Then we just need web frameworks that can serve static assets from JAR files and we are good to go! Luckily Play 2 and Dropwizard both have out-of-the-box support for this. So I decided to give it a try…