Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Actual versions of graffiti dependencies #2

Merged
merged 7 commits into from

2 participants

Commits on Mar 24, 2012
  1. @msavelyev

    gitignore

    msavelyev authored
  2. @msavelyev

    updated dependencies

    msavelyev authored
Commits on Mar 25, 2012
  1. @msavelyev
  2. @msavelyev

    renamed README

    msavelyev authored
  3. @msavelyev

    modified README for markdown

    msavelyev authored
  4. @msavelyev

    modified README for markdown

    msavelyev authored
  5. @msavelyev

    version 1.0-SNAPSHOT is back

    msavelyev authored
This page is out of date. Refresh to see the latest.
View
4 .gitignore
@@ -0,0 +1,4 @@
+/.idea
+*.iml
+target
+.DS_Store
View
60 README
@@ -1,60 +0,0 @@
-What is it?
-====================================================================================================
-Graffiti is a lightweight web framework for Groovy inspired by Sinatra
-
-
-Groovy Start:
-====================================================================================================
-
-import graffiti.*
-
-// only required once
-@Grab('com.goodercode:graffiti:1.0-SNAPSHOT')
-@Get('/hello')
-def hello() {
- 'Hello World!'
-}
-
-// /hello/name?name=You
-@Get('/hello/name')
-def helloWhomever() {
- "Hello ${parameters[name]}"
-}
-
-// a sample post
-@Post('/save')
-def save() {
- 'saved it'
-}
-
-// static files served from here
-Graffiti.root 'public'
-
-// we also have to setup what static files to serve
-Graffiti.serve '*.css'
-
-// required to process annotations
-Graffiti.serve this
-
-
-Running It:
-====================================================================================================
-
-It's super easy!
-
-groovy $YOUR_FILE_NAME.groovy
-
-
-Implicit Variables:
-====================================================================================================
-
-application - ServletContext
-parameters - map of parameters
-request - HttpServletRequest
-response - HttpServletResponse
-session - HttpSession
-
-
-That's all for now, not sure if or when I will add more features. Feel free to fork it and give it a go!
-
-Cheers!
View
63 README.md
@@ -0,0 +1,63 @@
+What is it?
+===========
+Graffiti is a lightweight web framework for Groovy inspired by Sinatra
+
+
+Groovy Start
+=============
+
+ import graffiti.*
+
+ // only required once
+ @Grab('com.goodercode:graffiti:1.0-SNAPSHOT')
+ @Get('/hello')
+ def hello() {
+ 'Hello World!'
+ }
+
+ // /hello/name?name=You
+ @Get('/hello/name')
+ def helloWhomever() {
+ "Hello ${parameters[name]}"
+ }
+
+ // a sample post
+ @Post('/save')
+ def save() {
+ 'saved it'
+ }
+
+ // static files served from here
+ Graffiti.root 'public'
+
+ // we also have to setup what static files to serve
+ Graffiti.serve '*.css'
+
+ // required to process annotations
+ Graffiti.serve this
+
+ // starting web server
+ Graffiti.start()
+
+
+Running It
+===========
+
+It's super easy!
+
+ groovy $YOUR_FILE_NAME.groovy
+
+
+Implicit Variables
+===================
+
+* `application` — ServletContext
+* `parameters` — map of parameters
+* `request` — HttpServletRequest
+* `response` — HttpServletResponse
+* `session` — HttpSession
+
+
+That's all for now, not sure if or when I will add more features. Feel free to fork it and give it a go!
+
+Cheers!
View
48 pom.xml
@@ -4,12 +4,10 @@
<groupId>com.goodercode</groupId>
<artifactId>graffiti</artifactId>
<packaging>jar</packaging>
- <version>1.0-rest-SNAPSHOT</version>
+ <version>1.0-SNAPSHOT</version>
<name>graffiti</name>
<url>http://maven.apache.org</url>
<properties>
- <gmaven.version>1.2</gmaven.version>
- <groovy.version>1.7.0</groovy.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
@@ -17,6 +15,7 @@
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
+ <version>1.4</version>
<executions>
<execution>
<goals>
@@ -29,14 +28,19 @@
<dependency>
<groupId>org.apache.ivy</groupId>
<artifactId>ivy</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.gmaven.runtime</groupId>
+ <artifactId>gmaven-runtime-1.8</artifactId>
+ <version>1.4</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>2.0.2</version>
+ <version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
@@ -46,7 +50,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
- <version>2.2</version>
+ <version>2.5</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
@@ -55,36 +59,42 @@
</build>
<dependencies>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>6.1.25</version>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ <version>8.1.2.v20120308</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.eclipse.jetty.orbit</groupId>
+ <artifactId>javax.servlet</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-plus</artifactId>
- <version>6.1.25</version>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.0.1</version>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-naming</artifactId>
- <version>6.1.25</version>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-webapp</artifactId>
+ <version>8.1.2.v20120308</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
- <version>${groovy.version}</version>
+ <version>1.8.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.8.1</version>
+ <version>4.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>spring-mock</artifactId>
- <version>2.0.8</version>
+ <artifactId>spring-test</artifactId>
+ <version>3.1.1.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
View
4 src/main/groovy/graffiti/Graffiti.groovy
@@ -1,5 +1,7 @@
package graffiti
+import org.eclipse.jetty.servlet.DefaultServlet
+
public class Graffiti {
static server
@@ -52,7 +54,7 @@ public class Graffiti {
}
- public static serve(String path, servlet = org.mortbay.jetty.servlet.DefaultServlet, configBlock = null) {
+ public static serve(String path, servlet = DefaultServlet, configBlock = null) {
config.mappings << ['path': path, 'servlet': servlet, 'configBlock': configBlock]
}
View
18 src/main/groovy/graffiti/Server.groovy
@@ -1,6 +1,9 @@
package graffiti
-import javax.naming.InitialContext
+import org.eclipse.jetty.webapp.WebAppContext
+import org.eclipse.jetty.server.session.HashSessionManager
+import org.eclipse.jetty.server.session.SessionHandler
+import org.eclipse.jetty.servlet.ServletHolder
class Server {
@@ -12,14 +15,14 @@ class Server {
Server(config) {
- jetty = new org.mortbay.jetty.Server(config.port as Integer)
- webAppContext = new org.mortbay.jetty.webapp.WebAppContext()
+ jetty = new org.eclipse.jetty.server.Server(config.port as Integer)
+ webAppContext = new WebAppContext()
// session setup
- def sessionManager = new org.mortbay.jetty.servlet.HashSessionManager()
- webAppContext.sessionHandler = new org.mortbay.jetty.servlet.SessionHandler(sessionManager)
+ def sessionManager = new HashSessionManager()
+ webAppContext.sessionHandler = new SessionHandler(sessionManager)
- jetty.addHandler(webAppContext)
+ jetty.handler = webAppContext
loadConfig(config)
@@ -66,7 +69,7 @@ class Server {
def servlet = mapping.servlet
if( servlet instanceof javax.servlet.Servlet ) {
- servlet = new org.mortbay.jetty.servlet.ServletHolder(servlet)
+ servlet = new ServletHolder(servlet)
println mapping
if( mapping.configBlock ) {
mapping.configBlock.delegate = servlet
@@ -76,7 +79,6 @@ class Server {
println 'adding servlet ' + servlet + ' to ' + path
webAppContext.addServlet(servlet, path)
- return
}
}
View
4 src/main/groovy/graffiti/Session.groovy
@@ -1,9 +1,11 @@
package graffiti
+import javax.servlet.http.HttpSession
+
class Session {
@Delegate
- def session
+ def HttpSession session
Session(session) {
this.session = session
View
2  src/sample/Rest.groovy
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
-@Grab('com.goodercode:graffiti:1.0-rest-SNAPSHOT')
+@Grab('com.goodercode:graffiti:1.0-SNAPSHOT')
@Grab('commons-httpclient:commons-httpclient:3.1')
import graffiti.*
Something went wrong with that request. Please try again.