Permalink
Browse files

init

  • Loading branch information...
0 parents commit fdac836d27c05e84f0e221632c5a12a252cb5bfd @jamesward committed Aug 2, 2012
@@ -0,0 +1,10 @@
+logs
+project/project
+project/target
+target
+tmp
+.history
+dist
+/.idea
+/.idea_modules
+/.settings
@@ -0,0 +1,2 @@
+Play 2 with CloudFront
+----------------------
@@ -0,0 +1,2 @@
+$ ->
+ $("img").fadeIn()
@@ -0,0 +1,15 @@
+package controllers;
+
+
+import play.mvc.Controller;
+import play.mvc.Result;
+
+import views.html.index;
+
+public class Application extends Controller {
+
+ public static Result index() {
+ return ok(index.render());
+ }
+
+}
@@ -0,0 +1,30 @@
+package controllers
+
+import play.api.mvc.{AnyContent, Action}
+import play.api.mvc.Controller
+import play.api.Play
+import play.api.Play.current
+
+
+object ExternalAssets extends Controller {
+
+ def at(path: String, file: String): Action[AnyContent] = Action { request =>
+ val action: Action[AnyContent] = Assets.at(path, file)
+ action.apply(request)
+ }
+
+ def at(url: String) = {
+ Play.configuration.getString("contentURL") match {
+ case Some(contentURL) => contentURL + controllers.routes.ExternalAssets.at(url).url
+ case None => controllers.routes.ExternalAssets.at(url)
+ }
+ }
+
+ def getContentURL() = {
+ Play.configuration.getString("contentURL") match {
+ case Some(contentURL) => contentURL
+ case None => ""
+ }
+ }
+
+}
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <title>Play 2 with CloudFront</title>
+ <script type='text/javascript' src='@ExternalAssets.at("jquery.min.js")'></script>
+ <script type='text/javascript' src='@ExternalAssets.at("javascripts/index.min.js")'></script>
+</head>
+<body>
+ <img src='@ExternalAssets.at("images/dolomites_bridge.jpg")' style="display: none;" width="640"/>
+</body>
+</html>
@@ -0,0 +1,58 @@
+# This is the main configuration file for the application.
+# ~~~~~
+
+# Secret key
+# ~~~~~
+# The secret key is used to secure cryptographics functions.
+# If you deploy your application to several instances be sure to use the same key!
+application.secret="_rUil?JkZF]hvb>=svpqrYL:Fe;9<RM5gNP:ymYKpP5T?Kxb]Rh9j6nosx65]Srs"
+
+# The application languages
+# ~~~~~
+application.langs="en"
+
+# Global object class
+# ~~~~~
+# Define the Global object class for this application.
+# Default to Global in the root package.
+# global=Global
+
+# Database configuration
+# ~~~~~
+# You can declare as many datasources as you want.
+# By convention, the default datasource is named `default`
+#
+# db.default.driver=org.h2.Driver
+# db.default.url="jdbc:h2:mem:play"
+# db.default.user=sa
+# db.default.password=
+#
+# You can expose this datasource via JNDI if needed (Useful for JPA)
+# db.default.jndiName=DefaultDS
+
+# Evolutions
+# ~~~~~
+# You can disable evolutions if needed
+# evolutionplugin=disabled
+
+# Ebean configuration
+# ~~~~~
+# You can declare as many Ebean servers as you want.
+# By convention, the default server is named `default`
+#
+# ebean.default="models.*"
+
+# Logger
+# ~~~~~
+# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .
+
+# Root logger:
+logger.root=ERROR
+
+# Logger used by the framework:
+logger.play=INFO
+
+# Logger provided to your application:
+logger.application=DEBUG
+
+contentURL=${?CONTENT_URL}
@@ -0,0 +1,9 @@
+# Routes
+# This file defines all application routes (Higher priority routes first)
+# ~~~~
+
+# Home page
+GET / controllers.Application.index()
+
+# Map static resources from the /public folder to the /assets URL path
+GET /assets/*file controllers.ExternalAssets.at(path="/public", file)
@@ -0,0 +1,18 @@
+import sbt._
+import Keys._
+import PlayProject._
+
+object ApplicationBuild extends Build {
+
+ val appName = "play2-cloudfront"
+ val appVersion = "1.0-SNAPSHOT"
+
+ val appDependencies = Seq(
+ "com.jquery" % "jquery" % "1.7.2-1"
+ )
+
+ val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
+ resolvers += "webjars" at "http://webjars.github.com/m2"
+ )
+
+}
@@ -0,0 +1 @@
+sbt.version=0.11.3
@@ -0,0 +1,8 @@
+// Comment to get more information during initialization
+logLevel := Level.Warn
+
+// The Typesafe repository
+resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
+
+// Use the Play sbt plugin for Play projects
+addSbtPlugin("play" % "sbt-plugin" % "2.0.2")
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fdac836

Please sign in to comment.