This file contains hidden or 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
package org.scalatra.ssgi.servlet | |
import javax.servlet.ServletConfig | |
import javax.servlet.http.{HttpServletResponse, HttpServletRequest, HttpServlet} | |
import org.scalatra.ssgi.Application | |
class SsgiServlet extends HttpServlet { | |
override def init(config: ServletConfig) { |
This file contains hidden or 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
trait TemplateSupport extends ScalateSupport with Logging { self: ( | |
ScalatraKernel with FlashMapSupport with CookieSupport { def servletContext: ServletContext }) => | |
private var _viewsLocation = "/WEB-INF/views" | |
val Ssp = "ssp" | |
val Scaml = "scaml" | |
val Jade = "jade" | |
val Mustache = "mustache" |
This file contains hidden or 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
object Stream { | |
sealed trait XMPPStreamError | |
object BadFormatError { | |
def apply( text: Option[String] = None, applicationCondition: Seq[Node]) = { | |
<stream:error> | |
<bad-format xmlns={XMPP_STREAMS_NS} /> | |
{text.map(t => <text xmlns={XMPP_STREAMS_NS}>{t}</text>) getOrElse Nil} | |
{applicationCondition getOrElse Nil} | |
</stream:error> |
This file contains hidden or 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
override def packageOptions = | |
manifestClassPath.map(cp => ManifestAttributes( | |
(Attributes.Name.CLASS_PATH, cp), | |
(IMPLEMENTATION_TITLE, "Backchat XMPP module"), | |
(IMPLEMENTATION_URL, "http://backchat.im"), | |
(IMPLEMENTATION_VENDOR, "Mojolly Ltd."), | |
(IMPLEMENTATION_VERSION, version.toString) | |
)).toList ::: getMainClass(false).map(MainClass(_)).toList | |
def allArtifacts = { |
This file contains hidden or 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
# nginx - web server | |
description "nginx web server" | |
author "Graham Edgecombe <[email protected]>" | |
start on runlevel [2345] | |
stop on runlevel [016] | |
expect fork | |
respawn |
This file contains hidden or 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
# nginx - web server | |
description "nginx web server" | |
author "Ivan Porto Carrero" | |
start on (net-device-up and local-filesystems) | |
stop on runlevel [016] | |
expect fork | |
respawn | |
exec sudo /usr/local/sbin/nginx |
This file contains hidden or 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
package org.scalatra.auth | |
import OurImplicits._ | |
import com.mongodb.casbah.Imports._ | |
import org.scalatra.auth.{ScentryConfig, ScentrySupport} | |
import org.scalatra.ScalatraKernel | |
trait AuthenticationSupport extends ScentrySupport[DBObject] with BasicAuthSupport { self: ScalatraKernel => | |
val realm = Config.serviceName |
This file contains hidden or 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.mongodb.casbah.Imports._ | |
import akka.util.Logging | |
import com.mongodb.DBRef | |
import org.bson.types.ObjectId | |
trait DataCollection extends Logging with BackchatJsonFormat { | |
private var _collection: MongoCollection = null | |
protected val collectionName: String | |
def db: MongoDB = Config.mongo.db |
This file contains hidden or 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
trait InputStreamRenderable extends Renderable { | |
def in: InputStream | |
def writeTo(out: OutputStream, cs: Charset) { | |
val in = this.in // it's a def, and we only want one | |
streamCopy(Channels.newChannel(in), Channels.newChannel(out)) | |
in.close() | |
} | |
private def streamCopy(src: ReadableByteChannel, dest: WritableByteChannel) { |
This file contains hidden or 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
get("/:login/:slug") { | |
contentType = "application/json" | |
val out = response.getOutputStream | |
while(true) { | |
val msg = pollBackendQueue | |
out.println(msg) | |
} | |
"" | |
} |
OlderNewer