Skip to content

Commit

Permalink
Added example project that uses HTTPBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrudin committed May 4, 2016
1 parent 27b4c29 commit 7d80882
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# http://editorconfig.org
root = true

[*]
indent_style = tab
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.java]
indent_size = 4
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ examples/shell-project/.gradle
examples/shell-project/.settings
examples/shell-project/.project
examples/shell-project/.classpath
examples/minimal-project/.gradle
examples/minimal-project/.gradle
.idea
*.iml
Empty file.
33 changes: 33 additions & 0 deletions examples/httpbuilder-project/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
buildscript {
dependencies {
classpath 'org.codehaus.groovy.modules.http-builder:http-builder:0.7'
}
}

plugins {
id "com.marklogic.ml-gradle" version "2.1.0"
}

/*
* This shows an example of using RESTClient - https://github.com/jgritman/httpbuilder/wiki/RESTClient - to talk to
* our REST API server.
*/
task httpTest {
doLast {
def client = new groovyx.net.http.RESTClient("http://" + mlHost + ":" + mlRestPort)
client.auth.basic mlUsername, mlPassword

println client.get(path: '/').data
}
}

/*
* You can also easily get an instance of a MarkLogic DatabaseClient (part of the Java API) for talking to the REST
* API server.
*/
task clientTest(type: com.marklogic.gradle.task.MarkLogicTask) {
doLast {
def client = newClient()
println "DatabaseClient: " + client
}
}
5 changes: 5 additions & 0 deletions examples/httpbuilder-project/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mlHost=localhost
mlAppName=httpbuilder-project
mlRestPort=8130
mlUsername=admin
mlPassword=admin

0 comments on commit 7d80882

Please sign in to comment.