Created
October 11, 2010 12:10
-
-
Save fedesilva/620427 to your computer and use it in GitHub Desktop.
Simple framework I made sunday morning.
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 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