diff --git a/.classpath b/.classpath
deleted file mode 100644
index 0af6735..0000000
--- a/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/.gitignore b/.gitignore
index 1ebf457..b9232aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,75 @@
-target/
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
+
+# Generated files
+.idea/**/contentModel.xml
+
+# Sensitive or high-churn files
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/dbnavigator.xml
+
+# Gradle
+.idea/**/gradle.xml
+.idea/**/libraries
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn. Uncomment if using
+# auto-import.
+.idea/artifacts
+.idea/compiler.xml
+.idea/jarRepositories.xml
+.idea/modules.xml
+.idea/*.iml
+.idea/modules
*.iml
+*.ipr
+
+# CMake
+cmake-build-*/
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# File-based project format
+*.iws
+
+# IntelliJ
+out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+# Editor-based Rest Client
+.idea/httpRequests
+
+# Android studio 3.1+ serialized cache file
+.idea/caches/build_file_checksums.ser
+build/
+.gradle/
.idea/
+target/
diff --git a/.project b/.project
deleted file mode 100644
index ae9ab19..0000000
--- a/.project
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
- HTTPBuilder
-
-
-
-
-
- org.maven.ide.eclipse.maven2Builder
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.codehaus.groovy.eclipse.groovyBuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.maven.ide.eclipse.maven2Nature
- org.codehaus.groovy.eclipse.groovyNature
-
-
diff --git a/.settings/org.codehaus.groovy.eclipse.preferences.prefs b/.settings/org.codehaus.groovy.eclipse.preferences.prefs
deleted file mode 100644
index 8cace4e..0000000
--- a/.settings/org.codehaus.groovy.eclipse.preferences.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-#Fri Dec 19 20:51:50 EST 2008
-eclipse.preferences.version=1
-groovy.compiler.output.path=bin/groovy
-support.groovy=true
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 8151565..0000000
--- a/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,6 +0,0 @@
-#Mon Nov 24 14:58:58 EST 2008
-eclipse.preferences.version=1
-org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,*.groovy
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/.settings/org.eclipse.mylyn.tasks.ui.prefs b/.settings/org.eclipse.mylyn.tasks.ui.prefs
deleted file mode 100644
index b36bcda..0000000
--- a/.settings/org.eclipse.mylyn.tasks.ui.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-#Thu Dec 18 17:01:03 EST 2008
-eclipse.preferences.version=1
-project.repository.kind=jira
-project.repository.url=http\://jira.codehaus.org
diff --git a/README b/README.md
similarity index 51%
rename from README
rename to README.md
index b875f2f..7c3e4d7 100644
--- a/README
+++ b/README.md
@@ -1,16 +1,52 @@
-HTTPBuilder = Easy HTTP client for Groovy.
+## HTTPBuilder = Easy HTTP client for Groovy.
Build Instructions:
- HTTPBuilder is built using Apache Maven (http://maven.apache.org)
- $ mvn install
+ HTTPBuilder is built using Gradle (https://gradle.org/)
+
+ $ ./gradlew publishToMavenLocal
Documentation: https://github.com/jgritman/httpbuilder/wiki
-Contributions:
+### Installation
+Add dependency to your build.gradle
+
+```
+repositories {
+ ...
+ maven { url "https://jitpack.io" }
+}
+
+dependencies {
+ compile 'com.github.jgritman:httpbuilder:1.0-M1-snapshot'
+}
+```
+
+In addition if you don't want to use jitpack.io then use following github package registry:
+
+```groovy
+repositories {
+ maven {
+ name = "GitHubPackages"
+ url = uri("https://maven.pkg.github.com/jgritman/httpbuilder")
+ credentials {
+ username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_USERNAME")
+ password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
+ }
+ }
+ }
+
+ dependencies {
+ compile 'org.codehaus.groovy.modules.http-builder:http-builder:1.0-M1-snapshot'
+ }
+
+```
+
+
+### Contributions:
This project relies on the work of many open source projects including:
- * Groovy: http://groovy.codehaus.org
+ * Groovy: http://groovy-lang.org
* Apache HttpClient: http://hc.apache.org
* Json-Lib: http://json-lib.sourceforge.net/
* Neko HTML: http://nekohtml.sourceforge.net/
@@ -21,7 +57,7 @@ Contributions:
re-distributed with permission from the author.
-License:
+### License:
HTTPBuilder is copyright 2009-2011 Thomas Nichols except where otherwise noted.
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..f621789
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,133 @@
+buildscript {
+ repositories {
+ mavenLocal()
+ maven { url "https://plugins.gradle.org/m2/" }
+ }
+ dependencies {
+ classpath "com.gorylenko.gradle-git-properties:gradle-git-properties:2.3.2"
+ }
+}
+
+plugins {
+ id 'groovy'
+}
+
+apply plugin: 'maven'
+apply plugin: 'maven-publish'
+apply plugin: "com.gorylenko.gradle-git-properties"
+
+group 'org.codehaus.groovy.modules.http-builder'
+version '1.0-M1-snapshot'
+
+sourceCompatibility = 1.8
+
+repositories {
+ mavenLocal()
+ mavenCentral()
+ maven { url "https://repo1.maven.org/maven2/" }
+}
+
+dependencies {
+ compile "org.apache.httpcomponents:httpclient:4.2.6"
+ compile 'net.sf.json-lib:json-lib:2.4:jdk15'
+ compile "org.codehaus.groovy:groovy-json:${groovyVersion}"
+ compile "org.codehaus.groovy:groovy-xml:${groovyVersion}"
+ compile "org.codehaus.groovy:groovy:${groovyVersion}"
+ compile "net.sourceforge.nekohtml:nekohtml:1.9.16"
+ compile "xml-resolver:xml-resolver:1.2"
+ compile "oauth.signpost:signpost-commonshttp4:1.2.1.1"
+ compile "oauth.signpost:signpost-core:1.2.1.1"
+ compile "com.google.appengine:appengine-api-1.0-sdk:1.3.8"
+ compile "xerces:xercesImpl:[2.6.2,)"
+ testCompile "log4j:log4j:1.2.16"
+ testCompile "commons-io:commons-io:1.4"
+ testCompile "junit:junit:4.5"
+ compile "com.anasoft.os:m2st-doxia-macros:${m2stVersion}"
+ compile "org.apache.maven.doxia:doxia-sink-api:1.1.3"
+ compile "org.apache.maven.doxia:doxia-core:1.1.3"
+}
+
+
+javadoc {
+ source = sourceSets.main.allJava
+ classpath = configurations.compileClasspath
+
+ options
+ {
+ setMemberLevel JavadocMemberLevel.PUBLIC
+ setAuthor true
+
+ links "https://docs.oracle.com/javase/8/docs/api/"
+ }
+}
+
+gitProperties {
+ keys = ['git.branch', 'git.commit.id', 'git.commit.time', 'git.commit.id.abbrev']
+ failOnNoGitDirectory = true
+ extProperty = 'gitProps' // git properties will be put in a map at project.ext.gitProps
+}
+
+generateGitProperties.outputs.upToDateWhen {
+ false
+} // make sure the generateGitProperties task always executes (even when git.properties is not changed)
+
+jar {
+ dependsOn generateGitProperties
+ manifest {
+ attributes("Built-By": System.getProperty("user.name"))
+ attributes(["Plugin-Version" : version,
+ "Plugin-Title" : project.name,
+ "Plugin-Build-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
+ "Git-Commit" : "${-> project.ext.gitProps['git.commit.id.abbrev']}",
+ "Git-Branch" : "${-> project.ext.gitProps['git.branch']}"])
+ }
+ from sourceSets.main.output
+ exclude 'git.properties'
+}
+
+task sourceJar(type: Jar) {
+ classifier = 'sources'
+ from sourceSets.main.allJava
+}
+
+task packageJavadoc(type: Jar) {
+ from javadoc
+ classifier = 'javadoc'
+}
+
+tasks.withType(Javadoc) {
+ failOnError false
+ options.addStringOption('Xdoclint:none', '-quiet')
+ options.addStringOption('encoding', 'UTF-8')
+ options.addStringOption('charSet', 'UTF-8')
+}
+
+
+publishing {
+ repositories {
+ maven {
+ name = "GitHubPackages"
+ url = uri("https://maven.pkg.github.com/jgritman/httpbuilder")
+ credentials {
+ username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_USERNAME")
+ password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
+ }
+ }
+ maven {
+ name = "NexusRepo"
+ credentials {
+ username project.findProperty("nexusUsername") ?: System.getenv("NEXUS_USERNAME")
+ password project.findProperty("nexusPassword") ?: System.getenv("NEXUS_PASSWORD")
+ }
+ url project.findProperty("nexusUrl") ?: System.getenv("NEXUS_URL")
+ }
+ }
+
+ publications {
+ mavenJava(MavenPublication) {
+ from components.java
+ artifact sourceJar
+ artifact packageJavadoc
+ }
+ }
+}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..d87d253
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,2 @@
+groovyVersion = 3.0.8
+m2stVersion = 2.0
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..87b738c
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..19ee455
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
\ No newline at end of file
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..af6708f
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..6d57edc
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index e67fa4e..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,477 +0,0 @@
-
-
- 4.0.0
- http-builder
- org.codehaus.groovy.modules.http-builder
- 0.7.3-SNAPSHOT
- HTTP client framework for Groovy
- http://groovy.codehaus.org/modules/http-builder/
- 2008
-
-
- A builder-style HTTP client API, including authentication, and extensible
- handling of common content-types such as JSON and XML. It is built on top of
- Apache's HttpClient.
-
-
-
-
- ${project.version}
- UTF-8
- 2.0
- UA-11299971-1
- _setDetectTitle(true)
-
-
-
-
- org.apache.httpcomponents
- httpclient
- 4.2.1
-
-
-
- net.sf.json-lib
- json-lib
- 2.3
- jdk15
-
-
- org.jruby
- jruby
-
-
- xmlunit
- xmlunit
-
-
- xom
- xom
-
-
-
-
- org.codehaus.groovy
- groovy
- 1.8.8
-
-
- org.apache.ant
- ant
-
-
- jline
- jline
-
-
- org.fusesource.jansi
- jansi
-
-
- provided
-
-
-
- net.sourceforge.nekohtml
- nekohtml
- 1.9.16
-
-
-
- xml-resolver
- xml-resolver
- 1.2
-
-
-
- oauth.signpost
- signpost-commonshttp4
- 1.2.1.1
- true
-
-
-
- oauth.signpost
- signpost-core
- 1.2.1.1
- true
-
-
- com.google.appengine
- appengine-api-1.0-sdk
- 1.3.8
- true
-
-
- xerces
- xercesImpl
- [2.6.2,)
- true
-
-
-
-
-
- log4j
- log4j
- 1.2.15
- test
-
-
- com.sun.jdmk
- jmxtools
-
-
- com.sun.jmx
- jmxri
-
-
- javax.jms
- jms
-
-
- javax.mail
- mail
-
-
-
-
- commons-io
- commons-io
- 1.4
- test
-
-
- junit
- junit
- 4.5
- test
-
-
-
-
-
-
- maven-compiler-plugin
- 3.1
-
-
- 1.5
-
-
-
- org.codehaus.gmaven
- gmaven-plugin
- 1.4
-
- 1.8
-
-
-
- build
-
- testCompile
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 2.17
-
-
-
- xml.catalog.verbosity
- 9
-
-
- xml.catalog.ignoreMissing
- false
-
-
- twitter.user
- ${twitter.user}
-
-
- twitter.oauth.consumerKey
- ${twitter.oauth.consumerKey}
-
-
- twitter.oauth.consumerSecret
- ${twitter.oauth.consumerSecret}
-
-
- twitter.oauth.accessToken
- ${twitter.oauth.accessToken}
-
-
- twitter.oauth.secretToken
- ${twitter.oauth.secretToken}
-
-
-
-
-
- org.codehaus.mojo
- cobertura-maven-plugin
- 2.6
-
-
- false
- 60
- 60
- 60
- 50
- 50
- 50
-
-
-
-
- defaults
-
- clean
- check
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-report-plugin
- 2.17
-
-
- package
-
- report
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 2.9.1
-
-
- package
-
- javadoc
-
-
-
-
-
- maven-assembly-plugin
- 2.4
-
-
- src/main/assembly/all.xml
-
-
-
-
- package
-
- attached
-
-
-
-
-
- org.apache.maven.plugins
- maven-site-plugin
- 3.3
-
-
-
- com.anasoft.os
- m2st-doxia-macros
- ${m2st.version}
-
-
- org.apache.maven.doxia
- doxia-sink-api
- 1.1.3
-
-
- org.apache.maven.doxia
- doxia-core
- 1.1.3
-
-
-
-
- org.apache.maven.plugins
- maven-release-plugin
- 2.5
-
- clean verify
-
-
-
- org.apache.maven.plugins
- maven-deploy-plugin
- 2.8.1
-
-
-
-
- org.apache.maven.wagon
- wagon-webdav-jackrabbit
- 1.0-beta-7
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-project-info-reports-plugin
- 2.2
-
-
- org.apache.maven.plugins
- maven-surefire-report-plugin
-
-
- org.codehaus.mojo
- cobertura-maven-plugin
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
-
- true
-
- http://java.sun.com/j2se/1.5.0/docs/api/
- http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/
- http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/
- http://groovy.codehaus.org/api/
- http://json-lib.sourceforge.net/apidocs/jdk15
- http://xml.apache.org/commons/components/apidocs/resolver
-
-
-
-
- org.apache.maven.plugins
- maven-jxr-plugin
-
- true
-
-
-
- org.apache.maven.plugins
- maven-changes-plugin
-
- 13625
- 5,6
- Key,Summary,Status,Resolution,Fix Version
- Fix Version DESC,Priority DESC,Created DESC
-
-
-
-
- jira-report
-
-
-
-
-
-
-
-
-
- m2st-releases
- http://anasoft-os-repo.googlecode.com/svn/repository/releases
- true
-
-
-
-
- scm:git:git@github.com:jgritman/httpbuilder.git
- http://github.com/jgritman/httpbuilder
- HEAD
-
-
-
-
- Groovy-Contrib
- Codehaus Groovy Repo
- dav:https://dav.codehaus.org/repository/gmod
-
-
- Groovy-Contrib
- Codehaus Groovy Snapshots Repo
- dav:https://dav.codehaus.org/snapshots.repository/gmod
-
-
- Groovy-Contrib
- Codehaus Groovy WebDAV
- dav:https://dav.codehaus.org/groovy/modules/http-builder
-
-
-
-
-
- Groovy-User
- user@groovy.codehaus.org
- http://xircles.codehaus.org/manage_email/user@groovy.codehaus.org
- http://www.nabble.com/groovy---user-f11867.html
-
-
-
-
- JIRA
- http://jira.codehaus.org/browse/GMOD
-
-
-
-
- The Apache Software License, Version 2.0
- http://www.apache.org/licenses/LICENSE-2.0.txt
- repo
-
-
-
-
-
- Tom Nichols
- tomstrummer
- tomstrummer+httpbuilder@gmail.com
- -5
-
- Developer
-
-
-
-
-
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..2295131
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'http-builder'
\ No newline at end of file
diff --git a/src/main/java/groovyx/net/http/EncoderRegistry.java b/src/main/java/groovyx/net/http/EncoderRegistry.java
index 6312c4e..3467cd4 100644
--- a/src/main/java/groovyx/net/http/EncoderRegistry.java
+++ b/src/main/java/groovyx/net/http/EncoderRegistry.java
@@ -56,7 +56,7 @@
import org.apache.http.entity.InputStreamEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.message.BasicNameValuePair;
-import org.codehaus.groovy.runtime.DefaultGroovyMethods;
+import org.codehaus.groovy.runtime.IOGroovyMethods;
import org.codehaus.groovy.runtime.MethodClosure;
@@ -186,7 +186,7 @@ else if ( data instanceof Reader && ! (data instanceof BufferedReader) )
data = new BufferedReader( (Reader)data );
if ( data instanceof BufferedReader ) {
StringWriter out = new StringWriter();
- DefaultGroovyMethods.leftShift( out, (BufferedReader)data );
+ IOGroovyMethods.leftShift( out, (BufferedReader)data );
data = out;
}
diff --git a/src/main/java/groovyx/net/http/HTTPBuilder.java b/src/main/java/groovyx/net/http/HTTPBuilder.java
index 0f9ec9e..5202389 100644
--- a/src/main/java/groovyx/net/http/HTTPBuilder.java
+++ b/src/main/java/groovyx/net/http/HTTPBuilder.java
@@ -69,7 +69,7 @@
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HttpContext;
-import org.codehaus.groovy.runtime.DefaultGroovyMethods;
+import org.codehaus.groovy.runtime.IOGroovyMethods;
import org.codehaus.groovy.runtime.MethodClosure;
/**
@@ -617,12 +617,12 @@ protected Object defaultSuccessHandler( HttpResponseDecorator resp, Object parse
//If response is streaming, buffer it in a byte array:
if ( parsedData instanceof InputStream ) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- DefaultGroovyMethods.leftShift( buffer, (InputStream)parsedData );
+ IOGroovyMethods.leftShift( buffer, (InputStream)parsedData );
parsedData = new ByteArrayInputStream( buffer.toByteArray() );
}
else if ( parsedData instanceof Reader ) {
StringWriter buffer = new StringWriter();
- DefaultGroovyMethods.leftShift( buffer, (Reader)parsedData );
+ IOGroovyMethods.leftShift( buffer, (Reader)parsedData );
parsedData = new StringReader( buffer.toString() );
}
else if ( parsedData instanceof Closeable )
@@ -914,19 +914,19 @@ public void setProxy( String host, int port, String scheme ) {
ConnRoutePNames.DEFAULT_PROXY,
new HttpHost(host,port,scheme) );
}
-
+
/**
- * Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority
- * and the hostname does not need to be verified.
- * This is primarily for dev situations that make use of localhost, build, and test servers.
- *
- * @throws KeyStoreException
- * @throws NoSuchAlgorithmException
- * @throws UnrecoverableKeyException
- * @throws KeyManagementException
- *
+ * Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority
+ * and the hostname does not need to be verified.
+ * This is primarily for dev situations that make use of localhost, build, and test servers.
+ *
+ * @throws KeyStoreException
+ * @throws NoSuchAlgorithmException
+ * @throws UnrecoverableKeyException
+ * @throws KeyManagementException
+ *
*/
- public void ignoreSSLIssues()
+ public void ignoreSSLIssues()
throws KeyManagementException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException{
TrustStrategy trustStrat = new TrustStrategy(){
public boolean isTrusted(X509Certificate[] chain, String authtype)
@@ -934,9 +934,9 @@ public boolean isTrusted(X509Certificate[] chain, String authtype)
return true;
}
};
-
- SSLSocketFactory sslSocketFactory = new SSLSocketFactory(trustStrat,SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
-
+
+ SSLSocketFactory sslSocketFactory = new SSLSocketFactory(trustStrat,SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+
getClient().getConnectionManager().getSchemeRegistry().register(
new Scheme("https",443,sslSocketFactory ) );
diff --git a/src/main/java/groovyx/net/http/HttpURLClient.java b/src/main/java/groovyx/net/http/HttpURLClient.java
index 2f52600..7f00e9a 100644
--- a/src/main/java/groovyx/net/http/HttpURLClient.java
+++ b/src/main/java/groovyx/net/http/HttpURLClient.java
@@ -59,7 +59,7 @@
import org.apache.http.message.BasicHeaderIterator;
import org.apache.http.message.BasicStatusLine;
import org.apache.http.params.HttpParams;
-import org.codehaus.groovy.runtime.DefaultGroovyMethods;
+import org.codehaus.groovy.runtime.IOGroovyMethods;
import org.codehaus.groovy.runtime.EncodingGroovyMethods;
/**
@@ -214,7 +214,7 @@ public HttpResponseDecorator request( Map args )
// OAuth Sign if necessary.
if ( oauth != null ) conn = oauth.sign( conn, body );
// send request data
- DefaultGroovyMethods.leftShift( conn.getOutputStream(),
+ IOGroovyMethods.leftShift( conn.getOutputStream(),
body.getContent() );
}
finally { conn.getOutputStream().close(); }
@@ -259,12 +259,12 @@ private Object getparsedResult( String method, Object contentType, HttpResponse
//If response is streaming, buffer it in a byte array:
if ( parsedData instanceof InputStream ) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- DefaultGroovyMethods.leftShift( buffer, (InputStream)parsedData );
+ IOGroovyMethods.leftShift( buffer, (InputStream)parsedData );
parsedData = new ByteArrayInputStream( buffer.toByteArray() );
}
else if ( parsedData instanceof Reader ) {
StringWriter buffer = new StringWriter();
- DefaultGroovyMethods.leftShift( buffer, (Reader)parsedData );
+ IOGroovyMethods.leftShift( buffer, (Reader)parsedData );
parsedData = new StringReader( buffer.toString() );
}
else if ( parsedData instanceof Closeable )
@@ -439,7 +439,7 @@ public boolean isStreaming() {
}
public void writeTo( OutputStream out ) throws IOException {
- DefaultGroovyMethods.leftShift( out, conn.getInputStream() );
+ IOGroovyMethods.leftShift( out, conn.getInputStream() );
}
};
diff --git a/src/test/groovy/groovyx/net/http/RegistryTest.groovy b/src/test/groovy/groovyx/net/http/RegistryTest.groovy
index 24574ac..a1bcf49 100644
--- a/src/test/groovy/groovyx/net/http/RegistryTest.groovy
+++ b/src/test/groovy/groovyx/net/http/RegistryTest.groovy
@@ -1,192 +1,195 @@
-package groovyx.net.http
-
-import org.apache.http.ProtocolVersion
-import org.apache.http.entity.StringEntity
-import org.apache.http.message.BasicHttpResponse
-import org.junit.Test
import java.io.StringReader
import java.io.ByteArrayInputStream
-import static groovyx.net.http.ContentType.*
-/**
- * @author tnichols
- */
-public class RegistryTest {
-
- @Test public void testParserRegistry() {
- def reg = new ParserRegistry();
-
- assert reg.defaultParser
- reg.each { assert it.key && it.value }
-
- assert reg."text/plain"
- assert reg["text/plain"]
-
- def newParser = {}
- reg."application/json" = newParser
- assert reg['application/json'].is( newParser )
-
- reg[ ContentType.JSON ] = newParser
- assert reg[ "application/javascript" ].is( newParser )
-
- reg.defaultParser = newParser
- assert newParser.is( reg.defaultParser )
- }
-
- @Test public void testEncoderAccessors() {
- def reg = new EncoderRegistry();
-
- reg.each { assert it.key && it.value }
-
- assert reg."text/plain"
- assert reg["text/plain"]
-
- def newEnc = {}
- reg."application/json" = newEnc
- reg['application/xml'] = newEnc
- assert reg['application/json'].is( newEnc )
- assert reg."application/xml".is( newEnc )
- }
-
- @Test public void testXMLEncoder() {
- def reg = new EncoderRegistry();
-
- def entity = reg.encodeXML( {
- xml( AAA: 'aaa' ) {
- one 'one'
- two 'two'
- }
- }, 'text/xml' )
-
- assert entity.contentType.value == "text/xml"
-// println entity.content.text
- assert entity.content.text == "onetwo"
-
- entity = reg.encodeXML( 'onetwo',null )
- assert entity.content.text == 'onetwo'
- def value = 'something'
- entity = reg.encodeXML( "$valuetwo",null )
- assert entity.content.text == "somethingtwo"
- }
-
- @Test public void testCharsetAndText() {
- def reg = new EncoderRegistry( charset: "ISO-8859-1" );
-
- def entity = reg.encodeText( { out ->
- out << "This is a test"
- }, null )
-
- assert entity.contentType.value == 'text/plain'
- assert entity.content.getText('ISO-8859-1') == "This is a test"
- assert entity.content.getText('utf-16') != "This is a test"
-
- def w = { it << "this is a test 1" } as Writable
- entity = reg.encodeText( w, 'text/plain' )
- assert entity.content.getText('ISO-8859-1') == "this is a test 1"
-
- entity = reg.encodeText( "This is a test 2", 'text/notplain' )
- assert entity.contentType.value == 'text/notplain'
- assert entity.content.getText('ISO-8859-1') == "This is a test 2"
-
- entity = reg.encodeText( new StringReader( "This is a test 3\nMore text"), 'text/plain' )
- assert entity.contentType.value == 'text/plain'
- assert entity.content.getText('ISO-8859-1') == "This is a test 3\nMore text"
- }
-
- @Test public void testStream() {
- def reg = new EncoderRegistry();
-
- def data = [ 0x0, 0x1, 0x2 ] as byte[]
-
- def entity = reg.encodeStream( { out -> // closure
- out << data
- }, null )
-
- assert entity.contentType.value == 'application/octet-stream'
- assert entity.contentLength == data.length
- def result = new ByteArrayOutputStream()
- result << entity.content
- assert result.toByteArray() == data
-
- entity = reg.encodeStream( new ByteArrayInputStream(data), 'application/x-gzip' )
- assert entity.contentLength == data.length
- assert entity.contentType.value == 'application/x-gzip'
- result = new ByteArrayOutputStream()
- result << entity.content
- assert result.toByteArray() == data
-
- entity = reg.encodeStream( data, null ) // byte[]
- assert entity.contentLength == data.length
- result = new ByteArrayOutputStream()
- result << entity.content
- assert result.toByteArray() == data
-
- entity = reg.encodeStream( result, null ) // ByteArrayOutputStream
- assert entity.contentLength == data.length
- result = new ByteArrayOutputStream()
- result << entity.content
- assert result.toByteArray() == data
- }
-
- @Test public void testJSONEncoder() {
- def reg = new EncoderRegistry();
-
- def entity = reg.encodeJSON( [
- first : [ one:1, two:"2" ],
- second : 'some string'
- ], null )
-
- assert entity.contentType.value == "application/json"
-// println entity.content.text
- assert entity.content.text == '{"first":{"one":1,"two":"2"},"second":"some string"}'
-
- entity = reg.encodeJSON( ["first", "second", 3, [map:4] ], 'text/javascript' )
- assert entity.contentType.value == "text/javascript"
- assert entity.content.text == '["first","second",3,{"map":4}]'
-
- entity = reg.encodeJSON( {
- root {
- first {
- one = 1
- two = '2'
- }
- second = 'some string'
- }
- }, null )
-
-// println entity.content.text
- assert entity.content.text == '{"root":{"first":{"one":1,"two":"2"},"second":"some string"}}'
-
- entity = reg.encodeJSON( '["first","second",3,{"map":4}]',null )
- assert entity.content.text == '["first","second",3,{"map":4}]'
- def another = 'second'
- entity = reg.encodeJSON( "['first','$another',3,{'map':4}]",null )
- assert entity.content.text == "['first','second',3,{'map':4}]"
- }
-
- @Test public void testFormEncoder() {
- def enc = new EncoderRegistry()
-
- def param1 = "p1"
- def entity = enc.encodeForm( ["${param1}":'one', p2:['two','three']] )
-
- assert entity.contentType.elements[0].name == 'application/x-www-form-urlencoded'
- assert entity.content.text == "p1=one&p2=two&p2=three"
-
- entity = enc.encodeForm( "p1=goober&p2=something+else",null )
- assert entity.contentType.value == 'application/x-www-form-urlencoded'
- assert entity.content.text == "p1=goober&p2=something+else"
- }
-
- @Test public void testFormParser() {
- def parser = new ParserRegistry()
-
- def entity = new StringEntity( "p1=goober&p2=something+else", "utf-8" )
- // GMOD-137: URLENC parsing doesn't work w/ bad content-type
- entity.setContentType "text/plain" // NOT application/x-www-form-urlencoded
-
- def response = new BasicHttpResponse( new ProtocolVersion( "HTTP", 1, 1 ), 200, "OK" )
- response.entity = entity
- def map = parser.parseForm( response )
- assert map
- assert map.p1 == 'goober'
- assert map.p2 == 'something else'
- }
-}
+package groovyx.net.http
+
+import org.apache.http.ProtocolVersion
+import org.apache.http.entity.StringEntity
+import org.apache.http.message.BasicHttpResponse
+import org.junit.Test
+import java.io.StringReader
+import java.io.ByteArrayInputStream
+import static groovyx.net.http.ContentType.*
+
+/**
+ * @author tnichols
+ */
+public class RegistryTest {
+
+ @Test public void testParserRegistry() {
+ def reg = new ParserRegistry();
+
+ assert reg.defaultParser
+ reg.each { assert it.key && it.value }
+
+ assert reg."text/plain"
+ assert reg["text/plain"]
+
+ def newParser = {}
+ reg."application/json" = newParser
+ assert reg['application/json'].is( newParser )
+
+ reg[ ContentType.JSON ] = newParser
+ assert reg[ "application/javascript" ].is( newParser )
+
+ reg.defaultParser = newParser
+ assert newParser.is( reg.defaultParser )
+ }
+
+ @Test public void testEncoderAccessors() {
+ def reg = new EncoderRegistry();
+
+ reg.each { assert it.key && it.value }
+
+ assert reg."text/plain"
+ assert reg["text/plain"]
+
+ def newEnc = {}
+ reg."application/json" = newEnc
+ reg['application/xml'] = newEnc
+ assert reg['application/json'].is( newEnc )
+ assert reg."application/xml".is( newEnc )
+ }
+
+ @Test public void testXMLEncoder() {
+ def reg = new EncoderRegistry();
+
+ def entity = reg.encodeXML( {
+ xml( AAA: 'aaa' ) {
+ one 'one'
+ two 'two'
+ }
+ }, 'text/xml' )
+
+ assert entity.contentType.value == "text/xml"
+// println entity.content.text
+ assert entity.content.text == "onetwo"
+
+ entity = reg.encodeXML( 'onetwo',null )
+ assert entity.content.text == 'onetwo'
+ def value = 'something'
+ entity = reg.encodeXML( "$valuetwo",null )
+ assert entity.content.text == "somethingtwo"
+ }
+
+ @Test public void testCharsetAndText() {
+ def reg = new EncoderRegistry( charset: "ISO-8859-1" );
+
+ def entity = reg.encodeText( { out ->
+ out << "This is a test"
+ }, null )
+
+ assert entity.contentType.value == 'text/plain'
+ assert entity.content.getText('ISO-8859-1') == "This is a test"
+ assert entity.content.getText('utf-16') != "This is a test"
+
+ def w = { it << "this is a test 1" } as Writable
+ entity = reg.encodeText( w, 'text/plain' )
+ assert entity.content.getText('ISO-8859-1') == "this is a test 1"
+
+ entity = reg.encodeText( "This is a test 2", 'text/notplain' )
+ assert entity.contentType.value == 'text/notplain'
+ assert entity.content.getText('ISO-8859-1') == "This is a test 2"
+
+ entity = reg.encodeText( new StringReader( "This is a test 3\nMore text"), 'text/plain' )
+ assert entity.contentType.value == 'text/plain'
+ assert entity.content.getText('ISO-8859-1') == "This is a test 3\nMore text"
+ }
+
+ @Test public void testStream() {
+ def reg = new EncoderRegistry();
+
+ def data = [ 0x0, 0x1, 0x2 ] as byte[]
+
+ def entity = reg.encodeStream( { out -> // closure
+ out << data
+ }, null )
+
+ assert entity.contentType.value == 'application/octet-stream'
+ assert entity.contentLength == data.length
+ def result = new ByteArrayOutputStream()
+ result << entity.content
+ assert result.toByteArray() == data
+
+ entity = reg.encodeStream( new ByteArrayInputStream(data), 'application/x-gzip' )
+ assert entity.contentLength == data.length
+ assert entity.contentType.value == 'application/x-gzip'
+ result = new ByteArrayOutputStream()
+ result << entity.content
+ assert result.toByteArray() == data
+
+ entity = reg.encodeStream( data, null ) // byte[]
+ assert entity.contentLength == data.length
+ result = new ByteArrayOutputStream()
+ result << entity.content
+ assert result.toByteArray() == data
+
+ entity = reg.encodeStream( result, null ) // ByteArrayOutputStream
+ assert entity.contentLength == data.length
+ result = new ByteArrayOutputStream()
+ result << entity.content
+ assert result.toByteArray() == data
+ }
+
+ @Test public void testJSONEncoder() {
+ def reg = new EncoderRegistry();
+
+ def entity = reg.encodeJSON( [
+ first : [ one:1, two:"2" ],
+ second : 'some string'
+ ], null )
+
+ assert entity.contentType.value == "application/json"
+// println entity.content.text
+ assert entity.content.text == '{"first":{"one":1,"two":"2"},"second":"some string"}'
+
+ entity = reg.encodeJSON( ["first", "second", 3, [map:4] ], 'text/javascript' )
+ assert entity.contentType.value == "text/javascript"
+ assert entity.content.text == '["first","second",3,{"map":4}]'
+
+ entity = reg.encodeJSON( {
+ root {
+ first {
+ one = 1
+ two = '2'
+ }
+ second = 'some string'
+ }
+ }, null )
+
+// println entity.content.text
+ assert entity.content.text == '{"root":{"first":{"one":1,"two":"2"},"second":"some string"}}'
+
+ entity = reg.encodeJSON( '["first","second",3,{"map":4}]',null )
+ assert entity.content.text == '["first","second",3,{"map":4}]'
+ def another = 'second'
+ entity = reg.encodeJSON( "['first','$another',3,{'map':4}]",null )
+ assert entity.content.text == "['first','second',3,{'map':4}]"
+ }
+
+ @Test public void testFormEncoder() {
+ def enc = new EncoderRegistry()
+
+ def param1 = "p1"
+ def entity = enc.encodeForm( ["${param1}":'one', p2:['two','three']] )
+
+ assert entity.contentType.elements[0].name == 'application/x-www-form-urlencoded'
+ assert entity.content.text == "p1=one&p2=two&p2=three"
+
+ entity = enc.encodeForm( "p1=goober&p2=something+else",null )
+ assert entity.contentType.value == 'application/x-www-form-urlencoded'
+ assert entity.content.text == "p1=goober&p2=something+else"
+ }
+
+ @Test public void testFormParser() {
+ def parser = new ParserRegistry()
+
+ def entity = new StringEntity( "p1=goober&p2=something+else", "utf-8" )
+ // GMOD-137: URLENC parsing doesn't work w/ bad content-type
+ entity.setContentType "text/plain" // NOT application/x-www-form-urlencoded
+
+ def response = new BasicHttpResponse( new ProtocolVersion( "HTTP", 1, 1 ), 200, "OK" )
+ response.entity = entity
+ def map = parser.parseForm( response )
+ assert map
+ assert map.p1 == 'goober'
+ assert map.p2 == 'something else'
+ }
+}
diff --git a/src/test/groovy/groovyx/net/http/thirdparty/GAETest.groovy b/src/test/groovy/groovyx/net/http/thirdparty/GAETest.groovy
index b3a5a9f..3611ab6 100644
--- a/src/test/groovy/groovyx/net/http/thirdparty/GAETest.groovy
+++ b/src/test/groovy/groovyx/net/http/thirdparty/GAETest.groovy
@@ -353,7 +353,7 @@ class GAETest {
def newBuilder( uri ) {
return new groovyx.net.http.HTTPBuilder(uri) {
- @Override protected AbstractHttpClient getClient(HttpParams params) {
+ @Override protected AbstractHttpClient createClient(HttpParams params) {
return new DefaultHttpClient( new GAEConnectionManager(), params)
}
}