Skip to content

Commit 7d80882

Browse files
committed
Added example project that uses HTTPBuilder
1 parent 27b4c29 commit 7d80882

File tree

5 files changed

+57
-1
lines changed

5 files changed

+57
-1
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = tab
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[*.java]
16+
indent_size = 4

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@ examples/shell-project/.gradle
2727
examples/shell-project/.settings
2828
examples/shell-project/.project
2929
examples/shell-project/.classpath
30-
examples/minimal-project/.gradle
30+
examples/minimal-project/.gradle
31+
.idea
32+
*.iml

examples/httpbuilder-project/README.md

Whitespace-only changes.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
buildscript {
2+
dependencies {
3+
classpath 'org.codehaus.groovy.modules.http-builder:http-builder:0.7'
4+
}
5+
}
6+
7+
plugins {
8+
id "com.marklogic.ml-gradle" version "2.1.0"
9+
}
10+
11+
/*
12+
* This shows an example of using RESTClient - https://github.com/jgritman/httpbuilder/wiki/RESTClient - to talk to
13+
* our REST API server.
14+
*/
15+
task httpTest {
16+
doLast {
17+
def client = new groovyx.net.http.RESTClient("http://" + mlHost + ":" + mlRestPort)
18+
client.auth.basic mlUsername, mlPassword
19+
20+
println client.get(path: '/').data
21+
}
22+
}
23+
24+
/*
25+
* You can also easily get an instance of a MarkLogic DatabaseClient (part of the Java API) for talking to the REST
26+
* API server.
27+
*/
28+
task clientTest(type: com.marklogic.gradle.task.MarkLogicTask) {
29+
doLast {
30+
def client = newClient()
31+
println "DatabaseClient: " + client
32+
}
33+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
mlHost=localhost
2+
mlAppName=httpbuilder-project
3+
mlRestPort=8130
4+
mlUsername=admin
5+
mlPassword=admin

0 commit comments

Comments
 (0)