org.fusesource.scalate.guice.ScalateAtmosphereModule.scala Maven / Gradle / Ivy
package org.fusesource.scalate.guice
import collection.JavaConverters._
/**
* ScalateModule that also configures the Atmosphere framework
* which here acts as an extension to Jersey for developing
* Comet/WebSocket resources.
*
* @author Sven Jacobs
*/
class ScalateAtmosphereModule extends ScalateModule {
override def configureServlets() {
// We don't need to call super.applyJerseyFilter here because Atmosphere
// will configure / is using Jersey
applyScalateServlets
applyAtmosphereServlets()
}
protected def applyAtmosphereServlets() {
val props: Map[String, String] = (for ((name, value) <- createResourceConfigProperties) yield (name, value.toString)) ++ Map(
"org.atmosphere.useWebSocket" -> "true",
"org.atmosphere.useNative" -> "true"
)
// This regex matches everything except when the URI ends with common file extensions (.js, .css, etc).
// The outer group is required by Guice's servlet configuration and matches the whole URI
val regex = "(^/.*(?
© 2015 - 2025 Weber Informatics LLC | Privacy Policy