root
|- sub1
|- sub2
- root aggregates sub1 and sub2
- sub1 depends on sub2
| package services | |
| import akka.actor.Actor._ | |
| import com.typesafe.plugin._ | |
| import akka.actor.{Props, OneForOneStrategy, Actor} | |
| import play.api.libs.concurrent.Akka | |
| import play.api.Play.current | |
| case class EmailMessage(subject: String, recipient: String, from: String, text: String, html: String) |
| import play.api._ | |
| import play.api.mvc._ | |
| object Global extends GlobalSettings { | |
| def ResponseTime[A](action: Action[A]): Action[A] = Action(action.parser) { request => | |
| val start = System.currentTimeMillis | |
| val result = action(request) | |
| println( request + " -> " + (System.currentTimeMillis - start) + " ms.") | |
| result |
| def Secured[A](username: String, password: String)(action: Action[A]) = Action(action.parser) { request => | |
| request.headers.get("Authorization").flatMap { authorization => | |
| authorization.split(" ").drop(1).headOption.filter { encoded => | |
| new String(org.apache.commons.codec.binary.Base64.decodeBase64(encoded.getBytes)).split(":").toList match { | |
| case u :: p :: Nil if u == username && password == p => true | |
| case _ => false | |
| } | |
| }.map(_ => action(request)) | |
| }.getOrElse { | |
| Unauthorized.withHeaders("WWW-Authenticate" -> """Basic realm="Secured"""") |
| /* | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software | |
| * distributed under the License is distributed on an "AS IS" BASIS, | |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| package examples | |
| import org.specs2._ | |
| import specification._ | |
| import FakeApplication._ | |
| /** | |
| * This Specification shows how to declare only once the FakeApplication context in which all the examples | |
| * must be executed | |
| */ |
| package models.sgcore; | |
| import com.avaje.ebean.event.BeanPersistAdapter; | |
| import com.avaje.ebean.event.BeanPersistRequest; | |
| import javax.annotation.PreDestroy; | |
| import javax.persistence.*; | |
| import java.lang.reflect.InvocationTargetException; | |
| import java.lang.reflect.Method; | |
| import java.util.HashMap; |
| module Jekyll | |
| class TagCloudTag < Liquid::Tag | |
| safe = true | |
| def initialize(tag_name, text, tokens) | |
| super | |
| end | |
| def render(context) | |
| html = "" |