Skip to content

Commit 0de32a8

Browse files
committed
etag
1 parent 584b5f5 commit 0de32a8

File tree

5 files changed

+1171
-8
lines changed

5 files changed

+1171
-8
lines changed

ETag/build.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apply plugin: 'groovy'
2+
apply plugin: 'application'
3+
4+
sourceCompatibility = 1.7
5+
version = '1.0'
6+
mainClassName = "io.github.javaconductor.gserv.samples.etag.Main"
7+
repositories {
8+
mavenCentral()
9+
mavenLocal()
10+
}
11+
12+
dependencies {
13+
// The production code uses the SLF4J logging API at compile time
14+
compile('org.codehaus.groovy:groovy-all:2.3.0')
15+
compile group: 'io.github.javaconductor', name: 'gserv', version: '0.9.0'
16+
testCompile group: 'junit', name: 'junit', version: '4.11'
17+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
package io.github.javaconductor.gserv.samples.etag
3+
4+
import io.github.javaconductor.gserv.*
5+
import io.github.javaconductor.gserv.plugins.*
6+
import io.github.javaconductor.gserv.utils.Encoder
7+
8+
class Main {
9+
10+
static public void main(String[] args) {
11+
println "Main started!!"
12+
def pluginMgr = PluginMgr.instance()
13+
14+
def asMap = { thing ->
15+
thing.class.declaredFields { !it.synthetic }.collectEntries {
16+
[(it.name): thing."$it.name"]
17+
}
18+
}
19+
20+
def gserv = new GServ();
21+
gserv.plugins {
22+
// plugin("eventLogger", ["url":"/log"])
23+
plugin("caching", [:])
24+
plugin("compression", [:])
25+
}.http {
26+
useResourceDocs(true)
27+
get("/", file("text/plain", "data/rfile.txt"))
28+
strongETag( "/*"){exch, data ->
29+
//MD5 it
30+
Encoder.md5WithBase64(data)
31+
}
32+
}.start(54321)
33+
}//main
34+
}

0 commit comments

Comments
 (0)