Skip to content

Commit 9139f3a

Browse files
committed
Updates
1 parent a4d6a57 commit 9139f3a

File tree

5 files changed

+15
-20
lines changed

5 files changed

+15
-20
lines changed

CrossSiteScripting/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ repositories {
1313
dependencies {
1414
// The production code uses the SLF4J logging API at compile time
1515
compile('org.codehaus.groovy:groovy-all:2.3.0')
16-
compile group: 'io.github.javaconductor', name: 'gserv', version: '0.9.7'
16+
compile group: 'io.github.javaconductor', name: 'gserv', version: '0.9.9'
1717
testCompile group: 'junit', name: 'junit', version: '4.11'
1818
}

CrossSiteScripting/src/main/groovy/io/github/javaconductor/gserv/examples/crosssite/Main.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class Main {
5757
}
5858

5959
}.start(60001);
60+
6061
};
6162

6263
}

ETag/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apply plugin: 'groovy'
22
apply plugin: 'application'
33

4-
sourceCompatibility = 1.7
4+
sourceCompatibility = 1.6
55
version = '1.0'
66
mainClassName = "io.github.javaconductor.gserv.samples.etag.Main"
77
repositories {
@@ -12,7 +12,7 @@ repositories {
1212
dependencies {
1313
// The production code uses the SLF4J logging API at compile time
1414
compile('org.codehaus.groovy:groovy-all:2.3.0')
15-
compile group: 'io.github.javaconductor', name: 'gserv', version: '0.9.6'
15+
compile group: 'io.github.javaconductor', name: 'gserv', version: '0.9.8'
1616

1717
testCompile group: 'junit', name: 'junit', version: '4.11'
1818
}

ETag/src/main/groovy/io/github/javaconductor/gserv/samples/etag/Main.groovy

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package io.github.javaconductor.gserv.samples.etag
44
import io.github.javaconductor.gserv.*
55
import io.github.javaconductor.gserv.plugins.*
66
import io.github.javaconductor.gserv.utils.Encoder
7+
import net.sf.json.JSONObject
78

89
class Main {
910

@@ -27,11 +28,18 @@ class Main {
2728
get("/", file("text/plain", "data/rfile.txt"))
2829

2930
// This will create a Base64 String for the eTag
30-
strongETag( "/*"){exch, data ->
31+
strongETag( "/"){exch, data ->
3132
//MD5 it
3233
Encoder.md5WithBase64(data)
3334
}
3435

36+
// This will create a Base64 String for the eTag
37+
weakETag( "/answers/*"){context, actionArgs ->
38+
//MD5 it
39+
def data = actionArgs.join('.').bytes
40+
Encoder.md5WithBase64(data)
41+
}
42+
3543
get('/answers/:op/:num1:Number/:num2:Number'){ op, num1, num2 ->
3644
def ans
3745
switch(op){
@@ -43,20 +51,6 @@ class Main {
4351
writeJson(ans : ans)
4452
}
4553

46-
// https://github.com/javaConductor/gserv/issues/11
47-
// THIS DOES NOT WORK - ONLY Context is passed.
48-
// // This will create an eTag based sole on the request values
49-
// // this is fine as long as a set of results always returns the same value.
50-
// /// Example: when a GET is sent tot this resource like: /add/23.12/43.45, the
51-
// /// response will always be 66.57
52-
// weakETag( "/answers/:op/:num1/:num2"){op, num1, num2 ->
53-
// Encoder.md5WithBase64("$num1_$op_$num2".bytes)
54-
// }
55-
56-
/* weakETag( "/answers/:op/:num1/:num2"){ context ->
57-
Encoder.md5WithBase64(context.requestURI.path.bytes)
58-
}
59-
*/
6054
}.start(54321)
6155
}//main
6256
}

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
allprojects {
22
apply plugin: 'groovy'
3-
sourceCompatibility = 1.5
3+
sourceCompatibility = 1.6
44
version = '1.0'
55
task wrapper(type: Wrapper) {
66
gradleVersion = '2.0'
@@ -16,7 +16,7 @@ subprojects {
1616
}
1717
dependencies {
1818
compile('org.codehaus.groovy:groovy-all:2.3.0')
19-
compile group: 'io.github.javaconductor', name: 'gserv', version: '0.9.7'
19+
compile group: 'io.github.javaconductor', name: 'gserv', version: '0.9.9'
2020
testCompile group: 'io.github.javaconductor', name: 'gserv-test', version: '1.0.0'
2121

2222
}

0 commit comments

Comments
 (0)