-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added example project that uses HTTPBuilder
- Loading branch information
Showing
5 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |