Skip to content

Instantly share code, notes, and snippets.

@fedesilva
Created October 11, 2010 12:10
Show Gist options
  • Save fedesilva/620427 to your computer and use it in GitHub Desktop.
Save fedesilva/620427 to your computer and use it in GitHub Desktop.
Simple framework I made sunday morning.
package splendido
import pragmagica.util.servlet._
import java.util.Date
class App extends ApplicationFilter {
override def routes = super.routes +
( "^/$".r , (c) => new Index(c) ) +
( "^/contacto".r , (c) => new Contacto(c) )
}
class Index(val ctx:Context) extends Handler with Scalate {
override def get { render("/index.ssp") }
}
class Contacto(val ctx:Context) extends Handler {
override def get {
if( isXhr )
write((new Date).toString)
else
sendError(403,"""{ "wtf": "Resource not accesible via normal get" }""")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment