(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<!-- google's material design colours from | |
http://www.google.com/design/spec/style/color.html#color-ui-color-palette --> | |
<!--reds--> | |
<color name="md_red_50">#FFEBEE</color> | |
<color name="md_red_100">#FFCDD2</color> | |
<color name="md_red_200">#EF9A9A</color> |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
import scala.concurrent.{ExecutionContext, Future} | |
import spray.routing.{AuthenticationFailedRejection, RequestContext} | |
import spray.routing.authentication.{Authentication, ContextAuthenticator} | |
/** Token based authentication for Spray Routing. | |
* | |
* Extracts an API key from the header or querystring and authenticates requests. | |
* | |
* TokenAuthenticator[T] takes arguments for the named header/query string containing the API key and | |
* an authenticator that returns an Option[T]. If None is returned from the authenticator, the request |
package socket.proxy; | |
import java.io.IOException; | |
import java.net.InetSocketAddress; | |
import java.nio.ByteBuffer; | |
import java.nio.channels.AsynchronousChannelGroup; | |
import java.nio.channels.AsynchronousServerSocketChannel; | |
import java.nio.channels.AsynchronousSocketChannel; | |
import java.nio.channels.CompletionHandler; | |
import java.util.Queue; |