This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You create the trait. | |
trait JavaScriptCompilerComponent { | |
def compiler: JavaScriptCompiler | |
// You add the abstract method to get all javascript files. | |
def jsFiles: Seq[Source] | |
def getCompiledJavaScript = compiler.compile(jsFiles) | |
trait JavaScriptCompiler { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You create the trait. | |
trait JavaScriptCompilerComponent { | |
def compiler: JavaScriptCompiler | |
trait JavaScriptCompiler { | |
def compile(files: Seq[Source]): String | |
} | |
} | |
// You implement it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.twitter.finagle.http.path._ | |
import com.twitter.finagle.http.service.RoutingService | |
import com.twitter.finagle.http.{Request, Response, RichHttp, Http} | |
import com.twitter.finagle.{Service, SimpleFilter} | |
import org.jboss.netty.handler.codec.http._ | |
import org.jboss.netty.handler.codec.http.HttpResponseStatus._ | |
import org.jboss.netty.handler.codec.http.HttpVersion.HTTP_1_1 | |
import org.jboss.netty.buffer.ChannelBuffers.copiedBuffer | |
import org.jboss.netty.util.CharsetUtil.UTF_8 | |
import com.twitter.util.Future |
NewerOlder