You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2017/04/13 20:37:46 UTC

[1/7] incubator-juneau git commit: Support for 3rd-party proxy interfaces.

Repository: incubator-juneau
Updated Branches:
  refs/heads/master 7f0e6812b -> 7139635d3


http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest/src/main/java/org/apache/juneau/rest/labels/ResourceDescription.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/labels/ResourceDescription.java b/juneau-rest/src/main/java/org/apache/juneau/rest/labels/ResourceDescription.java
index bbdf8cf..3f642e4 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/labels/ResourceDescription.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/labels/ResourceDescription.java
@@ -12,6 +12,8 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.rest.labels;
 
+import static org.apache.juneau.internal.StringUtils.*;
+
 import org.apache.juneau.dto.*;
 import org.apache.juneau.rest.*;
 
@@ -40,7 +42,7 @@ public final class ResourceDescription extends NameDescription implements Compar
 	 * @param description The description of the child resource.
 	 */
 	public ResourceDescription(String rootUrl, String name, String description) {
-		super(new Link(name, (rootUrl.equals("/") || rootUrl.isEmpty() ? "/" : rootUrl + "/") + RestUtils.encode(name)), description);
+		super(new Link(name, (rootUrl.equals("/") || rootUrl.isEmpty() ? "/" : rootUrl + "/") + urlEncode(name)), description);
 	}
 
 	/**
@@ -55,7 +57,7 @@ public final class ResourceDescription extends NameDescription implements Compar
 	}
 
 	private static String calcName(String childPath) {
-		return RestUtils.decode(childPath.indexOf('/') == -1 ? childPath : childPath.substring(childPath.lastIndexOf('/')+1));
+		return urlDecode(childPath.indexOf('/') == -1 ? childPath : childPath.substring(childPath.lastIndexOf('/')+1));
 	}
 
 	private static String calcHref(RestRequest req, String childPath) {

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest/src/main/java/org/apache/juneau/rest/labels/ResourceLink.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/labels/ResourceLink.java b/juneau-rest/src/main/java/org/apache/juneau/rest/labels/ResourceLink.java
index 2325fdd..68dd7aa 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/labels/ResourceLink.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/labels/ResourceLink.java
@@ -12,6 +12,8 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.rest.labels;
 
+import static org.apache.juneau.internal.StringUtils.*;
+
 import java.text.*;
 
 import org.apache.juneau.dto.*;
@@ -51,7 +53,7 @@ public class ResourceLink extends Link {
 			s = childPath;
 		else
 			s = childPath.substring(childPath.lastIndexOf('/')+1);
-		return RestUtils.decode(s);
+		return urlDecode(s);
 	}
 
 	private static String getHref(RestRequest req, String childPath) {

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest/src/main/java/org/apache/juneau/rest/package.html
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/package.html b/juneau-rest/src/main/java/org/apache/juneau/rest/package.html
index f6f9cb4..bfc3aa3 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/package.html
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/package.html
@@ -2062,7 +2062,7 @@
 			<tr>
 				<td><ck>$UE{...}</ck></td>
 				<td>URL-Encode the specified value.
-					<br>Takes the contents inside the varible and replaces it with the value returned by calling {@link org.apache.juneau.rest.RestUtils#encode(String)}.
+					<br>Takes the contents inside the varible and replaces it with a URL-encoded string.
 				</td>
 			</tr>
 		</table>

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServiceProperties.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServiceProperties.java b/juneau-rest/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServiceProperties.java
index 45104f6..b37a785 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServiceProperties.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServiceProperties.java
@@ -12,7 +12,7 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.rest.remoteable;
 
-import org.apache.juneau.annotation.*;
+import org.apache.juneau.remoteable.*;
 import org.apache.juneau.rest.*;
 import org.apache.juneau.rest.annotation.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest/src/main/java/org/apache/juneau/rest/remoteable/package.html
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/remoteable/package.html b/juneau-rest/src/main/java/org/apache/juneau/rest/remoteable/package.html
index 239ae95..661ab91 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/remoteable/package.html
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/remoteable/package.html
@@ -78,8 +78,6 @@
 	</p>
 	<p>
 		Proxy interfaces are retrieved using the {@link org.apache.juneau.rest.client.RestClient#getRemoteableProxy(Class)} method.
-		The {@link org.apache.juneau.rest.client.RestClientBuilder#remoteableServletUri(String)} method is used to specify the location
-			of the remoteable services servlet running on the server.
 		The remoteable servlet is a specialized subclass of {@link org.apache.juneau.rest.RestServlet} that provides a full-blown
 			REST interface for calling remoteable services (e.g. POJOs) remotely. 
 	</p>
@@ -100,7 +98,7 @@
 	<p class='bcode'>
 	<jc>// Create a RestClient using JSON for serialization, and point to the server-side remoteable servlet.</jc>
 	RestClient client = <jk>new</jk> RestClientBuilder()
-		.remoteableServletUri(<js>"https://localhost:9080/juneau/sample/remoteable"</js>)
+		.rootUrl(<js>"https://localhost:9080/juneau/sample/remoteable"</js>)
 		.build();
 	
 	<jc>// Create a proxy interface.</jc>
@@ -313,7 +311,7 @@
 <div class='topic'>
 	<p>
 		What if you want fine-tuned control over which methods are exposed in an interface instead of just all public methods?
-		For this, the {@link org.apache.juneau.annotation.Remoteable @Remoteable} annotation is provided.
+		For this, the {@link org.apache.juneau.remoteable.Remoteable @Remoteable} annotation is provided.
 		It can be applied to individual interface methods to only expose those methods through the remoteable servlet.
 	</p>
 	<p>

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest/src/main/java/org/apache/juneau/rest/vars/UrlEncodeVar.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/UrlEncodeVar.java b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/UrlEncodeVar.java
index cc7f4c8..6fa7f5f 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/UrlEncodeVar.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/UrlEncodeVar.java
@@ -12,7 +12,9 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.rest.vars;
 
-import org.apache.juneau.rest.*;
+import static org.apache.juneau.internal.StringUtils.*;
+
+import org.apache.juneau.internal.*;
 import org.apache.juneau.svl.*;
 
 /**
@@ -20,7 +22,7 @@ import org.apache.juneau.svl.*;
  * <p>
  * The format for this var is <js>"$UE{innerValue}"</js>.
  * <p>
- * This variable takes the contents inside the variable and replaces it with a value returned by calling {@link RestUtils#encode(String)}).
+ * This variable takes the contents inside the variable and replaces it with a value returned by calling {@link StringUtils#urlEncode(String)}).
  * <p>
  * Since this is a {@link SimpleVar}, any variables contained in the result will be recursively resolved.
  * Likewise, if the arguments contain any variables, those will be resolved before they are passed to this var.
@@ -41,6 +43,6 @@ public class UrlEncodeVar extends SimpleVar {
 
 	@Override /* Parameter */
 	public String resolve(VarResolverSession session, String key) {
-		return RestUtils.encode(key);
+		return urlEncode(key);
 	}
 }
\ No newline at end of file


[7/7] incubator-juneau git commit: Support for 3rd-party proxy interfaces.

Posted by ja...@apache.org.
Support for 3rd-party proxy interfaces.

Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau/commit/7139635d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau/tree/7139635d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau/diff/7139635d

Branch: refs/heads/master
Commit: 7139635d3cc0c2304f83bed070c62f301c0a7b1c
Parents: 7f0e681
Author: JamesBognar <ja...@apache.org>
Authored: Thu Apr 13 16:37:39 2017 -0400
Committer: JamesBognar <ja...@apache.org>
Committed: Thu Apr 13 16:37:39 2017 -0400

----------------------------------------------------------------------
 .../urlencoding/UrlEncodingParserTest.java      |  112 +-
 .../urlencoding/UrlEncodingSerializerTest.java  |   47 +-
 .../main/java/org/apache/juneau/ClassMeta.java  |   44 +-
 .../apache/juneau/annotation/Remoteable.java    |   27 -
 .../main/java/org/apache/juneau/dto/Link.java   |    2 +-
 .../org/apache/juneau/internal/StringUtils.java |  123 ++
 .../java/org/apache/juneau/parser/Parser.java   |    2 +
 .../java/org/apache/juneau/remoteable/Body.java |   49 +
 .../org/apache/juneau/remoteable/FormData.java  |   60 +
 .../apache/juneau/remoteable/FormDataIfNE.java  |   34 +
 .../org/apache/juneau/remoteable/Header.java    |   56 +
 .../apache/juneau/remoteable/HeaderIfNE.java    |   34 +
 .../org/apache/juneau/remoteable/Query.java     |   60 +
 .../org/apache/juneau/remoteable/QueryIfNE.java |   34 +
 .../apache/juneau/remoteable/RemoteMethod.java  |   63 +
 .../juneau/remoteable/RemoteMethodArg.java      |   41 +
 .../apache/juneau/remoteable/Remoteable.java    |   65 +
 .../juneau/remoteable/RemoteableMeta.java       |   67 +
 .../remoteable/RemoteableMetadataException.java |   56 +
 .../juneau/remoteable/RemoteableMethodMeta.java |  177 ++
 .../org/apache/juneau/remoteable/package.html   |   72 +
 .../org/apache/juneau/uon/UonSerializer.java    |   23 +-
 .../apache/juneau/uon/UonSerializerSession.java |    7 +-
 .../java/org/apache/juneau/uon/UonUtils.java    |   52 +
 .../java/org/apache/juneau/uon/UonWriter.java   |   30 +-
 .../juneau/urlencoding/UrlEncodingParser.java   |   46 +-
 .../urlencoding/UrlEncodingSerializer.java      |   43 +-
 .../UrlEncodingSerializerBuilder.java           |   42 +
 .../UrlEncodingSerializerContext.java           |   32 +-
 .../UrlEncodingSerializerSession.java           |   17 +-
 .../java/org/apache/juneau/utils/AList.java     |   11 +
 .../main/java/org/apache/juneau/utils/ASet.java |   11 +
 juneau-core/src/main/javadoc/overview.html      |  321 +++-
 .../examples/addressbook/IAddressBook.java      |    3 +
 .../SampleRemoteableServicesResourceTest.java   |   21 +-
 .../org/apache/juneau/microservice/package.html |    2 +-
 .../juneau/rest/client/NameValuePairs.java      |   42 +-
 .../org/apache/juneau/rest/client/RestCall.java |  285 ++-
 .../apache/juneau/rest/client/RestClient.java   |  148 +-
 .../juneau/rest/client/RestClientBuilder.java   |   40 +-
 .../juneau/rest/client/RestRequestEntity.java   |    2 +
 .../org/apache/juneau/rest/client/RetryOn.java  |   24 +-
 .../rest/client/SerializedNameValuePair.java    |   31 +-
 .../org/apache/juneau/rest/client/package.html  |    4 +-
 .../juneau/rest/test/FormDataResource.java      |   37 +
 .../apache/juneau/rest/test/InterfaceProxy.java |  108 +-
 .../rest/test/InterfaceProxyResource.java       |  221 ++-
 .../java/org/apache/juneau/rest/test/Root.java  |    2 +
 .../org/apache/juneau/rest/test/TestUtils.java  |   79 +
 .../rest/test/ThirdPartyProxyResource.java      | 1218 +++++++++++++
 .../apache/juneau/rest/test/pojos/ABean.java    |   24 +
 .../juneau/rest/test/pojos/Constants.java       |   25 +
 .../rest/test/pojos/ImplicitSwappedPojo.java    |   35 +
 .../juneau/rest/test/pojos/SwappedPojo.java     |   20 +
 .../juneau/rest/test/pojos/SwappedPojoSwap.java |   35 +
 .../apache/juneau/rest/test/pojos/TestEnum.java |   17 +
 .../juneau/rest/test/pojos/TypedBean.java       |   17 +
 .../juneau/rest/test/pojos/TypedBeanImpl.java   |   25 +
 .../org/apache/juneau/rest/test/ConfigTest.java |    4 +-
 .../apache/juneau/rest/test/ContentTest.java    |   10 +-
 .../apache/juneau/rest/test/FormDataTest.java   |  100 ++
 .../juneau/rest/test/InterfaceProxyTest.java    |  548 +++---
 .../apache/juneau/rest/test/RestTestcase.java   |   38 +-
 .../apache/juneau/rest/test/RestUtilsTest.java  |   63 +-
 .../org/apache/juneau/rest/test/TestUtils.java  |   79 -
 .../juneau/rest/test/ThirdPartyProxyTest.java   | 1627 ++++++++++++++++++
 .../org/apache/juneau/rest/test/_TestSuite.java |    2 +
 .../java/org/apache/juneau/rest/Redirect.java   |    4 +-
 .../org/apache/juneau/rest/RestCallHandler.java |   10 +-
 .../org/apache/juneau/rest/RestContext.java     |   39 +-
 .../org/apache/juneau/rest/RestException.java   |   19 +
 .../org/apache/juneau/rest/RestRequest.java     |   87 +-
 .../org/apache/juneau/rest/RestResponse.java    |    3 +-
 .../org/apache/juneau/rest/RestServlet.java     |    7 +-
 .../java/org/apache/juneau/rest/RestUtils.java  |   91 -
 .../org/apache/juneau/rest/UrlPathPattern.java  |    7 +-
 .../juneau/rest/annotation/RestMethod.java      |    2 +-
 .../juneau/rest/labels/ResourceDescription.java |    6 +-
 .../apache/juneau/rest/labels/ResourceLink.java |    4 +-
 .../java/org/apache/juneau/rest/package.html    |    2 +-
 .../remoteable/RemoteableServiceProperties.java |    2 +-
 .../apache/juneau/rest/remoteable/package.html  |    6 +-
 .../apache/juneau/rest/vars/UrlEncodeVar.java   |    8 +-
 83 files changed, 5984 insertions(+), 1109 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/UrlEncodingParserTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/UrlEncodingParserTest.java b/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/UrlEncodingParserTest.java
index 3fd318e..d23eca3 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/UrlEncodingParserTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/UrlEncodingParserTest.java
@@ -48,13 +48,13 @@ public class UrlEncodingParserTest {
 		assertEquals("a", p.parse(t, String.class));
 
 		t = "a";
-		assertEquals("a", p.parseParameter(t, Object.class));
-		assertEquals("a", p.parseParameter(t, String.class));
+		assertEquals("a", p.parsePart(t, Object.class));
+		assertEquals("a", p.parsePart(t, String.class));
 		t = "'a'";
-		assertEquals("a", p.parseParameter(t, String.class));
-		assertEquals("a", p.parseParameter(t, Object.class));
+		assertEquals("a", p.parsePart(t, String.class));
+		assertEquals("a", p.parsePart(t, Object.class));
 		t = " 'a' ";
-		assertEquals("a", p.parseParameter(t, String.class));
+		assertEquals("a", p.parsePart(t, String.class));
 
 		// 2nd level
 		t = "?a=a";
@@ -74,7 +74,7 @@ public class UrlEncodingParserTest {
 		assertNull(m.get("f"));
 
 		t = "(a=b,c=123,d=false,e=true,f=%00)";
-		m = p.parseParameter(t, Map.class);
+		m = p.parsePart(t, Map.class);
 		assertEquals("b", m.get("a"));
 		assertTrue(m.get("c") instanceof Number);
 		assertEquals(123, m.get("c"));
@@ -85,7 +85,7 @@ public class UrlEncodingParserTest {
 		assertEquals("%00", m.get("f"));
 
 		t = "(a=b,c=123,d=false,e=true,f=null)";
-		m = p.parseParameter(t, Map.class);
+		m = p.parsePart(t, Map.class);
 		assertTrue(m.containsKey("f"));
 		assertNull(m.get("f"));
 
@@ -99,7 +99,7 @@ public class UrlEncodingParserTest {
 		t = "_value=null";
 		assertNull(p.parse(t, Object.class));
 		t = "null";
-		assertNull(p.parseParameter(t, Object.class));
+		assertNull(p.parsePart(t, Object.class));
 
 		// 2nd level
 		t = "?null=null";
@@ -121,10 +121,10 @@ public class UrlEncodingParserTest {
 		// Empty array
 		// Top level
 		t = "@()";
-		l = (List)p.parseParameter(t, Object.class);
+		l = (List)p.parsePart(t, Object.class);
 		assertTrue(l.isEmpty());
 		t = " @( ) ";
-		l = p.parseParameter(t, List.class);
+		l = p.parsePart(t, List.class);
 		assertTrue(l.isEmpty());
 
 		// 2nd level in map
@@ -152,12 +152,12 @@ public class UrlEncodingParserTest {
 		l = (List)l.get(0);
 		assertTrue(l.isEmpty());
 		t = "@(@())";
-		l = (List)p.parseParameter(t, Object.class);
+		l = (List)p.parsePart(t, Object.class);
 		assertTrue(l.size() == 1);
 		l = (List)l.get(0);
 		assertTrue(l.isEmpty());
 		t = "@(@())";
-		l = (List)p.parseParameter(t, LinkedList.class, List.class);
+		l = (List)p.parsePart(t, LinkedList.class, List.class);
 		assertTrue(l.size() == 1);
 		l = (List)l.get(0);
 		assertTrue(l.isEmpty());
@@ -173,11 +173,11 @@ public class UrlEncodingParserTest {
 		assertTrue(l.size() == 1);
 		assertEquals("", l.get(0));
 		t = "@('')";
-		l = (List)p.parseParameter(t, Object.class);
+		l = (List)p.parsePart(t, Object.class);
 		assertTrue(l.size() == 1);
 		assertEquals("", l.get(0));
 		t = "@('')";
-		l = (List)p.parseParameter(t, List.class, String.class);
+		l = (List)p.parsePart(t, List.class, String.class);
 		assertTrue(l.size() == 1);
 		assertEquals("", l.get(0));
 
@@ -203,13 +203,13 @@ public class UrlEncodingParserTest {
 		assertEquals("", l.get(1));
 		assertEquals("", l.get(2));
 		t = "@('','','')";
-		l = (List)p.parseParameter(t, Object.class);
+		l = (List)p.parsePart(t, Object.class);
 		assertTrue(l.size() == 3);
 		assertEquals("", l.get(0));
 		assertEquals("", l.get(1));
 		assertEquals("", l.get(2));
 		t = "@('','','')";
-		l = (List)p.parseParameter(t, List.class, Object.class);
+		l = (List)p.parsePart(t, List.class, Object.class);
 		assertTrue(l.size() == 3);
 		assertEquals("", l.get(0));
 		assertEquals("", l.get(1));
@@ -223,10 +223,10 @@ public class UrlEncodingParserTest {
 		assertEquals("\u0000", p.parse(t, String.class));
 		assertEquals("\u0000", p.parse(t, Object.class));
 		t = "'\u0000'";
-		assertEquals("\u0000", p.parseParameter(t, Object.class));
+		assertEquals("\u0000", p.parsePart(t, Object.class));
 		t = "'\u0000'";
-		assertEquals("\u0000", p.parseParameter(t, String.class));
-		assertEquals("\u0000", p.parseParameter(t, Object.class));
+		assertEquals("\u0000", p.parsePart(t, String.class));
+		assertEquals("\u0000", p.parsePart(t, Object.class));
 
 		// 2nd level
 		t = "?'\u0000'='\u0000'";
@@ -248,12 +248,12 @@ public class UrlEncodingParserTest {
 		b = p.parse(t, Boolean.class);
 		assertEquals(Boolean.FALSE, b);
 		t = "false";
-		b = (Boolean)p.parseParameter(t, Object.class);
+		b = (Boolean)p.parsePart(t, Object.class);
 		assertEquals(Boolean.FALSE, b);
-		b = p.parseParameter(t, Boolean.class);
+		b = p.parsePart(t, Boolean.class);
 		assertEquals(Boolean.FALSE, b);
 		t = "false";
-		b = p.parseParameter(t, Boolean.class);
+		b = p.parsePart(t, Boolean.class);
 		assertEquals(Boolean.FALSE, b);
 
 		// 2nd level
@@ -279,16 +279,16 @@ public class UrlEncodingParserTest {
 		i = p.parse(t, Integer.class);
 		assertEquals(123, i.intValue());
 		t = "123";
-		i = (Integer)p.parseParameter(t, Object.class);
+		i = (Integer)p.parsePart(t, Object.class);
 		assertEquals(123, i.intValue());
-		i = p.parseParameter(t, Integer.class);
+		i = p.parsePart(t, Integer.class);
 		assertEquals(123, i.intValue());
-		d = p.parseParameter(t, Double.class);
+		d = p.parsePart(t, Double.class);
 		assertEquals(123, d.intValue());
-		f = p.parseParameter(t, Float.class);
+		f = p.parsePart(t, Float.class);
 		assertEquals(123, f.intValue());
 		t = "123";
-		i = p.parseParameter(t, Integer.class);
+		i = p.parsePart(t, Integer.class);
 		assertEquals(123, i.intValue());
 
 		// 2nd level
@@ -303,7 +303,7 @@ public class UrlEncodingParserTest {
 		t = "_value=x;/?:@-_.!*'";
 		assertEquals("x;/?:@-_.!*'", p.parse(t, Object.class));
 		t = "x;/?:@-_.!*'";
-		assertEquals("x;/?:@-_.!*'", p.parseParameter(t, Object.class));
+		assertEquals("x;/?:@-_.!*'", p.parsePart(t, Object.class));
 
 		// 2nd level
 		t = "?x;/?:@-_.!*'=x;/?:@-_.!*'";
@@ -327,10 +327,10 @@ public class UrlEncodingParserTest {
 		assertEquals("x{}|\\^[]`<>#%\"&+", p.parse(t, Object.class));
 		assertEquals("x{}|\\^[]`<>#%\"&+", p.parse(t, String.class));
 		t = "x{}|\\^[]`<>#%\"&+";
-		assertEquals("x{}|\\^[]`<>#%\"&+", p.parseParameter(t, Object.class));
+		assertEquals("x{}|\\^[]`<>#%\"&+", p.parsePart(t, Object.class));
 		t = "x%7B%7D%7C%5C%5E%5B%5D%60%3C%3E%23%25%22%26%2B";
-		assertEquals("x%7B%7D%7C%5C%5E%5B%5D%60%3C%3E%23%25%22%26%2B", p.parseParameter(t, Object.class));
-		assertEquals("x%7B%7D%7C%5C%5E%5B%5D%60%3C%3E%23%25%22%26%2B", p.parseParameter(t, String.class));
+		assertEquals("x%7B%7D%7C%5C%5E%5B%5D%60%3C%3E%23%25%22%26%2B", p.parsePart(t, Object.class));
+		assertEquals("x%7B%7D%7C%5C%5E%5B%5D%60%3C%3E%23%25%22%26%2B", p.parsePart(t, String.class));
 
 		// 2nd level
 		t = "?x{}|\\^[]`<>#%\"&+=x{}|\\^[]`<>#%\"&+";
@@ -350,11 +350,11 @@ public class UrlEncodingParserTest {
 		t = "_value='x$,()'";
 		assertEquals("x$,()", p.parse(t, Object.class));
 		t = "'x$,()'";
-		assertEquals("x$,()", p.parseParameter(t, Object.class));
+		assertEquals("x$,()", p.parsePart(t, Object.class));
 		t = "_value='x~~$~~,~~(~~)'";
 		assertEquals("x~$~,~(~)", p.parse(t, Object.class));
 		t = "'x~~$~~,~~(~~)'";
-		assertEquals("x~$~,~(~)", p.parseParameter(t, Object.class));
+		assertEquals("x~$~,~(~)", p.parsePart(t, Object.class));
 
 		// At secondary levels, these characters are escaped and not encoded.
 		// 2nd level
@@ -373,9 +373,9 @@ public class UrlEncodingParserTest {
 		t = "_value='x%3D'";
 		assertEquals("x=", p.parse(t, Object.class));
 		t = "'x='";
-		assertEquals("x=", p.parseParameter(t, Object.class));
+		assertEquals("x=", p.parsePart(t, Object.class));
 		t = "'x%3D'";
-		assertEquals("x%3D", p.parseParameter(t, Object.class));
+		assertEquals("x%3D", p.parsePart(t, Object.class));
 
 		// 2nd level
 		t = "?'x%3D'='x%3D'";
@@ -394,8 +394,8 @@ public class UrlEncodingParserTest {
 		assertEquals("()", p.parse(t, Object.class));
 		assertEquals("()", p.parse(t, String.class));
 		t = "'()'";
-		assertEquals("()", p.parseParameter(t, Object.class));
-		assertEquals("()", p.parseParameter(t, String.class));
+		assertEquals("()", p.parsePart(t, Object.class));
+		assertEquals("()", p.parsePart(t, String.class));
 
 		// 2nd level
 		t = "?'()'='()'";
@@ -412,9 +412,9 @@ public class UrlEncodingParserTest {
 		t = "_value=$a";
 		assertEquals("$a", p.parse(t, Object.class));
 		t = "$a";
-		assertEquals("$a", p.parseParameter(t, Object.class));
+		assertEquals("$a", p.parsePart(t, Object.class));
 		t = "$a";
-		assertEquals("$a", p.parseParameter(t, Object.class));
+		assertEquals("$a", p.parsePart(t, Object.class));
 
 		// 2nd level
 		t = "?$a=$a";
@@ -428,7 +428,7 @@ public class UrlEncodingParserTest {
 		t = "_value=";
 		assertEquals("", p.parse(t, Object.class));
 		t = "";
-		assertEquals("", p.parseParameter(t, Object.class));
+		assertEquals("", p.parsePart(t, Object.class));
 
 		// 2nd level
 		t = "?=";
@@ -450,9 +450,9 @@ public class UrlEncodingParserTest {
 		t = "_value='%0A'";
 		assertEquals("\n", p.parse(t, Object.class));
 		t = "'%0A'";
-		assertEquals("%0A", p.parseParameter(t, Object.class));
+		assertEquals("%0A", p.parsePart(t, Object.class));
 		t = "'\n'";
-		assertEquals("\n", p.parseParameter(t, Object.class));
+		assertEquals("\n", p.parsePart(t, Object.class));
 
 		// 2nd level
 		t = "?'%0A'='%0A'";
@@ -482,11 +482,11 @@ public class UrlEncodingParserTest {
 		assertEquals("�", p.parse(t, Object.class));
 		assertEquals("�", p.parse(t, String.class));
 		t = "�";
-		assertEquals("�", p.parseParameter(t, Object.class));
-		assertEquals("�", p.parseParameter(t, String.class));
+		assertEquals("�", p.parsePart(t, Object.class));
+		assertEquals("�", p.parsePart(t, String.class));
 		t = "%C2%A2";
-		assertEquals("%C2%A2", p.parseParameter(t, Object.class));
-		assertEquals("%C2%A2", p.parseParameter(t, String.class));
+		assertEquals("%C2%A2", p.parsePart(t, Object.class));
+		assertEquals("%C2%A2", p.parsePart(t, String.class));
 
 		// 2nd level
 		t = "?%C2%A2=%C2%A2";
@@ -507,11 +507,11 @@ public class UrlEncodingParserTest {
 		assertEquals("\u20ac", p.parse(t, Object.class));
 		assertEquals("\u20ac", p.parse(t, String.class));
 		t = "\u20ac";
-		assertEquals("\u20ac", p.parseParameter(t, Object.class));
-		assertEquals("\u20ac", p.parseParameter(t, String.class));
+		assertEquals("\u20ac", p.parsePart(t, Object.class));
+		assertEquals("\u20ac", p.parsePart(t, String.class));
 		t = "%E2%82%AC";
-		assertEquals("%E2%82%AC", p.parseParameter(t, Object.class));
-		assertEquals("%E2%82%AC", p.parseParameter(t, String.class));
+		assertEquals("%E2%82%AC", p.parsePart(t, Object.class));
+		assertEquals("%E2%82%AC", p.parsePart(t, String.class));
 
 		// 2nd level
 		t = "?%E2%82%AC=%E2%82%AC";
@@ -532,11 +532,11 @@ public class UrlEncodingParserTest {
 		assertEquals("\U00024b62", p.parse(t, Object.class));
 		assertEquals("\U00024b62", p.parse(t, String.class));
 		t = "\U00024b62";
-		assertEquals("\U00024b62", p.parseParameter(t, Object.class));
-		assertEquals("\U00024b62", p.parseParameter(t, String.class));
+		assertEquals("\U00024b62", p.parsePart(t, Object.class));
+		assertEquals("\U00024b62", p.parsePart(t, String.class));
 		t = "%F0%A4%AD%A2";
-		assertEquals("%F0%A4%AD%A2", p.parseParameter(t, Object.class));
-		assertEquals("%F0%A4%AD%A2", p.parseParameter(t, String.class));
+		assertEquals("%F0%A4%AD%A2", p.parsePart(t, Object.class));
+		assertEquals("%F0%A4%AD%A2", p.parsePart(t, String.class));
 
 		// 2nd level
 		t = "?%F0%A4%AD%A2=%F0%A4%AD%A2";
@@ -563,12 +563,12 @@ public class UrlEncodingParserTest {
 		assertEquals(123, t.f2);
 
 		s = "(f1=foo,f2=123)";
-		t = p.parseParameter(s, A.class);
+		t = p.parsePart(s, A.class);
 		assertEquals("foo", t.f1);
 		assertEquals(123, t.f2);
 
 		s = "('f1'='foo','f2'=123)";
-		t = p.parseParameter(s, A.class);
+		t = p.parsePart(s, A.class);
 		assertEquals("foo", t.f1);
 		assertEquals(123, t.f2);
 	}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/UrlEncodingSerializerTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/UrlEncodingSerializerTest.java b/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/UrlEncodingSerializerTest.java
index 66e50dc..07f3755 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/UrlEncodingSerializerTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/UrlEncodingSerializerTest.java
@@ -17,7 +17,10 @@ import static org.junit.Assert.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.annotation.*;
 import org.apache.juneau.json.*;
+import org.apache.juneau.serializer.*;
+import org.apache.juneau.utils.*;
 import org.junit.*;
 
 @SuppressWarnings("javadoc")
@@ -449,8 +452,50 @@ public class UrlEncodingSerializerTest {
 	public void testParseParameterObjectMap() throws Exception {
 		String in = "(name='foo bar')";
 		
-		ObjectMap r =  UrlEncodingParser.DEFAULT.parseParameter(in, ObjectMap.class);
+		ObjectMap r =  UrlEncodingParser.DEFAULT.parsePart(in, ObjectMap.class);
 	
 		assertEquals("{name:'foo bar'}", JsonSerializer.DEFAULT_LAX.toString(r));
 	}
+	
+	//====================================================================================================
+	// Test URLENC_paramFormat == PLAINTEXT.
+	//====================================================================================================
+	@Test
+	public void testPlainTextParams() throws Exception {
+		WriterSerializer s = UrlEncodingSerializer.DEFAULT.builder().plainTextParams().build();
+		
+		assertEquals("_value=foo", s.serialize("foo"));
+		assertEquals("_value='foo'", s.serialize("'foo'"));
+		assertEquals("_value=(foo)", s.serialize("(foo)"));
+		assertEquals("_value=@(foo)", s.serialize("@(foo)"));
+		
+		Map<String,Object> m = new AMap<String,Object>()
+			.append("foo", "foo")
+			.append("'foo'", "'foo'")
+			.append("(foo)", "(foo)")
+			.append("@(foo)", "@(foo)");
+		assertEquals("foo=foo&'foo'='foo'&(foo)=(foo)&@(foo)=@(foo)", s.serialize(m));
+		
+		List<String> l = new AList<String>().appendAll("foo", "'foo'", "(foo)", "@(foo)");
+		assertEquals("0=foo&1='foo'&2=(foo)&3=@(foo)", s.serialize(l));
+		
+		A a = new A();
+		assertEquals("'foo'='foo'&(foo)=(foo)&@(foo)=@(foo)&foo=foo", s.serialize(a));
+	}
+	
+	@Bean(sort=true)
+	public static class A {
+		
+		@BeanProperty(name="foo")
+		public String f1 = "foo";
+		
+		@BeanProperty(name="'foo'")
+		public String f2 = "'foo'";
+
+		@BeanProperty(name="(foo)")
+		public String f3 = "(foo)";
+
+		@BeanProperty(name="@(foo)")
+		public String f4 = "@(foo)";
+	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java b/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
index f1513bb..4c1a333 100644
--- a/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
+++ b/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
@@ -26,6 +26,7 @@ import java.util.concurrent.*;
 import org.apache.juneau.annotation.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.parser.*;
+import org.apache.juneau.remoteable.*;
 import org.apache.juneau.serializer.*;
 import org.apache.juneau.transform.*;
 import org.apache.juneau.utils.*;
@@ -82,8 +83,7 @@ public final class ClassMeta<T> implements Type {
 		isMemberClass;                                       // True if this is a non-static member class.
 	private final Object primitiveDefault;                  // Default value for primitive type classes.
 	private final Map<String,Method>
-		remoteableMethods,                                   // Methods annotated with @Remoteable.  Contains all public methods if class is annotated with @Remotable.
-		proxyableMethods,                                    // Remoteable methods only if at least one method is marked @Remoteable, otherwise all public methods.
+		remoteableMethods,                                   // Methods annotated with @RemoteMethod.
 		publicMethods;                                       // All public methods, including static methods.
 	private final PojoSwap<?,?>[] childPojoSwaps;           // Any PojoSwaps where the normal type is a subclass of this class.
 	private final ConcurrentHashMap<Class<?>,PojoSwap<?,?>>
@@ -161,7 +161,6 @@ public final class ClassMeta<T> implements Type {
 		this.primitiveDefault = builder.primitiveDefault;
 		this.publicMethods = builder.publicMethods;
 		this.remoteableMethods = builder.remoteableMethods;
-		this.proxyableMethods = builder.proxyableMethods;
 		this.beanFilter = beanFilter;
 		this.pojoSwap = builder.pojoSwap;
 		this.extMeta = new MetadataMap();
@@ -212,7 +211,6 @@ public final class ClassMeta<T> implements Type {
 		this.isMemberClass = mainType.isMemberClass;
 		this.primitiveDefault = mainType.primitiveDefault;
 		this.remoteableMethods = mainType.remoteableMethods;
-		this.proxyableMethods = mainType.proxyableMethods;
 		this.publicMethods = mainType.publicMethods;
 		this.beanContext = mainType.beanContext;
 		this.serializedClassMeta = this;
@@ -260,7 +258,6 @@ public final class ClassMeta<T> implements Type {
 		this.isMemberClass = false;
 		this.primitiveDefault = null;
 		this.remoteableMethods = null;
-		this.proxyableMethods = null;
 		this.publicMethods = null;
 		this.beanContext = null;
 		this.serializedClassMeta = this;
@@ -306,8 +303,7 @@ public final class ClassMeta<T> implements Type {
 		Object primitiveDefault = null;
 		Map<String,Method>
 			publicMethods = new LinkedHashMap<String,Method>(),
-			remoteableMethods = null,
-			proxyableMethods = null;
+			remoteableMethods = new LinkedHashMap<String,Method>();
 		ClassMeta<?>
 			keyType = null,
 			valueType = null,
@@ -534,17 +530,22 @@ public final class ClassMeta<T> implements Type {
 				if (isPublic(m) && isNotDeprecated(m))
 					publicMethods.put(ClassUtils.getMethodSignature(m), m);
 
-			if (c.getAnnotation(Remoteable.class) != null) {
-				remoteableMethods = proxyableMethods = publicMethods;
-			} else {
-				for (Method m : c.getMethods()) {
-					if (m.getAnnotation(Remoteable.class) != null) {
-						if (remoteableMethods == null)
-							remoteableMethods = new LinkedHashMap<String,Method>();
-						remoteableMethods.put(ClassUtils.getMethodSignature(m), m);
+			Map<Class<?>,Remoteable> remoteableMap = ReflectionUtils.findAnnotationsMap(Remoteable.class, c);
+			if (! remoteableMap.isEmpty()) {
+				Map.Entry<Class<?>,Remoteable> e = remoteableMap.entrySet().iterator().next();  // Grab the first one.
+				Class<?> ic = e.getKey();
+				Remoteable r = e.getValue();
+				String methodPaths = r.methodPaths();
+				String expose = r.expose();
+				for (Method m : "DECLARED".equals(expose) ? ic.getDeclaredMethods() : ic.getMethods()) {
+					if (isPublic(m)) {
+						RemoteMethod rm = m.getAnnotation(RemoteMethod.class);
+						if (rm != null || ! "ANNOTATED".equals(expose)) {
+							String path = "NAME".equals(methodPaths) ? m.getName() : ClassUtils.getMethodSignature(m);
+							remoteableMethods.put(path, m);
+						}
 					}
 				}
-				proxyableMethods = (remoteableMethods != null ? remoteableMethods : publicMethods);
 			}
 
 			if (innerClass != Object.class) {
@@ -1193,17 +1194,6 @@ public final class ClassMeta<T> implements Type {
 	}
 
 	/**
-	 * All methods on this class that can be exposed as a proxy method.
-	 * <p>
-	 * Same as {@link #getRemoteableMethods()} except returns all public methods if class is not annotated with {@link Remoteable @Remotable}.
-	 *
-	 * @return All proxyable methods on this class.
-	 */
-	public Map<String,Method> getProxyableMethods() {
-		return proxyableMethods;
-	}
-
-	/**
 	 * All public methods on this class including static methods.
 	 * Keys are method signatures.
 	 *

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/annotation/Remoteable.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/annotation/Remoteable.java b/juneau-core/src/main/java/org/apache/juneau/annotation/Remoteable.java
deleted file mode 100644
index 42a8e46..0000000
--- a/juneau-core/src/main/java/org/apache/juneau/annotation/Remoteable.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
-// * with the License.  You may obtain a copy of the License at                                                              *
-// *                                                                                                                         *
-// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
-// *                                                                                                                         *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
-// * specific language governing permissions and limitations under the License.                                              *
-// ***************************************************************************************************************************
-package org.apache.juneau.annotation;
-
-import static java.lang.annotation.ElementType.*;
-import static java.lang.annotation.RetentionPolicy.*;
-
-import java.lang.annotation.*;
-
-/**
- * Identifies services whose Java class or methods can be invoked remotely.
- */
-@Documented
-@Target({TYPE,METHOD})
-@Retention(RUNTIME)
-@Inherited
-public @interface Remoteable {}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/dto/Link.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/Link.java b/juneau-core/src/main/java/org/apache/juneau/dto/Link.java
index e3a3cd3..1b926aa 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/Link.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/Link.java
@@ -104,7 +104,7 @@ public class Link implements Comparable<Link> {
 	 */
 	public Link setHref(String href, Object...args) {
 		for (int i = 0; i < args.length; i++)
-			args[i] = UrlEncodingSerializer.DEFAULT.serializeUrlPart(args[i]);
+			args[i] = UrlEncodingSerializer.DEFAULT.serializePart(args[i], null, null);
 		this.href = (args.length > 0 ? MessageFormat.format(href, args) : href);
 		return this;
 	}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java b/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java
index 8f69eaf..a5bc00e 100644
--- a/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java
+++ b/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java
@@ -16,6 +16,7 @@ import static org.apache.juneau.internal.ThrowableUtils.*;
 
 import java.io.*;
 import java.math.*;
+import java.net.*;
 import java.nio.*;
 import java.nio.charset.*;
 import java.util.*;
@@ -40,6 +41,9 @@ public final class StringUtils {
 	// Maps 6-bit nibbles to BASE64 characters.
 	private static final char[] base64m1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
 
+	// Characters that do not need to be URL-encoded
+	private static final AsciiSet unencodedChars = new AsciiSet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.!~*'()\\");
+
 	// Maps BASE64 characters to 6-bit nibbles.
 	private static final byte[] base64m2 = new byte[128];
 	static {
@@ -1114,4 +1118,123 @@ public final class StringUtils {
 				s = s.substring(0, s.length()-1);
 		return s;
 	}
+
+	/**
+	 * Returns <jk>true</jk> if the specified string is one of the specified values.
+	 *
+	 * @param s The string to test.
+	 * Can be <jk>null</jk>.
+	 * @param values The values to test.
+	 * Can contain <jk>null</jk>.
+	 * @return <jk>true</jk> if the specified string is one of the specified values.
+	 */
+	public static boolean isOneOf(String s, String...values) {
+		for (int i = 0; i < values.length; i++)
+			if (StringUtils.isEquals(s, values[i]))
+				return true;
+		return false;
+	}
+
+	/**
+	 * Trims <js>'/'</js> characters from both the start and end of the specified string.
+	 *
+	 * @param s The string to trim.
+	 * @return A new trimmed string, or the same string if no trimming was necessary.
+	 */
+	public static String trimSlashes(String s) {
+		if (s == null)
+			return null;
+		while (endsWith(s, '/'))
+			s = s.substring(0, s.length()-1);
+		while (s.length() > 0 && s.charAt(0) == '/')
+			s = s.substring(1);
+		return s;
+	}
+
+	/**
+	 * Trims <js>'/'</js> characters from the end of the specified string.
+	 *
+	 * @param s The string to trim.
+	 * @return A new trimmed string, or the same string if no trimming was necessary.
+	 */
+	public static String trimTrailingSlashes(String s) {
+		if (s == null)
+			return null;
+		while (endsWith(s, '/'))
+			s = s.substring(0, s.length()-1);
+		return s;
+	}
+
+	/**
+	 * Trims <js>'/'</js> characters from the end of the specified string.
+	 *
+	 * @param s The string to trim.
+	 * @return The same string buffer.
+	 */
+	public static StringBuffer trimTrailingSlashes(StringBuffer s) {
+		if (s == null)
+			return null;
+		while (s.length() > 0 && s.charAt(s.length()-1) == '/')
+			s.setLength(s.length()-1);
+		return s;
+	}
+
+	/**
+	 * Decodes a <code>application/x-www-form-urlencoded</code> string using <code>UTF-8</code> encoding scheme.
+	 *
+	 * @param s The string to decode.
+	 * @return The decoded string, or <jk>null</jk> if input is <jk>null</jk>.
+	 */
+	public static String urlDecode(String s) {
+		if (s == null)
+			return s;
+		boolean needsDecode = false;
+		for (int i = 0; i < s.length() && ! needsDecode; i++) {
+			char c = s.charAt(i);
+			if (c == '+' || c == '%')
+				needsDecode = true;
+		}
+		if (needsDecode)
+		try {
+				return URLDecoder.decode(s, "UTF-8");
+			} catch (UnsupportedEncodingException e) {/* Won't happen */}
+		return s;
+	}
+
+	/**
+	 * Encodes a <code>application/x-www-form-urlencoded</code> string using <code>UTF-8</code> encoding scheme.
+	 *
+	 * @param s The string to encode.
+	 * @return The encoded string, or <jk>null</jk> if input is <jk>null</jk>.
+	 */
+	public static String urlEncode(String s) {
+		if (s == null)
+			return null;
+		boolean needsEncode = false;
+		for (int i = 0; i < s.length() && ! needsEncode; i++)
+			needsEncode |= (! unencodedChars.contains(s.charAt(i)));
+		if (needsEncode) {
+			try {
+				return URLEncoder.encode(s, "UTF-8");
+			} catch (UnsupportedEncodingException e) {/* Won't happen */}
+		}
+		return s;
+	}
+
+	/**
+	 * Returns the first non-whitespace character in the string.
+	 *
+	 * @param s The string to check.
+	 * @return The first non-whitespace character, or <code>0</code> if the string is <jk>null</jk>, empty, or composed of only whitespace.
+	 */
+	public static char firstNonWhitespaceChar(String s) {
+		if (s != null) {
+			for (int i = 0; i < s.length(); i++) {
+				char c = s.charAt(i);
+				if (! Character.isWhitespace(c))
+					return c;
+			}
+		}
+		return 0;
+	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/parser/Parser.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/parser/Parser.java b/juneau-core/src/main/java/org/apache/juneau/parser/Parser.java
index 25b3840..f64b271 100644
--- a/juneau-core/src/main/java/org/apache/juneau/parser/Parser.java
+++ b/juneau-core/src/main/java/org/apache/juneau/parser/Parser.java
@@ -198,6 +198,8 @@ public abstract class Parser extends CoreObject {
 	 */
 	public final <T> T parseSession(ParserSession session, ClassMeta<T> type) throws ParseException {
 		try {
+			if (type.isVoid())
+				return null;
 			return doParse(session, type);
 		} catch (ParseException e) {
 			throw e;

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/remoteable/Body.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/remoteable/Body.java b/juneau-core/src/main/java/org/apache/juneau/remoteable/Body.java
new file mode 100644
index 0000000..a73b694
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/remoteable/Body.java
@@ -0,0 +1,49 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.remoteable;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.io.*;
+import java.lang.annotation.*;
+
+import org.apache.juneau.serializer.*;
+
+/**
+ * Annotation applied to Java method arguments of interface proxies to denote that they are the HTTP body of the request.
+ * <p>
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode'>
+ * 	<ja>@Remoteable</ja>(path=<js>"/myproxy"</js>)
+ * 	<jk>public interface</jk> MyProxy {
+ *
+ * 		<ja>@RemoteMethod</ja>(path=<js>"/mymethod"</js>)
+ * 		String myProxyMethod(<ja>@Body</ja> MyPojo pojo);
+ * 	}
+ * </p>
+ * <p>
+ * The argument can be any of the following types:
+ * <ul class='spaced-list'>
+ * 	<li>Any serializable POJO - Converted to text using the {@link Serializer} registered with the <code>RestClient</code>.
+ * 	<li>{@link Reader} - Raw contents of {@code Reader} will be serialized to remote resource.
+ * 	<li>{@link InputStream} - Raw contents of {@code InputStream} will be serialized to remote resource.
+ * 	<li><code>HttpEntity</code> - Bypass Juneau serialization and pass HttpEntity directly to HttpClient.
+ * 	<li><code>NameValuePairs</code> - Converted to a URL-encoded FORM post.
+ * </ul>
+ */
+@Documented
+@Target(PARAMETER)
+@Retention(RUNTIME)
+@Inherited
+public @interface Body {}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/remoteable/FormData.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/remoteable/FormData.java b/juneau-core/src/main/java/org/apache/juneau/remoteable/FormData.java
new file mode 100644
index 0000000..5d0ecf2
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/remoteable/FormData.java
@@ -0,0 +1,60 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.remoteable;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+import org.apache.juneau.urlencoding.*;
+
+/**
+ * Annotation applied to Java method arguments of interface proxies to denote that they are FORM post parameters on the request.
+ * <p>
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode'>
+ * 	<ja>@Remoteable</ja>(path=<js>"/myproxy"</js>)
+ * 	<jk>public interface</jk> MyProxy {
+ *
+ * 		<ja>@RemoteMethod</ja>(path=<js>"/mymethod1"</js>)
+ * 		String myProxyMethod1(<ja>@FormData</ja>(<js>"foo"</js>)</ja> String foo, <ja>@FormData</ja>(<js>"bar"</js>)</ja> MyPojo pojo);
+ *
+ * 		<ja>@RemoteMethod</ja>(path=<js>"/mymethod2"</js>)
+ * 		String myProxyMethod2(<ja>@FormData</ja> NameValuePairs form);
+ *
+ * 		<ja>@RemoteMethod</ja>(path=<js>"/mymethod3"</js>)
+ * 		String myProxyMethod2(<ja>@FormData</ja> Map&lt;String,Object&gt; form);
+ * 	}
+ * </p>
+ * <p>
+ * The argument can be any of the following types:
+ * <ul class='spaced-list'>
+ * 	<li>Any serializable POJO - Converted to text using {@link UrlEncodingSerializer#serializePart(Object, Boolean, Boolean)}.
+ * 	<li><code>NameValuePairs</code> - Individual name-value pairs.
+ * 	<li><code>Map&lt;String,Object&gt;</code> - Individual name-value pairs.
+ * 		Values are converted to text using {@link UrlEncodingSerializer#serializePart(Object, Boolean, Boolean)}.
+ * </ul>
+ */
+@Documented
+@Target(PARAMETER)
+@Retention(RUNTIME)
+@Inherited
+public @interface FormData {
+
+	/**
+	 * The form post parameter name.
+	 * Can be blank if the value is an instance of <code>NameValuePairs</code> or <code>Map&lt;String,Object&gt;</code>.
+	 */
+	String value() default "";
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/remoteable/FormDataIfNE.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/remoteable/FormDataIfNE.java b/juneau-core/src/main/java/org/apache/juneau/remoteable/FormDataIfNE.java
new file mode 100644
index 0000000..a156928
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/remoteable/FormDataIfNE.java
@@ -0,0 +1,34 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.remoteable;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+/**
+ * Identical to {@link FormData @FormData} except skips values if they're null/blank.
+ */
+@Documented
+@Target(PARAMETER)
+@Retention(RUNTIME)
+@Inherited
+public @interface FormDataIfNE {
+
+	/**
+	 * The form post parameter name.
+	 * Can be blank if the value is an instance of <code>NameValuePairs</code> or <code>Map&lt;String,Object&gt;</code>.
+	 */
+	String value() default "";
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/remoteable/Header.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/remoteable/Header.java b/juneau-core/src/main/java/org/apache/juneau/remoteable/Header.java
new file mode 100644
index 0000000..31eab82
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/remoteable/Header.java
@@ -0,0 +1,56 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.remoteable;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+import org.apache.juneau.urlencoding.*;
+
+/**
+ * Annotation applied to Java method arguments of interface proxies to denote that they are serialized as an HTTP header value.
+ * <p>
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode'>
+ * 	<ja>@Remoteable</ja>(path=<js>"/myproxy"</js>)
+ * 	<jk>public interface</jk> MyProxy {
+ *
+ * 		<ja>@RemoteMethod</ja>(path=<js>"/mymethod1"</js>)
+ * 		String myProxyMethod1(<ja>@Header</ja>(<js>"Foo"</js>)</ja> String foo, <ja>@Header</ja>(<js>"Bar"</js>)</ja> MyPojo pojo);
+ *
+ * 		<ja>@RemoteMethod</ja>(path=<js>"/mymethod2"</js>)
+ * 		String myProxyMethod2(<ja>@Header</ja> Map&lt;String,Object&gt; headers);
+ * 	}
+ * </p>
+ * <p>
+ * The argument can be any of the following types:
+ * <ul class='spaced-list'>
+ * 	<li>Any serializable POJO - Converted to text using {@link UrlEncodingSerializer#serializePart(Object, Boolean, Boolean)}.
+ * 	<li><code>Map&lt;String,Object&gt;</code> - Individual name-value pairs.
+ * 		Values are converted to text using {@link UrlEncodingSerializer#serializePart(Object, Boolean, Boolean)}.
+ * </ul>
+ */
+@Documented
+@Target(PARAMETER)
+@Retention(RUNTIME)
+@Inherited
+public @interface Header {
+
+	/**
+	 * The HTTP header name.
+	 * Can be blank if the value is an instance of <code>Map&lt;String,Object&gt;</code>.
+	 */
+	String value() default "";
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/remoteable/HeaderIfNE.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/remoteable/HeaderIfNE.java b/juneau-core/src/main/java/org/apache/juneau/remoteable/HeaderIfNE.java
new file mode 100644
index 0000000..e99915e
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/remoteable/HeaderIfNE.java
@@ -0,0 +1,34 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.remoteable;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+/**
+ * Identical to {@link Header @Header} except skips values if they're null/blank.
+ */
+@Documented
+@Target(PARAMETER)
+@Retention(RUNTIME)
+@Inherited
+public @interface HeaderIfNE {
+
+	/**
+	 * The HTTP header name.
+	 * Can be blank if the value is an instance of <code>Map&lt;String,Object&gt;</code>.
+	 */
+	String value();
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/remoteable/Query.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/remoteable/Query.java b/juneau-core/src/main/java/org/apache/juneau/remoteable/Query.java
new file mode 100644
index 0000000..0a82529
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/remoteable/Query.java
@@ -0,0 +1,60 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.remoteable;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+import org.apache.juneau.urlencoding.*;
+
+/**
+ * Annotation applied to Java method arguments of interface proxies to denote that they are QUERY parameters on the request.
+ * <p>
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode'>
+ * 	<ja>@Remoteable</ja>(path=<js>"/myproxy"</js>)
+ * 	<jk>public interface</jk> MyProxy {
+ *
+ * 		<ja>@RemoteMethod</ja>(path=<js>"/mymethod1"</js>)
+ * 		String myProxyMethod1(<ja>@Query</ja>(<js>"foo"</js>)</ja> String foo, <ja>@Query</ja>(<js>"bar"</js>)</ja> MyPojo pojo);
+ *
+ * 		<ja>@RemoteMethod</ja>(path=<js>"/mymethod2"</js>)
+ * 		String myProxyMethod2(<ja>@Query</ja> Map&lt;String,Object&gt; query);
+ *
+ * 		<ja>@RemoteMethod</ja>(path=<js>"/mymethod3"</js>)
+ * 		String myProxyMethod2(<ja>@Query</ja> String queryString);
+ * 	}
+ * </p>
+ * <p>
+ * The argument can be any of the following types:
+ * <ul class='spaced-list'>
+ * 	<li>Any serializable POJO - Converted to text using {@link UrlEncodingSerializer#serializePart(Object, Boolean, Boolean)}.
+ * 	<li><code>Map&lt;String,Object&gt;</code> - Individual name-value pairs.
+ * 		Values are converted to text using {@link UrlEncodingSerializer#serializePart(Object, Boolean, Boolean)}.
+ * 	<li>{@link String} - Treated as a query string.
+ * </ul>
+*/
+@Documented
+@Target(PARAMETER)
+@Retention(RUNTIME)
+@Inherited
+public @interface Query {
+
+	/**
+	 * The query parameter name.
+	 * Can be blank if the value is an instance of <code>Map&lt;String,Object&gt;</code> or <code>String</code>.
+	 */
+	String value() default "";
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/remoteable/QueryIfNE.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/remoteable/QueryIfNE.java b/juneau-core/src/main/java/org/apache/juneau/remoteable/QueryIfNE.java
new file mode 100644
index 0000000..10ae263
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/remoteable/QueryIfNE.java
@@ -0,0 +1,34 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.remoteable;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+/**
+ * Identical to {@link Query @Query} except skips values if they're null/blank.
+ */
+@Documented
+@Target(PARAMETER)
+@Retention(RUNTIME)
+@Inherited
+public @interface QueryIfNE {
+
+	/**
+	 * The query parameter name.
+	 * Can be blank if the value is an instance of <code>Map&lt;String,Object&gt;</code> or <code>String</code>.
+	 */
+	String value();
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteMethod.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteMethod.java b/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteMethod.java
new file mode 100644
index 0000000..335c306
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteMethod.java
@@ -0,0 +1,63 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.remoteable;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.io.*;
+import java.lang.annotation.*;
+
+/**
+ * Annotation applied to Java methods on interface proxy classes.
+ * <p>
+ * TODO <i>(sorry)</i>
+ * <p>
+ * The return type on the Java method can be any of the following:
+ * <ul>
+ * 	<li><jk>void</jk> - Don't parse any response.  Note that the method will still throw an exception if an error HTTP status is returned.
+ * 	<li>Any parsable POJO - The body of the response will be converted to the POJO using the parser defined on the <code>RestClient</code>.
+ * 	<li><code>HttpResponse</code> - Returns the raw <code>HttpResponse</code> returned by the inner <code>HttpClient</code>.
+ * 	<li>{@link Reader} - Returns access to the raw reader of the response.
+ * 	<li>{@link InputStream} - Returns access to the raw input stream of the response.
+ * </ul>
+ */
+@Documented
+@Target(METHOD)
+@Retention(RUNTIME)
+@Inherited
+public @interface RemoteMethod {
+
+	/**
+	 * The path to the REST service for this Java method relative to the parent proxy interface URL.
+	 * <p>
+	 * The default value is the Java method name (e.g. <js>"http://localhost/root-url/org.foo.MyInterface/myMethod"</js>) if
+	 * 	{@link Remoteable#methodPaths() @Remoteable.methodPaths()} is <js>"NAME"</js>, or the Java method signature
+	 * 	(e.g. <js>"http://localhost/root-url/org.foo.MyInterface/myMethod(int,boolean,java.lang.String)"</js>) if
+	 * 	it's <js>"SIGNATURE"</js>.
+	 */
+	String path() default "";
+
+	/**
+	 * Defines whether to use <code>GET</code> or <code>POST</code> for REST calls.
+	 * <p>
+	 * Possible values:
+	 * <ul>
+	 * 	<li><js>"POST"</js> (default) - Parameters are serialized using the serializer registered with the RestClient.
+	 * 	<li><js>"GET"</js> - Parameters are serialized using the UrlEncodingSerializer registered with the RestClient.
+	 * </ul>
+	 * <p>
+	 * The default value is <js>"POST"</js>.
+	 */
+	String httpMethod() default "POST";
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteMethodArg.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteMethodArg.java b/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteMethodArg.java
new file mode 100644
index 0000000..86d2eac
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteMethodArg.java
@@ -0,0 +1,41 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.remoteable;
+
+/**
+ * Represents the metadata about an annotated argument of a method on a remote proxy interface.
+ */
+public class RemoteMethodArg {
+
+	/** The argument name.  Can be blank. */
+	public final String name;
+
+	/** The zero-based index of the argument on the Java method. */
+	public final int index;
+
+	/** The value is skipped if it's null/empty. */
+	public final boolean skipIfNE;
+
+	/**
+	 * Constructor.
+	 *
+	 * @param name The argument name.  Can be blank.
+	 * @param index The zero-based index of the argument on the Java method.
+	 * @param skipIfNE The value is skipped if it's null/empty.
+	 */
+	protected RemoteMethodArg(String name, int index, boolean skipIfNE) {
+		this.name = name;
+		this.index = index;
+		this.skipIfNE = skipIfNE;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/remoteable/Remoteable.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/remoteable/Remoteable.java b/juneau-core/src/main/java/org/apache/juneau/remoteable/Remoteable.java
new file mode 100644
index 0000000..d2e33b2
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/remoteable/Remoteable.java
@@ -0,0 +1,65 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.remoteable;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+/**
+ * Identifies a remote proxy interface against a REST interface.
+ * <p>
+ * TODO <i>(sorry)</i>
+ */
+@Documented
+@Target({TYPE,METHOD})
+@Retention(RUNTIME)
+@Inherited
+public @interface Remoteable {
+
+	/**
+	 * The absolute or relative path of the REST service.
+	 * <p>
+	 * When a relative path is specified, it's relative to the root-url defined on the <code>RestClient</code> used
+	 * to instantiate the interface.
+	 * <p>
+	 * When no path is specified, the path is assumed to be the class name (e.g. <js>"http://localhost/root-url/org.foo.MyInterface"</js>)
+	 */
+	String path() default "";
+
+	/**
+	 * Identifies which methods on the interface should be exposed through the proxy.
+	 * <p>
+	 * The options are:
+	 * <ul>
+	 * 	<li><js>"DECLARED"</js> (default) - Only methods declared on the immediate interface/class are exposed.  Methods on parent interfaces/classes are ignored.
+	 * 	<li><js>"ANNOTATED"</js> - Only methods annotated with {@link RemoteMethod} are exposed.
+	 * 	<li><js>"ALL"</js> - All methods defined on the interface or class are exposed.
+	 * </ul>
+	 */
+	String expose() default "DECLARED";
+
+	/**
+	 * Defines the methodology to use for the path names of the methods when not explicitly defined via {@link RemoteMethod#path() @RemoteMethod.path()}.
+	 * <p>
+	 * The options are:
+	 * <ul>
+	 * 	<li><js>"NAME"</js> (default) - Use the method name (e.g. "myMethod").
+	 * 	<li><js>"SIGNATURE"</js> - Use the method signature (e.g. "myMethod(int,boolean,java.lang.String,int[][][])").
+	 * </ul>
+	 * <p>
+	 * Note that if you use <js>"NAME"</js>, method names must be unique in the interface.
+	 */
+	String methodPaths() default "NAME";
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMeta.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMeta.java b/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMeta.java
new file mode 100644
index 0000000..a6ee0b2
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMeta.java
@@ -0,0 +1,67 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.remoteable;
+
+import static org.apache.juneau.internal.StringUtils.*;
+import static org.apache.juneau.internal.ClassUtils.*;
+
+import java.lang.reflect.*;
+import java.util.*;
+
+import org.apache.juneau.internal.*;
+
+/**
+ * Contains the meta-data about a remoteable interface.
+ * <p>
+ * Captures the information in {@link Remoteable @Remoteable} and {@link RemoteMethod @RemoteMethod}
+ * annotations for caching and reuse.
+ */
+public class RemoteableMeta {
+
+	private final Map<Method,RemoteableMethodMeta> methods;
+
+	/**
+	 * Constructor.
+	 *
+	 * @param c The interface class annotated with a {@link Remoteable @Remoteable} annotation (optional).
+	 * @param restUrl The absolute URL of the remote REST interface that implements this proxy interface.
+	 */
+	public RemoteableMeta(Class<?> c, String restUrl) {
+		Remoteable r = ReflectionUtils.getAnnotation(Remoteable.class, c);
+
+		String expose = r == null ? "DECLARED" : r.expose();
+		if (! isOneOf(expose, "ALL", "DECLARED", "ANNOTATED"))
+			throw new RemoteableMetadataException(c, "Invalid value specified for ''expose'' annotation.  Valid values are [ALL,ANNOTATED,DECLARED].");
+
+		Map<Method,RemoteableMethodMeta> _methods = new LinkedHashMap<Method,RemoteableMethodMeta>();
+		for (Method m : expose.equals("DECLARED") ? c.getDeclaredMethods() : c.getMethods()) {
+			if (isPublic(m)) {
+				RemoteMethod rm = c.getAnnotation(RemoteMethod.class);
+				if (rm != null || ! expose.equals("ANNOTATED"))
+					_methods.put(m, new RemoteableMethodMeta(restUrl, m));
+			}
+		}
+
+		this.methods = Collections.unmodifiableMap(_methods);
+	}
+
+	/**
+	 * Returns the metadata about the specified method on this interface proxy.
+	 *
+	 * @param m The method to look up.
+	 * @return Metadata about the method, or <jk>null</jk> if no metadata was found.
+	 */
+	public RemoteableMethodMeta getMethodMeta(Method m) {
+		return methods.get(m);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMetadataException.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMetadataException.java b/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMetadataException.java
new file mode 100644
index 0000000..384ef4f
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMetadataException.java
@@ -0,0 +1,56 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.remoteable;
+
+import java.lang.reflect.*;
+import java.text.*;
+
+import org.apache.juneau.*;
+
+/**
+ * Exceptions caused by invalid Remoteable classes.
+ */
+public class RemoteableMetadataException extends FormattedRuntimeException {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Constructor.
+	 *
+	 * @param m The interface method that has an invalid definition.
+	 * @param message The {@link MessageFormat}-style message.
+	 * @param args Optional {@link MessageFormat}-style arguments.
+	 */
+	public RemoteableMetadataException(Method m, String message, Object...args) {
+		super(getMessage(m.getDeclaringClass(), m, message), args);
+	}
+
+	/**
+	 * Constructor.
+	 *
+	 * @param c The interface class that has an invalid definition.
+	 * @param message The {@link MessageFormat}-style message.
+	 * @param args Optional {@link MessageFormat}-style arguments.
+	 */
+	public RemoteableMetadataException(Class<?> c, String message, Object...args) {
+		super(getMessage(c, null, message), args);
+	}
+
+	private static final String getMessage(Class<?> c, Method m, String msg) {
+		StringBuilder sb = new StringBuilder("Invalid remoteable definition found on class ").append(c.getName());
+		if (m != null)
+			sb.append(" on method ").append(m.getName());
+		sb.append(". ").append(msg);
+		return sb.toString();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMethodMeta.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMethodMeta.java b/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMethodMeta.java
new file mode 100644
index 0000000..12b0d6b
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMethodMeta.java
@@ -0,0 +1,177 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.remoteable;
+
+import static org.apache.juneau.internal.StringUtils.*;
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+import org.apache.juneau.internal.*;
+
+/**
+ * Contains the meta-data about a Java method on a remoteable interface.
+ * <p>
+ * Captures the information in {@link RemoteMethod @RemoteMethod} annotations for caching and reuse.
+ */
+public class RemoteableMethodMeta {
+
+	private final String httpMethod;
+	private final String url;
+	private final RemoteMethodArg[] queryArgs, headerArgs, formDataArgs;
+	private final Integer[] otherArgs;
+	private final Integer bodyArg;
+
+	/**
+	 * Constructor.
+	 *
+	 * @param restUrl The absolute URL of the REST interface backing the interface proxy.
+	 * @param m The Java method.
+	 */
+	public RemoteableMethodMeta(final String restUrl, Method m) {
+		Builder b = new Builder(restUrl, m);
+		this.httpMethod = b.httpMethod;
+		this.url = b.url;
+		this.queryArgs = b.queryArgs.toArray(new RemoteMethodArg[b.queryArgs.size()]);
+		this.formDataArgs = b.formDataArgs.toArray(new RemoteMethodArg[b.formDataArgs.size()]);
+		this.headerArgs = b.headerArgs.toArray(new RemoteMethodArg[b.headerArgs.size()]);
+		this.otherArgs = b.otherArgs.toArray(new Integer[b.otherArgs.size()]);
+		this.bodyArg = b.bodyArg;
+	}
+
+	private static class Builder {
+		private String httpMethod, url;
+		private List<RemoteMethodArg>
+			queryArgs = new LinkedList<RemoteMethodArg>(),
+			headerArgs = new LinkedList<RemoteMethodArg>(),
+			formDataArgs = new LinkedList<RemoteMethodArg>();
+		private List<Integer> otherArgs = new LinkedList<Integer>();
+		private Integer bodyArg;
+
+		private Builder(String restUrl, Method m) {
+			Remoteable r = m.getDeclaringClass().getAnnotation(Remoteable.class);
+			RemoteMethod rm = m.getAnnotation(RemoteMethod.class);
+
+			httpMethod = rm == null ? "POST" : rm.httpMethod();
+			if (! isOneOf(httpMethod, "GET", "POST"))
+				throw new RemoteableMetadataException(m, "Invalid value specified for @RemoteMethod.httpMethod() annotation.  Valid values are [GET,POST].");
+
+			String path = rm == null || rm.path().isEmpty() ? null : rm.path();
+			String methodPaths = r == null ? "NAME" : r.methodPaths();
+
+			if (! isOneOf(methodPaths, "NAME", "SIGNATURE"))
+				throw new RemoteableMetadataException(m, "Invalid value specified for @Remoteable.methodPaths() annotation.  Valid values are [NAME,SIGNATURE].");
+
+			url =
+				trimSlashes(restUrl)
+				+ '/'
+				+ (path != null ? trimSlashes(path) : urlEncode("NAME".equals(methodPaths) ? m.getName() : ClassUtils.getMethodSignature(m)));
+
+			int index = 0;
+			for (Annotation[] aa : m.getParameterAnnotations()) {
+				boolean annotated = false;
+				for (Annotation a : aa) {
+					Class<?> ca = a.annotationType();
+					if (ca == Query.class) {
+						Query q = (Query)a;
+						annotated = queryArgs.add(new RemoteMethodArg(q.value(), index, false));
+					} else if (ca == QueryIfNE.class) {
+						Query q = (Query)a;
+						annotated = queryArgs.add(new RemoteMethodArg(q.value(), index, true));
+					} else if (ca == FormData.class) {
+						FormData f = (FormData)a;
+						annotated = formDataArgs.add(new RemoteMethodArg(f.value(), index, false));
+					} else if (ca == FormDataIfNE.class) {
+						FormData f = (FormData)a;
+						annotated = formDataArgs.add(new RemoteMethodArg(f.value(), index, true));
+					} else if (ca == Header.class) {
+						Header h = (Header)a;
+						annotated = headerArgs.add(new RemoteMethodArg(h.value(), index, false));
+					} else if (ca == HeaderIfNE.class) {
+						Header h = (Header)a;
+						annotated = headerArgs.add(new RemoteMethodArg(h.value(), index, true));
+					} else if (ca == Body.class) {
+						annotated = true;
+						if (bodyArg == null)
+							bodyArg = index;
+						else
+							throw new RemoteableMetadataException(m, "Multiple @Body parameters found.  Only one can be specified per Java method.");
+					}
+				}
+				if (! annotated)
+					otherArgs.add(index);
+				index++;
+			}
+
+			if (bodyArg != null && otherArgs.size() > 0)
+				throw new RemoteableMetadataException(m, "@Body and non-annotated parameters found together.  Non-annotated parameters cannot be used when @Body is used.");
+		}
+	}
+
+	/**
+	 * Returns the value of the {@link RemoteMethod#httpMethod()} annotation on this Java method.
+	 * @return The value of the {@link RemoteMethod#httpMethod()} annotation, never <jk>null</jk>.
+	 */
+	public String getHttpMethod() {
+		return httpMethod;
+	}
+
+	/**
+	 * Returns the absolute URL of the REST interface invoked by this Java method.
+	 * @return The absolute URL of the REST interface, never <jk>null</jk>.
+	 */
+	public String getUrl() {
+		return url;
+	}
+
+	/**
+	 * Returns the {@link Query @Query} annotated arguments on this Java method.
+	 * @return A map of {@link Query#value() @Query.value()} names to zero-indexed argument indices.
+	 */
+	public RemoteMethodArg[] getQueryArgs() {
+		return queryArgs;
+	}
+
+	/**
+	 * Returns the {@link FormData @FormData} annotated arguments on this Java method.
+	 * @return A map of {@link FormData#value() @FormData.value()} names to zero-indexed argument indices.
+	 */
+	public RemoteMethodArg[] getFormDataArgs() {
+		return formDataArgs;
+	}
+
+	/**
+	 * Returns the {@link Header @Header} annotated arguments on this Java method.
+	 * @return A map of {@link Header#value() @Header.value()} names to zero-indexed argument indices.
+	 */
+	public RemoteMethodArg[] getHeaderArgs() {
+		return headerArgs;
+	}
+
+	/**
+	 * Returns the remaining non-annotated arguments on this Java method.
+	 * @return A list of zero-indexed argument indices.
+	 */
+	public Integer[] getOtherArgs() {
+		return otherArgs;
+	}
+
+	/**
+	 * Returns the argument annotated with {@link Body @Body}.
+	 * @return A index of the argument with the {@link Body @Body} annotation, or <jk>null</jk> if no argument exists.
+	 */
+	public Integer getBodyArg() {
+		return bodyArg;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/remoteable/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/remoteable/package.html b/juneau-core/src/main/java/org/apache/juneau/remoteable/package.html
new file mode 100644
index 0000000..45bc0e9
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/remoteable/package.html
@@ -0,0 +1,72 @@
+<!DOCTYPE HTML>
+<!--
+/***************************************************************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *  
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations under the License.
+ *
+ ***************************************************************************************************************************/
+ -->
+<html>
+<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<style type="text/css">
+		/* For viewing in Page Designer */
+		@IMPORT url("../../../../../../javadoc.css");
+
+		/* For viewing in REST interface */
+		@IMPORT url("../htdocs/javadoc.css");
+		body { 
+			margin: 20px; 
+		}	
+	</style>
+	<script>
+		/* Replace all @code and @link tags. */	
+		window.onload = function() {
+			document.body.innerHTML = document.body.innerHTML.replace(/\{\@code ([^\}]+)\}/g, '<code>$1</code>');
+			document.body.innerHTML = document.body.innerHTML.replace(/\{\@link (([^\}]+)\.)?([^\.\}]+)\}/g, '<code>$3</code>');
+		}
+	</script>
+</head>
+<body>
+<p>Remoteable interface proxies</p>
+<script>
+	function toggle(x) {
+		var div = x.nextSibling;
+		while (div != null && div.nodeType != 1)
+			div = div.nextSibling;
+		if (div != null) {
+			var d = div.style.display;
+			if (d == 'block' || d == '') {
+				div.style.display = 'none';
+				x.className += " closed";
+			} else {
+				div.style.display = 'block';
+				x.className = x.className.replace(/(?:^|\s)closed(?!\S)/g , '' );
+			}
+		}
+	}
+</script>
+
+<a id='TOC'></a><h5 class='toc'>Table of Contents</h5>
+<ol class='toc'>
+	<li><p><a class='doclink' href='#Overview'>Remoteable support overview</a></p> 
+</ol>
+
+<!-- ======================================================================================================== -->
+<a id="Overview"></a>
+<h2 class='topic' onclick='toggle(this)'>1 - Remoteable support overview</h2>
+<div class='topic'>
+	TODO <i>(sorry)</i>
+</div>
+<p align="center"><i><b>*** f�n ***</b></i></p>
+
+</body>
+</html>
\ No newline at end of file


[4/7] incubator-juneau git commit: Support for 3rd-party proxy interfaces.

Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ThirdPartyProxyResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ThirdPartyProxyResource.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ThirdPartyProxyResource.java
new file mode 100644
index 0000000..1d583ce
--- /dev/null
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ThirdPartyProxyResource.java
@@ -0,0 +1,1218 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.rest.test;
+
+import static java.util.Arrays.*;
+import static org.apache.juneau.rest.test.TestUtils.*;
+import static org.apache.juneau.rest.test.pojos.Constants.*;
+import static org.junit.Assert.*;
+
+import java.util.*;
+
+import org.apache.juneau.microservice.*;
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.test.pojos.*;
+import org.apache.juneau.utils.*;
+
+/**
+ * JUnit automated testcase resource.
+ */
+@RestResource(
+	path="/testThirdPartyProxy"
+)
+@SuppressWarnings("serial")
+public class ThirdPartyProxyResource extends ResourceJena {
+
+	//--------------------------------------------------------------------------------
+	// Header tests
+	//--------------------------------------------------------------------------------
+
+	@RestMethod(name="GET", path="/primitiveHeaders")
+	public String primitiveHeaders(
+			@Header("h1") String h1,
+			@Header("h1n") String h1n,
+			@Header("h2") int h2,
+			@Header("h3") Integer h3,
+			@Header("h3n") Integer h3n,
+			@Header("h4") Boolean h4,
+			@Header("h5") float h5,
+			@Header("h6") Float h6
+		) throws Exception {
+
+		assertEquals(h1, "foo");
+		assertNull(h1n);
+		assertEquals(123, h2);
+		assertEquals(123, (int)h3);
+		assertNull(h3n);
+		assertTrue(h4);
+		assertTrue(1f == h5);
+		assertTrue(1f == h6);
+		return "OK";
+	}
+
+	@RestMethod(name="GET", path="/primitiveCollectionHeaders")
+	public String primitiveCollectionHeaders(
+			@Header("h1") int[][][] h1,
+			@Header("h2") Integer[][][] h2,
+			@Header("h3") String[][][] h3,
+			@Header("h4") List<Integer> h4,
+			@Header("h5") List<List<List<Integer>>> h5,
+			@Header("h6") List<Integer[][][]> h6,
+			@Header("h7") List<int[][][]> h7,
+			@Header("h8") List<String> h8
+		) throws Exception {
+
+		assertObjectEquals("[[[1,2],null],null]", h1);
+		assertObjectEquals("[[[1,null],null],null]", h2);
+		assertObjectEquals("[[['foo',null],null],null]", h3);
+		assertObjectEquals("[1,null]", h4);
+		assertObjectEquals("[[[1,null],null],null]", h5);
+		assertObjectEquals("[[[[1,null],null],null],null]", h6);
+		assertObjectEquals("[[[[1,2],null],null],null]", h7);
+		assertObjectEquals("['foo','bar',null]", h8);
+
+		assertClass(Integer.class, h4.get(0));
+		assertClass(Integer.class, h5.get(0).get(0).get(0));
+		assertClass(Integer[][][].class, h6.get(0));
+		assertClass(int[][][].class, h7.get(0));
+
+		return "OK";
+	}
+
+	@RestMethod(name="GET", path="/beanHeaders")
+	public String beanHeaders(
+			@Header("h1") ABean h1,
+			@Header("h1n") ABean h1n,
+			@Header("h2") ABean[][][] h2,
+			@Header("h3") List<ABean> h3,
+			@Header("h4") List<ABean[][][]> h4,
+			@Header("h5") Map<String,ABean> h5,
+			@Header("h6") Map<String,List<ABean>> h6,
+			@Header("h7") Map<String,List<ABean[][][]>> h7,
+			@Header("h8") Map<Integer,List<ABean>> h8
+		) throws Exception {
+
+		assertObjectEquals("{a:1,b:'foo'}", h1);
+		assertNull(h1n);
+		assertObjectEquals("[[[{a:1,b:'foo'},null],null],null]", h2);
+		assertObjectEquals("[{a:1,b:'foo'},null]", h3);
+		assertObjectEquals("[[[[{a:1,b:'foo'},null],null],null],null]", h4);
+		assertObjectEquals("{foo:{a:1,b:'foo'}}", h5);
+		assertObjectEquals("{foo:[{a:1,b:'foo'}]}", h6);
+		assertObjectEquals("{foo:[[[[{a:1,b:'foo'},null],null],null],null]}", h7);
+		assertObjectEquals("{'1':[{a:1,b:'foo'}]}", h8);
+
+		assertClass(ABean.class, h3.get(0));
+		assertClass(ABean[][][].class, h4.get(0));
+		assertClass(ABean.class, h5.get("foo"));
+		assertClass(ABean.class, h6.get("foo").get(0));
+		assertClass(ABean[][][].class, h7.get("foo").get(0));
+		assertClass(Integer.class, h8.keySet().iterator().next());
+		assertClass(ABean.class, h8.values().iterator().next().get(0));
+		return "OK";
+	}
+
+	@RestMethod(name="GET", path="/typedBeanHeaders")
+	public String typedBeanHeaders(
+			@Header("h1") TypedBean h1,
+			@Header("h1n") TypedBean h1n,
+			@Header("h2") TypedBean[][][] h2,
+			@Header("h3") List<TypedBean> h3,
+			@Header("h4") List<TypedBean[][][]> h4,
+			@Header("h5") Map<String,TypedBean> h5,
+			@Header("h6") Map<String,List<TypedBean>> h6,
+			@Header("h7") Map<String,List<TypedBean[][][]>> h7,
+			@Header("h8") Map<Integer,List<TypedBean>> h8
+		) throws Exception {
+
+		assertObjectEquals("{_type:'TypedBeanImpl',a:1,b:'foo'}", h1);
+		assertNull(h1n);
+		assertObjectEquals("[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null]", h2);
+		assertObjectEquals("[{_type:'TypedBeanImpl',a:1,b:'foo'},null]", h3);
+		assertObjectEquals("[[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null],null]", h4);
+		assertObjectEquals("{foo:{_type:'TypedBeanImpl',a:1,b:'foo'}}", h5);
+		assertObjectEquals("{foo:[{_type:'TypedBeanImpl',a:1,b:'foo'}]}", h6);
+		assertObjectEquals("{foo:[[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null],null]}", h7);
+		assertObjectEquals("{'1':[{_type:'TypedBeanImpl',a:1,b:'foo'}]}", h8);
+
+		assertClass(TypedBeanImpl.class, h1);
+		assertClass(TypedBeanImpl.class, h2[0][0][0]);
+		assertClass(TypedBeanImpl.class, h3.get(0));
+		assertClass(TypedBeanImpl.class, h4.get(0)[0][0][0]);
+		assertClass(TypedBeanImpl.class, h5.get("foo"));
+		assertClass(TypedBeanImpl.class, h6.get("foo").get(0));
+		assertClass(TypedBeanImpl.class, h7.get("foo").get(0)[0][0][0]);
+		assertClass(Integer.class, h8.keySet().iterator().next());
+		assertClass(TypedBeanImpl.class, h8.get(1).get(0));
+
+		return "OK";
+	}
+
+	@RestMethod(name="GET", path="/swappedPojoHeaders")
+	public String swappedPojoHeaders(
+			@Header("h1") SwappedPojo h1,
+			@Header("h2") SwappedPojo[][][] h2,
+			@Header("h3") Map<SwappedPojo,SwappedPojo> h3,
+			@Header("h4") Map<SwappedPojo,SwappedPojo[][][]> h4
+		) throws Exception {
+
+		assertObjectEquals("'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/'", h1);
+		assertObjectEquals("[[['swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/',null],null],null]", h2);
+		assertObjectEquals("{'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/':'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/'}", h3);
+		assertObjectEquals("{'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/':[[['swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/',null],null],null]}", h4);
+
+		assertClass(SwappedPojo.class, h1);
+		assertClass(SwappedPojo.class, h2[0][0][0]);
+		assertClass(SwappedPojo.class, h3.keySet().iterator().next());
+		assertClass(SwappedPojo.class, h3.values().iterator().next());
+		assertClass(SwappedPojo.class, h4.keySet().iterator().next());
+		assertClass(SwappedPojo.class, h4.values().iterator().next()[0][0][0]);
+
+		return "OK";
+	}
+
+	@RestMethod(name="GET", path="/implicitSwappedPojoHeaders")
+	public String implicitSwappedPojoHeaders(
+			@Header("h1") ImplicitSwappedPojo h1,
+			@Header("h2") ImplicitSwappedPojo[][][] h2,
+			@Header("h3") Map<ImplicitSwappedPojo,ImplicitSwappedPojo> h3,
+			@Header("h4") Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> h4
+		) throws Exception {
+
+		assertObjectEquals("'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/'", h1);
+		assertObjectEquals("[[['swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/',null],null],null]", h2);
+		assertObjectEquals("{'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/':'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/'}", h3);
+		assertObjectEquals("{'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/':[[['swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/',null],null],null]}", h4);
+
+		assertClass(ImplicitSwappedPojo.class, h1);
+		assertClass(ImplicitSwappedPojo.class, h2[0][0][0]);
+		assertClass(ImplicitSwappedPojo.class, h3.keySet().iterator().next());
+		assertClass(ImplicitSwappedPojo.class, h3.values().iterator().next());
+		assertClass(ImplicitSwappedPojo.class, h4.keySet().iterator().next());
+		assertClass(ImplicitSwappedPojo.class, h4.values().iterator().next()[0][0][0]);
+
+		return "OK";
+	}
+
+	@RestMethod(name="GET", path="/enumHeaders")
+	public String enumHeaders(
+			@Header("h1") TestEnum h1,
+			@Header("h1n") TestEnum h1n,
+			@Header("h2") TestEnum[][][] h2,
+			@Header("h3") List<TestEnum> h3,
+			@Header("h4") List<List<List<TestEnum>>> h4,
+			@Header("h5") List<TestEnum[][][]> h5,
+			@Header("h6") Map<TestEnum,TestEnum> h6,
+			@Header("h7") Map<TestEnum,TestEnum[][][]> h7,
+			@Header("h8") Map<TestEnum,List<TestEnum[][][]>> h8
+		) throws Exception {
+
+		assertEquals(TestEnum.TWO, h1);
+		assertNull(h1n);
+		assertObjectEquals("[[['TWO',null],null],null]", h2);
+		assertObjectEquals("['TWO',null]", h3);
+		assertObjectEquals("[[['TWO',null],null],null]", h4);
+		assertObjectEquals("[[[['TWO',null],null],null],null]", h5);
+		assertObjectEquals("{ONE:'TWO'}", h6);
+		assertObjectEquals("{ONE:[[['TWO',null],null],null]}", h7);
+		assertObjectEquals("{ONE:[[[['TWO',null],null],null],null]}", h8);
+
+		assertClass(TestEnum.class, h3.get(0));
+		assertClass(TestEnum.class, h4.get(0).get(0).get(0));
+		assertClass(TestEnum[][][].class, h5.get(0));
+		assertClass(TestEnum.class, h6.keySet().iterator().next());
+		assertClass(TestEnum.class, h6.values().iterator().next());
+		assertClass(TestEnum.class, h7.keySet().iterator().next());
+		assertClass(TestEnum[][][].class, h7.values().iterator().next());
+		assertClass(TestEnum.class, h8.keySet().iterator().next());
+		assertClass(TestEnum[][][].class, h8.values().iterator().next().get(0));
+
+		return "OK";
+	}
+
+	//--------------------------------------------------------------------------------
+	// Query tests
+	//--------------------------------------------------------------------------------
+
+	@RestMethod(name="GET", path="/primitiveQueries")
+	public String primitiveQueries(
+			@Query("h1") String h1,
+			@Query("h1n") String h1n,
+			@Query("h2") int h2,
+			@Query("h3") Integer h3,
+			@Query("h3n") Integer h3n,
+			@Query("h4") Boolean h4,
+			@Query("h5") float h5,
+			@Query("h6") Float h6
+		) throws Exception {
+
+		assertEquals(h1, "foo");
+		assertNull(h1n);
+		assertEquals(123, h2);
+		assertEquals(123, (int)h3);
+		assertNull(h3n);
+		assertTrue(h4);
+		assertTrue(1f == h5);
+		assertTrue(1f == h6);
+		return "OK";
+	}
+
+	@RestMethod(name="GET", path="/primitiveCollectionQueries")
+	public String primitiveCollectionQueries(
+			@Query("h1") int[][][] h1,
+			@Query("h2") Integer[][][] h2,
+			@Query("h3") String[][][] h3,
+			@Query("h4") List<Integer> h4,
+			@Query("h5") List<List<List<Integer>>> h5,
+			@Query("h6") List<Integer[][][]> h6,
+			@Query("h7") List<int[][][]> h7,
+			@Query("h8") List<String> h8
+		) throws Exception {
+
+		assertObjectEquals("[[[1,2],null],null]", h1);
+		assertObjectEquals("[[[1,null],null],null]", h2);
+		assertObjectEquals("[[['foo',null],null],null]", h3);
+		assertObjectEquals("[1,null]", h4);
+		assertObjectEquals("[[[1,null],null],null]", h5);
+		assertObjectEquals("[[[[1,null],null],null],null]", h6);
+		assertObjectEquals("[[[[1,2],null],null],null]", h7);
+		assertObjectEquals("['foo','bar',null]", h8);
+
+		assertClass(Integer.class, h4.get(0));
+		assertClass(Integer.class, h5.get(0).get(0).get(0));
+		assertClass(Integer[][][].class, h6.get(0));
+		assertClass(int[][][].class, h7.get(0));
+
+		return "OK";
+	}
+
+	@RestMethod(name="GET", path="/beanQueries")
+	public String beanQueries(
+			@Query("h1") ABean h1,
+			@Query("h1n") ABean h1n,
+			@Query("h2") ABean[][][] h2,
+			@Query("h3") List<ABean> h3,
+			@Query("h4") List<ABean[][][]> h4,
+			@Query("h5") Map<String,ABean> h5,
+			@Query("h6") Map<String,List<ABean>> h6,
+			@Query("h7") Map<String,List<ABean[][][]>> h7,
+			@Query("h8") Map<Integer,List<ABean>> h8
+		) throws Exception {
+
+		assertObjectEquals("{a:1,b:'foo'}", h1);
+		assertNull(h1n);
+		assertObjectEquals("[[[{a:1,b:'foo'},null],null],null]", h2);
+		assertObjectEquals("[{a:1,b:'foo'},null]", h3);
+		assertObjectEquals("[[[[{a:1,b:'foo'},null],null],null],null]", h4);
+		assertObjectEquals("{foo:{a:1,b:'foo'}}", h5);
+		assertObjectEquals("{foo:[{a:1,b:'foo'}]}", h6);
+		assertObjectEquals("{foo:[[[[{a:1,b:'foo'},null],null],null],null]}", h7);
+		assertObjectEquals("{'1':[{a:1,b:'foo'}]}", h8);
+
+		assertClass(ABean.class, h3.get(0));
+		assertClass(ABean[][][].class, h4.get(0));
+		assertClass(ABean.class, h5.get("foo"));
+		assertClass(ABean.class, h6.get("foo").get(0));
+		assertClass(ABean[][][].class, h7.get("foo").get(0));
+		assertClass(Integer.class, h8.keySet().iterator().next());
+		assertClass(ABean.class, h8.values().iterator().next().get(0));
+		return "OK";
+	}
+
+	@RestMethod(name="GET", path="/typedBeanQueries")
+	public String typedBeanQueries(
+			@Query("h1") TypedBean h1,
+			@Query("h1n") TypedBean h1n,
+			@Query("h2") TypedBean[][][] h2,
+			@Query("h3") List<TypedBean> h3,
+			@Query("h4") List<TypedBean[][][]> h4,
+			@Query("h5") Map<String,TypedBean> h5,
+			@Query("h6") Map<String,List<TypedBean>> h6,
+			@Query("h7") Map<String,List<TypedBean[][][]>> h7,
+			@Query("h8") Map<Integer,List<TypedBean>> h8
+		) throws Exception {
+
+		assertObjectEquals("{_type:'TypedBeanImpl',a:1,b:'foo'}", h1);
+		assertNull(h1n);
+		assertObjectEquals("[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null]", h2);
+		assertObjectEquals("[{_type:'TypedBeanImpl',a:1,b:'foo'},null]", h3);
+		assertObjectEquals("[[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null],null]", h4);
+		assertObjectEquals("{foo:{_type:'TypedBeanImpl',a:1,b:'foo'}}", h5);
+		assertObjectEquals("{foo:[{_type:'TypedBeanImpl',a:1,b:'foo'}]}", h6);
+		assertObjectEquals("{foo:[[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null],null]}", h7);
+		assertObjectEquals("{'1':[{_type:'TypedBeanImpl',a:1,b:'foo'}]}", h8);
+
+		assertClass(TypedBeanImpl.class, h1);
+		assertClass(TypedBeanImpl.class, h2[0][0][0]);
+		assertClass(TypedBeanImpl.class, h3.get(0));
+		assertClass(TypedBeanImpl.class, h4.get(0)[0][0][0]);
+		assertClass(TypedBeanImpl.class, h5.get("foo"));
+		assertClass(TypedBeanImpl.class, h6.get("foo").get(0));
+		assertClass(TypedBeanImpl.class, h7.get("foo").get(0)[0][0][0]);
+		assertClass(Integer.class, h8.keySet().iterator().next());
+		assertClass(TypedBeanImpl.class, h8.get(1).get(0));
+
+		return "OK";
+	}
+
+	@RestMethod(name="GET", path="/swappedPojoQueries")
+	public String swappedPojoQueries(
+			@Query("h1") SwappedPojo h1,
+			@Query("h2") SwappedPojo[][][] h2,
+			@Query("h3") Map<SwappedPojo,SwappedPojo> h3,
+			@Query("h4") Map<SwappedPojo,SwappedPojo[][][]> h4
+		) throws Exception {
+
+		assertObjectEquals("'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/'", h1);
+		assertObjectEquals("[[['swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/',null],null],null]", h2);
+		assertObjectEquals("{'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/':'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/'}", h3);
+		assertObjectEquals("{'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/':[[['swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/',null],null],null]}", h4);
+
+		assertClass(SwappedPojo.class, h1);
+		assertClass(SwappedPojo.class, h2[0][0][0]);
+		assertClass(SwappedPojo.class, h3.keySet().iterator().next());
+		assertClass(SwappedPojo.class, h3.values().iterator().next());
+		assertClass(SwappedPojo.class, h4.keySet().iterator().next());
+		assertClass(SwappedPojo.class, h4.values().iterator().next()[0][0][0]);
+
+		return "OK";
+	}
+
+	@RestMethod(name="GET", path="/implicitSwappedPojoQueries")
+	public String implicitSwappedPojoQueries(
+			@Query("h1") ImplicitSwappedPojo h1,
+			@Query("h2") ImplicitSwappedPojo[][][] h2,
+			@Query("h3") Map<ImplicitSwappedPojo,ImplicitSwappedPojo> h3,
+			@Query("h4") Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> h4
+		) throws Exception {
+
+		assertObjectEquals("'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/'", h1);
+		assertObjectEquals("[[['swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/',null],null],null]", h2);
+		assertObjectEquals("{'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/':'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/'}", h3);
+		assertObjectEquals("{'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/':[[['swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/',null],null],null]}", h4);
+
+		assertClass(ImplicitSwappedPojo.class, h1);
+		assertClass(ImplicitSwappedPojo.class, h2[0][0][0]);
+		assertClass(ImplicitSwappedPojo.class, h3.keySet().iterator().next());
+		assertClass(ImplicitSwappedPojo.class, h3.values().iterator().next());
+		assertClass(ImplicitSwappedPojo.class, h4.keySet().iterator().next());
+		assertClass(ImplicitSwappedPojo.class, h4.values().iterator().next()[0][0][0]);
+
+		return "OK";
+	}
+
+	@RestMethod(name="GET", path="/enumQueries")
+	public String enumQueries(
+			@Query("h1") TestEnum h1,
+			@Query("h1n") TestEnum h1n,
+			@Query("h2") TestEnum[][][] h2,
+			@Query("h3") List<TestEnum> h3,
+			@Query("h4") List<List<List<TestEnum>>> h4,
+			@Query("h5") List<TestEnum[][][]> h5,
+			@Query("h6") Map<TestEnum,TestEnum> h6,
+			@Query("h7") Map<TestEnum,TestEnum[][][]> h7,
+			@Query("h8") Map<TestEnum,List<TestEnum[][][]>> h8
+		) throws Exception {
+
+		assertEquals(TestEnum.TWO, h1);
+		assertNull(h1n);
+		assertObjectEquals("[[['TWO',null],null],null]", h2);
+		assertObjectEquals("['TWO',null]", h3);
+		assertObjectEquals("[[['TWO',null],null],null]", h4);
+		assertObjectEquals("[[[['TWO',null],null],null],null]", h5);
+		assertObjectEquals("{ONE:'TWO'}", h6);
+		assertObjectEquals("{ONE:[[['TWO',null],null],null]}", h7);
+		assertObjectEquals("{ONE:[[[['TWO',null],null],null],null]}", h8);
+
+		assertClass(TestEnum.class, h3.get(0));
+		assertClass(TestEnum.class, h4.get(0).get(0).get(0));
+		assertClass(TestEnum[][][].class, h5.get(0));
+		assertClass(TestEnum.class, h6.keySet().iterator().next());
+		assertClass(TestEnum.class, h6.values().iterator().next());
+		assertClass(TestEnum.class, h7.keySet().iterator().next());
+		assertClass(TestEnum[][][].class, h7.values().iterator().next());
+		assertClass(TestEnum.class, h8.keySet().iterator().next());
+		assertClass(TestEnum[][][].class, h8.values().iterator().next().get(0));
+
+		return "OK";
+	}
+
+	//--------------------------------------------------------------------------------
+	// FormData tests
+	//--------------------------------------------------------------------------------
+
+	@RestMethod(name="POST", path="/primitiveFormData")
+	public String primitiveFormData(
+			@FormData("h1") String h1,
+			@FormData("h1n") String h1n,
+			@FormData("h2") int h2,
+			@FormData("h3") Integer h3,
+			@FormData("h3n") Integer h3n,
+			@FormData("h4") Boolean h4,
+			@FormData("h5") float h5,
+			@FormData("h6") Float h6
+		) throws Exception {
+
+		assertEquals("foo", h1);
+		assertNull(h1n);
+		assertEquals(123, h2);
+		assertEquals(123, (int)h3);
+		assertNull(h3n);
+		assertTrue(h4);
+		assertTrue(1f == h5);
+		assertTrue(1f == h6);
+		return "OK";
+	}
+
+	@RestMethod(name="POST", path="/primitiveCollectionFormData")
+	public String primitiveCollectionFormData(
+			@FormData("h1") int[][][] h1,
+			@FormData("h2") Integer[][][] h2,
+			@FormData("h3") String[][][] h3,
+			@FormData("h4") List<Integer> h4,
+			@FormData("h5") List<List<List<Integer>>> h5,
+			@FormData("h6") List<Integer[][][]> h6,
+			@FormData("h7") List<int[][][]> h7,
+			@FormData("h8") List<String> h8
+		) throws Exception {
+
+		assertObjectEquals("[[[1,2],null],null]", h1);
+		assertObjectEquals("[[[1,null],null],null]", h2);
+		assertObjectEquals("[[['foo',null],null],null]", h3);
+		assertObjectEquals("[1,null]", h4);
+		assertObjectEquals("[[[1,null],null],null]", h5);
+		assertObjectEquals("[[[[1,null],null],null],null]", h6);
+		assertObjectEquals("[[[[1,2],null],null],null]", h7);
+		assertObjectEquals("['foo','bar',null]", h8);
+
+		assertClass(Integer.class, h4.get(0));
+		assertClass(Integer.class, h5.get(0).get(0).get(0));
+		assertClass(Integer[][][].class, h6.get(0));
+		assertClass(int[][][].class, h7.get(0));
+
+		return "OK";
+	}
+
+	@RestMethod(name="POST", path="/beanFormData")
+	public String beanFormData(
+			@FormData("h1") ABean h1,
+			@FormData("h1n") ABean h1n,
+			@FormData("h2") ABean[][][] h2,
+			@FormData("h3") List<ABean> h3,
+			@FormData("h4") List<ABean[][][]> h4,
+			@FormData("h5") Map<String,ABean> h5,
+			@FormData("h6") Map<String,List<ABean>> h6,
+			@FormData("h7") Map<String,List<ABean[][][]>> h7,
+			@FormData("h8") Map<Integer,List<ABean>> h8
+		) throws Exception {
+
+		assertObjectEquals("{a:1,b:'foo'}", h1);
+		assertNull(h1n);
+		assertObjectEquals("[[[{a:1,b:'foo'},null],null],null]", h2);
+		assertObjectEquals("[{a:1,b:'foo'},null]", h3);
+		assertObjectEquals("[[[[{a:1,b:'foo'},null],null],null],null]", h4);
+		assertObjectEquals("{foo:{a:1,b:'foo'}}", h5);
+		assertObjectEquals("{foo:[{a:1,b:'foo'}]}", h6);
+		assertObjectEquals("{foo:[[[[{a:1,b:'foo'},null],null],null],null]}", h7);
+		assertObjectEquals("{'1':[{a:1,b:'foo'}]}", h8);
+
+		assertClass(ABean.class, h3.get(0));
+		assertClass(ABean[][][].class, h4.get(0));
+		assertClass(ABean.class, h5.get("foo"));
+		assertClass(ABean.class, h6.get("foo").get(0));
+		assertClass(ABean[][][].class, h7.get("foo").get(0));
+		assertClass(Integer.class, h8.keySet().iterator().next());
+		assertClass(ABean.class, h8.values().iterator().next().get(0));
+		return "OK";
+	}
+
+	@RestMethod(name="POST", path="/typedBeanFormData")
+	public String typedBeanFormData(
+			@FormData("h1") TypedBean h1,
+			@FormData("h1n") TypedBean h1n,
+			@FormData("h2") TypedBean[][][] h2,
+			@FormData("h3") List<TypedBean> h3,
+			@FormData("h4") List<TypedBean[][][]> h4,
+			@FormData("h5") Map<String,TypedBean> h5,
+			@FormData("h6") Map<String,List<TypedBean>> h6,
+			@FormData("h7") Map<String,List<TypedBean[][][]>> h7,
+			@FormData("h8") Map<Integer,List<TypedBean>> h8
+		) throws Exception {
+
+		assertObjectEquals("{_type:'TypedBeanImpl',a:1,b:'foo'}", h1);
+		assertNull(h1n);
+		assertObjectEquals("[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null]", h2);
+		assertObjectEquals("[{_type:'TypedBeanImpl',a:1,b:'foo'},null]", h3);
+		assertObjectEquals("[[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null],null]", h4);
+		assertObjectEquals("{foo:{_type:'TypedBeanImpl',a:1,b:'foo'}}", h5);
+		assertObjectEquals("{foo:[{_type:'TypedBeanImpl',a:1,b:'foo'}]}", h6);
+		assertObjectEquals("{foo:[[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null],null]}", h7);
+		assertObjectEquals("{'1':[{_type:'TypedBeanImpl',a:1,b:'foo'}]}", h8);
+
+		assertClass(TypedBeanImpl.class, h1);
+		assertClass(TypedBeanImpl.class, h2[0][0][0]);
+		assertClass(TypedBeanImpl.class, h3.get(0));
+		assertClass(TypedBeanImpl.class, h4.get(0)[0][0][0]);
+		assertClass(TypedBeanImpl.class, h5.get("foo"));
+		assertClass(TypedBeanImpl.class, h6.get("foo").get(0));
+		assertClass(TypedBeanImpl.class, h7.get("foo").get(0)[0][0][0]);
+		assertClass(Integer.class, h8.keySet().iterator().next());
+		assertClass(TypedBeanImpl.class, h8.get(1).get(0));
+
+		return "OK";
+	}
+
+	@RestMethod(name="POST", path="/swappedPojoFormData")
+	public String swappedPojoFormData(
+			@FormData("h1") SwappedPojo h1,
+			@FormData("h2") SwappedPojo[][][] h2,
+			@FormData("h3") Map<SwappedPojo,SwappedPojo> h3,
+			@FormData("h4") Map<SwappedPojo,SwappedPojo[][][]> h4
+		) throws Exception {
+
+		assertObjectEquals("'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/'", h1);
+		assertObjectEquals("[[['swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/',null],null],null]", h2);
+		assertObjectEquals("{'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/':'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/'}", h3);
+		assertObjectEquals("{'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/':[[['swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/',null],null],null]}", h4);
+
+		assertClass(SwappedPojo.class, h1);
+		assertClass(SwappedPojo.class, h2[0][0][0]);
+		assertClass(SwappedPojo.class, h3.keySet().iterator().next());
+		assertClass(SwappedPojo.class, h3.values().iterator().next());
+		assertClass(SwappedPojo.class, h4.keySet().iterator().next());
+		assertClass(SwappedPojo.class, h4.values().iterator().next()[0][0][0]);
+
+		return "OK";
+	}
+
+	@RestMethod(name="POST", path="/implicitSwappedPojoFormData")
+	public String implicitSwappedPojoFormData(
+			@FormData("h1") ImplicitSwappedPojo h1,
+			@FormData("h2") ImplicitSwappedPojo[][][] h2,
+			@FormData("h3") Map<ImplicitSwappedPojo,ImplicitSwappedPojo> h3,
+			@FormData("h4") Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> h4
+		) throws Exception {
+
+		assertObjectEquals("'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/'", h1);
+		assertObjectEquals("[[['swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/',null],null],null]", h2);
+		assertObjectEquals("{'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/':'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/'}", h3);
+		assertObjectEquals("{'swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/':[[['swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/',null],null],null]}", h4);
+
+		assertClass(ImplicitSwappedPojo.class, h1);
+		assertClass(ImplicitSwappedPojo.class, h2[0][0][0]);
+		assertClass(ImplicitSwappedPojo.class, h3.keySet().iterator().next());
+		assertClass(ImplicitSwappedPojo.class, h3.values().iterator().next());
+		assertClass(ImplicitSwappedPojo.class, h4.keySet().iterator().next());
+		assertClass(ImplicitSwappedPojo.class, h4.values().iterator().next()[0][0][0]);
+
+		return "OK";
+	}
+
+	@RestMethod(name="POST", path="/enumFormData")
+	public String enumFormData(
+			@FormData("h1") TestEnum h1,
+			@FormData("h1n") TestEnum h1n,
+			@FormData("h2") TestEnum[][][] h2,
+			@FormData("h3") List<TestEnum> h3,
+			@FormData("h4") List<List<List<TestEnum>>> h4,
+			@FormData("h5") List<TestEnum[][][]> h5,
+			@FormData("h6") Map<TestEnum,TestEnum> h6,
+			@FormData("h7") Map<TestEnum,TestEnum[][][]> h7,
+			@FormData("h8") Map<TestEnum,List<TestEnum[][][]>> h8
+		) throws Exception {
+
+		assertEquals(TestEnum.TWO, h1);
+		assertNull(h1n);
+		assertObjectEquals("[[['TWO',null],null],null]", h2);
+		assertObjectEquals("['TWO',null]", h3);
+		assertObjectEquals("[[['TWO',null],null],null]", h4);
+		assertObjectEquals("[[[['TWO',null],null],null],null]", h5);
+		assertObjectEquals("{ONE:'TWO'}", h6);
+		assertObjectEquals("{ONE:[[['TWO',null],null],null]}", h7);
+		assertObjectEquals("{ONE:[[[['TWO',null],null],null],null]}", h8);
+
+		assertClass(TestEnum.class, h3.get(0));
+		assertClass(TestEnum.class, h4.get(0).get(0).get(0));
+		assertClass(TestEnum[][][].class, h5.get(0));
+		assertClass(TestEnum.class, h6.keySet().iterator().next());
+		assertClass(TestEnum.class, h6.values().iterator().next());
+		assertClass(TestEnum.class, h7.keySet().iterator().next());
+		assertClass(TestEnum[][][].class, h7.values().iterator().next());
+		assertClass(TestEnum.class, h8.keySet().iterator().next());
+		assertClass(TestEnum[][][].class, h8.values().iterator().next().get(0));
+
+		return "OK";
+	}
+
+	//--------------------------------------------------------------------------------
+	// Test return types.
+	//--------------------------------------------------------------------------------
+
+	// Various primitives
+
+	@RestMethod(name="GET", path="/returnVoid")
+	public void returnVoid() {
+	}
+
+	@RestMethod(name="GET", path="/returnInteger")
+	public Integer returnInteger() {
+		return 1;
+	}
+
+	@RestMethod(name="GET", path="/returnInt")
+	public int returnInt() {
+		return 1;
+	}
+
+	@RestMethod(name="GET", path="/returnBoolean")
+	public boolean returnBoolean() {
+		return true;
+	}
+
+	@RestMethod(name="GET", path="/returnFloat")
+	public float returnFloat() {
+		return 1f;
+	}
+
+	@RestMethod(name="GET", path="/returnFloatObject")
+	public Float returnFloatObject() {
+		return 1f;
+	}
+
+	@RestMethod(name="GET", path="/returnString")
+	public String returnString() {
+		return "foobar";
+	}
+
+	@RestMethod(name="GET", path="/returnNullString")
+	public String returnNullString() {
+		return null;
+	}
+
+	@RestMethod(name="GET", path="/returnInt3dArray")
+	public int[][][] returnInt3dArray() {
+		return new int[][][]{{{1,2},null},null};
+	}
+
+	@RestMethod(name="GET", path="/returnInteger3dArray")
+	public Integer[][][] returnInteger3dArray() {
+		return new Integer[][][]{{{1,null},null},null};
+	}
+
+	@RestMethod(name="GET", path="/returnString3dArray")
+	public String[][][] returnString3dArray() {
+		return new String[][][]{{{"foo","bar",null},null},null};
+	}
+
+	@RestMethod(name="GET", path="/returnIntegerList")
+	public List<Integer> returnIntegerList() {
+		return asList(new Integer[]{1,null});
+	}
+
+	@RestMethod(name="GET", path="/returnInteger3dList")
+	public List<List<List<Integer>>> returnInteger3dList() {
+		return new AList<List<List<Integer>>>()
+		.append(
+			new AList<List<Integer>>()
+			.append(
+				new AList<Integer>().append(1).append(null)
+			)
+			.append(null)
+		)
+		.append(null);
+	}
+
+	@RestMethod(name="GET", path="/returnInteger1d3dList")
+	public List<Integer[][][]> returnInteger1d3dList() {
+		return new AList<Integer[][][]>().append(new Integer[][][]{{{1,null},null},null}).append(null);
+	}
+
+	@RestMethod(name="GET", path="/returnInt1d3dList")
+	public List<int[][][]> returnInt1d3dList() {
+		return new AList<int[][][]>().append(new int[][][]{{{1,2},null},null}).append(null);
+	}
+
+	@RestMethod(name="GET", path="/returnStringList")
+	public List<String> returnStringList() {
+		return asList(new String[]{"foo","bar",null});
+	}
+
+	// Beans
+
+	@RestMethod(name="GET", path="/returnBean")
+	public ABean returnBean() {
+		return new ABean().init();
+	}
+
+	@RestMethod(name="GET", path="/returnBean3dArray")
+	public ABean[][][] returnBean3dArray() {
+		return new ABean[][][]{{{new ABean().init(),null},null},null};
+	}
+
+	@RestMethod(name="GET", path="/returnBeanList")
+	public List<ABean> returnBeanList() {
+		return asList(new ABean().init());
+	}
+
+	@RestMethod(name="GET", path="/returnBean1d3dList")
+	public List<ABean[][][]> returnBean1d3dList() {
+		return new AList<ABean[][][]>().append(new ABean[][][]{{{new ABean().init(),null},null},null}).append(null);
+	}
+
+	@RestMethod(name="GET", path="/returnBeanMap")
+	public Map<String,ABean> returnBeanMap() {
+		return new AMap<String,ABean>().append("foo",new ABean().init());
+	}
+
+	@RestMethod(name="GET", path="/returnBeanListMap")
+	public Map<String,List<ABean>> returnBeanListMap() {
+		return new AMap<String,List<ABean>>().append("foo",asList(new ABean().init()));
+	}
+
+	@RestMethod(name="GET", path="/returnBean1d3dListMap")
+	public Map<String,List<ABean[][][]>> returnBean1d3dListMap() {
+		return new AMap<String,List<ABean[][][]>>().append("foo", new AList<ABean[][][]>().append(new ABean[][][]{{{new ABean().init(),null},null},null}).append(null));
+	}
+
+	@RestMethod(name="GET", path="/returnBeanListMapIntegerKeys")
+	public Map<Integer,List<ABean>> returnBeanListMapIntegerKeys() {
+		return new AMap<Integer,List<ABean>>().append(1,asList(new ABean().init()));
+	}
+
+	// Typed beans
+
+	@RestMethod(name="GET", path="/returnTypedBean")
+	public TypedBean returnTypedBean() {
+		return new TypedBeanImpl().init();
+	}
+
+	@RestMethod(name="GET", path="/returnTypedBean3dArray")
+	public TypedBean[][][] returnTypedBean3dArray() {
+		return new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null};
+	}
+
+	@RestMethod(name="GET", path="/returnTypedBeanList")
+	public List<TypedBean> returnTypedBeanList() {
+		return asList((TypedBean)new TypedBeanImpl().init());
+	}
+
+	@RestMethod(name="GET", path="/returnTypedBean1d3dList")
+	public List<TypedBean[][][]> returnTypedBean1d3dList() {
+		return new AList<TypedBean[][][]>().append(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null}).append(null);
+	}
+
+	@RestMethod(name="GET", path="/returnTypedBeanMap")
+	public Map<String,TypedBean> returnTypedBeanMap() {
+		return new AMap<String,TypedBean>().append("foo",new TypedBeanImpl().init());
+	}
+
+	@RestMethod(name="GET", path="/returnTypedBeanListMap")
+	public Map<String,List<TypedBean>> returnTypedBeanListMap() {
+		return new AMap<String,List<TypedBean>>().append("foo",asList((TypedBean)new TypedBeanImpl().init()));
+	}
+
+	@RestMethod(name="GET", path="/returnTypedBean1d3dListMap")
+	public Map<String,List<TypedBean[][][]>> returnTypedBean1d3dListMap() {
+		return new AMap<String,List<TypedBean[][][]>>().append("foo", new AList<TypedBean[][][]>().append(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null}).append(null));
+	}
+
+	@RestMethod(name="GET", path="/returnTypedBeanListMapIntegerKeys")
+	public Map<Integer,List<TypedBean>> returnTypedBeanListMapIntegerKeys() {
+		return new AMap<Integer,List<TypedBean>>().append(1,asList((TypedBean)new TypedBeanImpl().init()));
+	}
+
+	// Swapped POJOs
+
+	@RestMethod(name="GET", path="/returnSwappedPojo")
+	public SwappedPojo returnSwappedPojo() {
+		return new SwappedPojo();
+	}
+
+	@RestMethod(name="GET", path="/returnSwappedPojo3dArray")
+	public SwappedPojo[][][] returnSwappedPojo3dArray() {
+		return new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null};
+	}
+
+	@RestMethod(name="GET", path="/returnSwappedPojoMap")
+	public Map<SwappedPojo,SwappedPojo> returnSwappedPojoMap() {
+		return new AMap<SwappedPojo,SwappedPojo>().append(new SwappedPojo(), new SwappedPojo());
+	}
+
+	@RestMethod(name="GET", path="/returnSwappedPojo3dMap")
+	public Map<SwappedPojo,SwappedPojo[][][]> returnSwappedPojo3dMap() {
+		return new AMap<SwappedPojo,SwappedPojo[][][]>().append(new SwappedPojo(), new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null});
+	}
+
+	// Implicit swapped POJOs
+
+	@RestMethod(name="GET", path="/returnImplicitSwappedPojo")
+	public ImplicitSwappedPojo returnImplicitSwappedPojo() {
+		return new ImplicitSwappedPojo();
+	}
+
+	@RestMethod(name="GET", path="/returnImplicitSwappedPojo3dArray")
+	public ImplicitSwappedPojo[][][] returnImplicitSwappedPojo3dArray() {
+		return new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null};
+	}
+
+	@RestMethod(name="GET", path="/returnImplicitSwappedPojoMap")
+	public Map<ImplicitSwappedPojo,ImplicitSwappedPojo> returnImplicitSwappedPojoMap() {
+		return new AMap<ImplicitSwappedPojo,ImplicitSwappedPojo>().append(new ImplicitSwappedPojo(), new ImplicitSwappedPojo());
+	}
+
+	@RestMethod(name="GET", path="/returnImplicitSwappedPojo3dMap")
+	public Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> returnImplicitSwappedPojo3dMap() {
+		return new AMap<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]>().append(new ImplicitSwappedPojo(), new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null});
+	}
+
+	// Enums
+
+	@RestMethod(name="GET", path="/returnEnum")
+	public TestEnum returnEnum() {
+		return TestEnum.TWO;
+	}
+
+	@RestMethod(name="GET", path="/returnEnum3d")
+	public TestEnum[][][] returnEnum3d() {
+		return new TestEnum[][][]{{{TestEnum.TWO,null},null},null};
+	}
+
+	@RestMethod(name="GET", path="/returnEnumList")
+	public List<TestEnum> returnEnumList() {
+		return new AList<TestEnum>().append(TestEnum.TWO).append(null);
+	}
+
+	@RestMethod(name="GET", path="/returnEnum3dList")
+	public List<List<List<TestEnum>>> returnEnum3dList() {
+		return new AList<List<List<TestEnum>>>()
+		.append(
+			new AList<List<TestEnum>>()
+			.append(
+				new AList<TestEnum>().append(TestEnum.TWO).append(null)
+			)
+			.append(null)
+		.append(null)
+		);
+	}
+
+	@RestMethod(name="GET", path="/returnEnum1d3dList")
+	public List<TestEnum[][][]> returnEnum1d3dList() {
+		return new AList<TestEnum[][][]>().append(new TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null);
+	}
+
+	@RestMethod(name="GET", path="/returnEnumMap")
+	public Map<TestEnum,TestEnum> returnEnumMap() {
+		return new AMap<TestEnum,TestEnum>().append(TestEnum.ONE,TestEnum.TWO);
+	}
+
+	@RestMethod(name="GET", path="/returnEnum3dArrayMap")
+	public Map<TestEnum,TestEnum[][][]> returnEnum3dArrayMap() {
+		return new AMap<TestEnum,TestEnum[][][]>().append(TestEnum.ONE, new TestEnum[][][]{{{TestEnum.TWO,null},null},null});
+	}
+
+	@RestMethod(name="GET", path="/returnEnum1d3dListMap")
+	public Map<TestEnum,List<TestEnum[][][]>> returnEnum1d3dListMap() {
+		return new AMap<TestEnum,List<TestEnum[][][]>>().append(TestEnum.ONE, new AList<TestEnum[][][]>().append(new TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null));
+	}
+
+	//--------------------------------------------------------------------------------
+	// Test parameters
+	//--------------------------------------------------------------------------------
+
+	// Various primitives
+
+	@RestMethod(name="POST", path="/setInt")
+	public void setInt(@Body int x) {
+		assertEquals(1, x);
+	}
+
+	@RestMethod(name="POST", path="/setInteger")
+	public void setInteger(@Body Integer x) {
+		assertEquals((Integer)1, x);
+	}
+
+	@RestMethod(name="POST", path="/setBoolean")
+	public void setBoolean(@Body boolean x) {
+		assertTrue(x);
+	}
+
+	@RestMethod(name="POST", path="/setFloat")
+	public void setFloat(@Body float x) {
+		assertTrue(1f == x);
+	}
+
+	@RestMethod(name="POST", path="/setFloatObject")
+	public void setFloatObject(@Body Float x) {
+		assertTrue(1f == x);
+	}
+
+	@RestMethod(name="POST", path="/setString")
+	public void setString(@Body String x) {
+		assertEquals("foo", x);
+	}
+
+	@RestMethod(name="POST", path="/setNullString")
+	public void setNullString(@Body String x) {
+		assertNull(x);
+	}
+
+	@RestMethod(name="POST", path="/setInt3dArray")
+	public void setInt3dArray(@Body int[][][] x) {
+		assertObjectEquals("[[[1,2],null],null]", x);
+	}
+
+	@RestMethod(name="POST", path="/setInteger3dArray")
+	public void setInteger3dArray(@Body Integer[][][] x) {
+		assertObjectEquals("[[[1,null],null],null]", x);
+	}
+
+	@RestMethod(name="POST", path="/setString3dArray")
+	public void setString3dArray(@Body String[][][] x) {
+		assertObjectEquals("[[['foo',null],null],null]", x);
+	}
+
+	@RestMethod(name="POST", path="/setIntegerList")
+	public void setIntegerList(@Body List<Integer> x) {
+		assertObjectEquals("[1,null]", x);
+		assertClass(Integer.class, x.get(0));
+	}
+
+	@RestMethod(name="POST", path="/setInteger3dList")
+	public void setInteger3dList(@Body List<List<List<Integer>>> x) {
+		assertObjectEquals("[[[1,null],null],null]", x);
+		assertClass(Integer.class, x.get(0).get(0).get(0));
+	}
+
+	@RestMethod(name="POST", path="/setInteger1d3dList")
+	public void setInteger1d3dList(@Body List<Integer[][][]> x) {
+		assertObjectEquals("[[[[1,null],null],null],null]", x);
+		assertClass(Integer[][][].class, x.get(0));
+		assertClass(Integer.class, x.get(0)[0][0][0]);
+	}
+
+	@RestMethod(name="POST", path="/setInt1d3dList")
+	public void setInt1d3dList(@Body List<int[][][]> x) {
+		assertObjectEquals("[[[[1,2],null],null],null]", x);
+		assertClass(int[][][].class, x.get(0));
+	}
+
+	@RestMethod(name="POST", path="/setStringList")
+	public void setStringList(@Body List<String> x) {
+		assertObjectEquals("['foo','bar',null]", x);
+	}
+
+	// Beans
+
+	@RestMethod(name="POST", path="/setBean")
+	public void setBean(@Body ABean x) {
+		assertObjectEquals("{a:1,b:'foo'}", x);
+	}
+
+	@RestMethod(name="POST", path="/setBean3dArray")
+	public void setBean3dArray(@Body ABean[][][] x) {
+		assertObjectEquals("[[[{a:1,b:'foo'},null],null],null]", x);
+	}
+
+	@RestMethod(name="POST", path="/setBeanList")
+	public void setBeanList(@Body List<ABean> x) {
+		assertObjectEquals("[{a:1,b:'foo'}]", x);
+	}
+
+	@RestMethod(name="POST", path="/setBean1d3dList")
+	public void setBean1d3dList(@Body List<ABean[][][]> x) {
+		assertObjectEquals("[[[[{a:1,b:'foo'},null],null],null],null]", x);
+	}
+
+	@RestMethod(name="POST", path="/setBeanMap")
+	public void setBeanMap(@Body Map<String,ABean> x) {
+		assertObjectEquals("{foo:{a:1,b:'foo'}}", x);
+	}
+
+	@RestMethod(name="POST", path="/setBeanListMap")
+	public void setBeanListMap(@Body Map<String,List<ABean>> x) {
+		assertObjectEquals("{foo:[{a:1,b:'foo'}]}", x);
+	}
+
+	@RestMethod(name="POST", path="/setBean1d3dListMap")
+	public void setBean1d3dListMap(@Body Map<String,List<ABean[][][]>> x) {
+		assertObjectEquals("{foo:[[[[{a:1,b:'foo'},null],null],null],null]}", x);
+	}
+
+	@RestMethod(name="POST", path="/setBeanListMapIntegerKeys")
+	public void setBeanListMapIntegerKeys(@Body Map<Integer,List<ABean>> x) {
+		assertObjectEquals("{'1':[{a:1,b:'foo'}]}", x);  // Note: JsonSerializer serializes key as string.
+		assertClass(Integer.class, x.keySet().iterator().next());
+	}
+
+	// Typed beans
+
+	@RestMethod(name="POST", path="/setTypedBean")
+	public void setTypedBean(@Body TypedBean x) {
+		assertObjectEquals("{_type:'TypedBeanImpl',a:1,b:'foo'}", x);
+		assertClass(TypedBeanImpl.class, x);
+	}
+
+	@RestMethod(name="POST", path="/setTypedBean3dArray")
+	public void setTypedBean3dArray(@Body TypedBean[][][] x) {
+		assertObjectEquals("[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null]", x);
+		assertClass(TypedBeanImpl.class, x[0][0][0]);
+	}
+
+	@RestMethod(name="POST", path="/setTypedBeanList")
+	public void setTypedBeanList(@Body List<TypedBean> x) {
+		assertObjectEquals("[{_type:'TypedBeanImpl',a:1,b:'foo'}]", x);
+		assertClass(TypedBeanImpl.class, x.get(0));
+	}
+
+	@RestMethod(name="POST", path="/setTypedBean1d3dList")
+	public void setTypedBean1d3dList(@Body List<TypedBean[][][]> x) {
+		assertObjectEquals("[[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null],null]", x);
+		assertClass(TypedBeanImpl.class, x.get(0)[0][0][0]);
+	}
+
+	@RestMethod(name="POST", path="/setTypedBeanMap")
+	public void setTypedBeanMap(@Body Map<String,TypedBean> x) {
+		assertObjectEquals("{foo:{_type:'TypedBeanImpl',a:1,b:'foo'}}", x);
+		assertClass(TypedBeanImpl.class, x.get("foo"));
+	}
+
+	@RestMethod(name="POST", path="/setTypedBeanListMap")
+	public void setTypedBeanListMap(@Body Map<String,List<TypedBean>> x) {
+		assertObjectEquals("{foo:[{_type:'TypedBeanImpl',a:1,b:'foo'}]}", x);
+		assertClass(TypedBeanImpl.class, x.get("foo").get(0));
+	}
+
+	@RestMethod(name="POST", path="/setTypedBean1d3dListMap")
+	public void setTypedBean1d3dListMap(@Body Map<String,List<TypedBean[][][]>> x) {
+		assertObjectEquals("{foo:[[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null],null]}", x);
+		assertClass(TypedBeanImpl.class, x.get("foo").get(0)[0][0][0]);
+	}
+
+	@RestMethod(name="POST", path="/setTypedBeanListMapIntegerKeys")
+	public void setTypedBeanListMapIntegerKeys(@Body Map<Integer,List<TypedBean>> x) {
+		assertObjectEquals("{'1':[{_type:'TypedBeanImpl',a:1,b:'foo'}]}", x);  // Note: JsonSerializer serializes key as string.
+		assertClass(TypedBeanImpl.class, x.get(1).get(0));
+	}
+
+	// Swapped POJOs
+
+	@RestMethod(name="POST", path="/setSwappedPojo")
+	public void setSwappedPojo(@Body SwappedPojo x) {
+		assertTrue(x.wasUnswapped);
+	}
+
+	@RestMethod(name="POST", path="/setSwappedPojo3dArray")
+	public void setSwappedPojo3dArray(@Body SwappedPojo[][][] x) {
+		assertObjectEquals("[[['"+SWAP+"',null],null],null]", x);
+		assertTrue(x[0][0][0].wasUnswapped);
+	}
+
+	@RestMethod(name="POST", path="/setSwappedPojoMap")
+	public void setSwappedPojoMap(@Body Map<SwappedPojo,SwappedPojo> x) {
+		assertObjectEquals("{'"+SWAP+"':'"+SWAP+"'}", x);
+		Map.Entry<SwappedPojo,SwappedPojo> e = x.entrySet().iterator().next();
+		assertTrue(e.getKey().wasUnswapped);
+		assertTrue(e.getValue().wasUnswapped);
+	}
+
+	@RestMethod(name="POST", path="/setSwappedPojo3dMap")
+	public void setSwappedPojo3dMap(@Body Map<SwappedPojo,SwappedPojo[][][]> x) {
+		assertObjectEquals("{'"+SWAP+"':[[['"+SWAP+"',null],null],null]}", x);
+		Map.Entry<SwappedPojo,SwappedPojo[][][]> e = x.entrySet().iterator().next();
+		assertTrue(e.getKey().wasUnswapped);
+		assertTrue(e.getValue()[0][0][0].wasUnswapped);
+	}
+
+	// Implicit swapped POJOs
+
+	@RestMethod(name="POST", path="/setImplicitSwappedPojo")
+	public void setImplicitSwappedPojo(@Body ImplicitSwappedPojo x) {
+		assertTrue(x.wasUnswapped);
+	}
+
+	@RestMethod(name="POST", path="/setImplicitSwappedPojo3dArray")
+	public void setImplicitSwappedPojo3dArray(@Body ImplicitSwappedPojo[][][] x) {
+		assertObjectEquals("[[['"+SWAP+"',null],null],null]", x);
+		assertTrue(x[0][0][0].wasUnswapped);
+	}
+
+	@RestMethod(name="POST", path="/setImplicitSwappedPojoMap")
+	public void setImplicitSwappedPojoMap(@Body Map<ImplicitSwappedPojo,ImplicitSwappedPojo> x) {
+		assertObjectEquals("{'"+SWAP+"':'"+SWAP+"'}", x);
+		Map.Entry<ImplicitSwappedPojo,ImplicitSwappedPojo> e = x.entrySet().iterator().next();
+		assertTrue(e.getKey().wasUnswapped);
+		assertTrue(e.getValue().wasUnswapped);
+	}
+
+	@RestMethod(name="POST", path="/setImplicitSwappedPojo3dMap")
+	public void setImplicitSwappedPojo3dMap(@Body Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> x) {
+		assertObjectEquals("{'"+SWAP+"':[[['"+SWAP+"',null],null],null]}", x);
+		Map.Entry<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> e = x.entrySet().iterator().next();
+		assertTrue(e.getKey().wasUnswapped);
+		assertTrue(e.getValue()[0][0][0].wasUnswapped);
+	}
+
+	// Enums
+
+	@RestMethod(name="POST", path="/setEnum")
+	public void setEnum(@Body TestEnum x) {
+		assertEquals(TestEnum.TWO, x);
+	}
+
+	@RestMethod(name="POST", path="/setEnum3d")
+	public void setEnum3d(@Body TestEnum[][][] x) {
+		assertObjectEquals("[[['TWO',null],null],null]", x);
+	}
+
+	@RestMethod(name="POST", path="/setEnumList")
+	public void setEnumList(@Body List<TestEnum> x) {
+		assertObjectEquals("['TWO',null]", x);
+		assertClass(TestEnum.class, x.get(0));
+	}
+
+	@RestMethod(name="POST", path="/setEnum3dList")
+	public void setEnum3dList(@Body List<List<List<TestEnum>>> x) {
+		assertObjectEquals("[[['TWO',null],null,null]]", x);
+		assertClass(TestEnum.class, x.get(0).get(0).get(0));
+	}
+
+	@RestMethod(name="POST", path="/setEnum1d3dList")
+	public void setEnum1d3dList(@Body List<TestEnum[][][]> x) {
+		assertObjectEquals("[[[['TWO',null],null],null],null]", x);
+		assertClass(TestEnum[][][].class, x.get(0));
+	}
+
+	@RestMethod(name="POST", path="/setEnumMap")
+	public void setEnumMap(@Body Map<TestEnum,TestEnum> x) {
+		assertObjectEquals("{ONE:'TWO'}", x);
+		Map.Entry<TestEnum,TestEnum> e = x.entrySet().iterator().next();
+		assertClass(TestEnum.class, e.getKey());
+		assertClass(TestEnum.class, e.getValue());
+	}
+
+	@RestMethod(name="POST", path="/setEnum3dArrayMap")
+	public void setEnum3dArrayMap(@Body Map<TestEnum,TestEnum[][][]> x) {
+		assertObjectEquals("{ONE:[[['TWO',null],null],null]}", x);
+		Map.Entry<TestEnum,TestEnum[][][]> e = x.entrySet().iterator().next();
+		assertClass(TestEnum.class, e.getKey());
+		assertClass(TestEnum[][][].class, e.getValue());
+	}
+
+	@RestMethod(name="POST", path="/setEnum1d3dListMap")
+	public void setEnum1d3dListMap(@Body Map<TestEnum,List<TestEnum[][][]>> x) {
+		assertObjectEquals("{ONE:[[[['TWO',null],null],null],null]}", x);
+		Map.Entry<TestEnum,List<TestEnum[][][]>> e = x.entrySet().iterator().next();
+		assertClass(TestEnum.class, e.getKey());
+		assertClass(TestEnum[][][].class, e.getValue().get(0));
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/ABean.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/ABean.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/ABean.java
new file mode 100644
index 0000000..21d9c0e
--- /dev/null
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/ABean.java
@@ -0,0 +1,24 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.rest.test.pojos;
+
+public class ABean {
+	public int a;
+	public String b;
+
+	public ABean init() {
+		this.a = 1;
+		this.b = "foo";
+		return this;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/Constants.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/Constants.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/Constants.java
new file mode 100644
index 0000000..76c469e
--- /dev/null
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/Constants.java
@@ -0,0 +1,25 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.rest.test.pojos;
+
+/**
+ * Description.
+ * <p>
+ *
+ * @author James Bognar (james.bognar@salesforce.com)
+ */
+public class Constants {
+
+	public static final String SWAP = "swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/";
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/ImplicitSwappedPojo.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/ImplicitSwappedPojo.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/ImplicitSwappedPojo.java
new file mode 100644
index 0000000..5f3f445
--- /dev/null
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/ImplicitSwappedPojo.java
@@ -0,0 +1,35 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.rest.test.pojos;
+
+import static org.apache.juneau.rest.test.pojos.Constants.*;
+
+import org.apache.juneau.annotation.*;
+
+@BeanIgnore
+public class ImplicitSwappedPojo {
+	public boolean wasUnswapped;
+
+	@Override
+	public String toString() {
+		return SWAP;
+	}
+
+	public ImplicitSwappedPojo() {}
+
+
+	public ImplicitSwappedPojo(String fromString) {
+		if (fromString.equals(SWAP))
+			wasUnswapped = true;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/SwappedPojo.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/SwappedPojo.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/SwappedPojo.java
new file mode 100644
index 0000000..25d914c
--- /dev/null
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/SwappedPojo.java
@@ -0,0 +1,20 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.rest.test.pojos;
+
+import org.apache.juneau.annotation.*;
+
+@Pojo(swap=SwappedPojoSwap.class)
+public class SwappedPojo {
+	public boolean wasUnswapped;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/SwappedPojoSwap.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/SwappedPojoSwap.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/SwappedPojoSwap.java
new file mode 100644
index 0000000..0fdcb58
--- /dev/null
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/SwappedPojoSwap.java
@@ -0,0 +1,35 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              * 
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.rest.test.pojos;
+
+import static org.apache.juneau.rest.test.pojos.Constants.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.serializer.*;
+import org.apache.juneau.transform.*;
+
+public class SwappedPojoSwap extends PojoSwap<SwappedPojo,String> {
+	@Override
+	public String swap(BeanSession session, SwappedPojo c) throws SerializeException {
+		return SWAP;
+	}
+
+	@Override
+	public SwappedPojo unswap(BeanSession session, String f, ClassMeta<?> hint) throws ParseException {
+		SwappedPojo c = new SwappedPojo();
+		if (f.equals(SWAP))
+			c.wasUnswapped = true;
+		return c;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TestEnum.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TestEnum.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TestEnum.java
new file mode 100644
index 0000000..8061b6d
--- /dev/null
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TestEnum.java
@@ -0,0 +1,17 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              * 
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.rest.test.pojos;
+
+public enum TestEnum {
+	ONE,TWO,THREE
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TypedBean.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TypedBean.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TypedBean.java
new file mode 100644
index 0000000..0e13279
--- /dev/null
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TypedBean.java
@@ -0,0 +1,17 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.rest.test.pojos;
+
+@org.apache.juneau.annotation.Bean(beanDictionary={TypedBeanImpl.class})
+public interface TypedBean {
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TypedBeanImpl.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TypedBeanImpl.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TypedBeanImpl.java
new file mode 100644
index 0000000..a381475
--- /dev/null
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TypedBeanImpl.java
@@ -0,0 +1,25 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.rest.test.pojos;
+
+@org.apache.juneau.annotation.Bean(typeName="TypedBeanImpl", sort=true)
+public class TypedBeanImpl implements TypedBean {
+	public int a;
+	public String b;
+
+	public TypedBeanImpl init() {
+		this.a = 1;
+		this.b = "foo";
+		return this;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ConfigTest.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ConfigTest.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ConfigTest.java
index a0f7b88..22ebaff 100644
--- a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ConfigTest.java
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ConfigTest.java
@@ -16,7 +16,7 @@ import static org.apache.juneau.rest.test.TestUtils.*;
 import static org.junit.Assert.*;
 
 import org.apache.juneau.ini.*;
-import org.apache.juneau.rest.*;
+import org.apache.juneau.internal.*;
 import org.apache.juneau.rest.client.*;
 import org.junit.*;
 
@@ -53,6 +53,6 @@ public class ConfigTest extends RestTestcase {
 	}
 
 	private String getName(Class<?> c) {
-		return RestUtils.encode(c.getName());
+		return StringUtils.urlEncode(c.getName());
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ContentTest.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ContentTest.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ContentTest.java
index c5f637d..ae67a25 100644
--- a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ContentTest.java
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ContentTest.java
@@ -14,9 +14,7 @@ package org.apache.juneau.rest.test;
 
 import static org.junit.Assert.*;
 
-import java.io.*;
-import java.net.*;
-
+import org.apache.juneau.internal.*;
 import org.apache.juneau.json.*;
 import org.apache.juneau.plaintext.*;
 import org.apache.juneau.rest.client.*;
@@ -452,10 +450,6 @@ public class ContentTest extends RestTestcase {
 
 
 	private String encode(String s) {
-		try {
-			return URLEncoder.encode(s, "UTF-8");
-		} catch (UnsupportedEncodingException e) {
-			throw new RuntimeException(e);
-		}
+		return StringUtils.urlEncode(s);
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/FormDataTest.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/FormDataTest.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/FormDataTest.java
new file mode 100644
index 0000000..a8695a3
--- /dev/null
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/FormDataTest.java
@@ -0,0 +1,100 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.rest.test;
+
+import static org.junit.Assert.*;
+
+import java.util.*;
+
+import org.apache.juneau.rest.client.*;
+import org.apache.juneau.urlencoding.*;
+import org.apache.juneau.utils.*;
+import org.junit.*;
+
+/**
+ * Tests client-side form posts.
+ */
+public class FormDataTest extends RestTestcase {
+
+	private static String URL = "/testFormData";
+
+	//====================================================================================================
+	// Form data tests using RestCall.formData() method.
+	//====================================================================================================
+	@Test
+	public void testFormDataMethod() throws Exception {
+		RestClient c = TestMicroservice.DEFAULT_CLIENT;
+		String r;
+
+		r = c.doPost(URL)
+			.formData("foo", 123)
+			.formData("bar", "baz")
+			.getResponseAsString();
+		assertEquals("Content-Type=[application/x-www-form-urlencoded], contents=[foo=123&bar=baz]", r);
+	}
+
+	//====================================================================================================
+	// Form data tests using RestClient.doPost(NameValuePairs).
+	//====================================================================================================
+	@Test
+	public void testDoPostNameValuePairs() throws Exception {
+		RestClient c = TestMicroservice.DEFAULT_CLIENT;
+		String r;
+
+		r = c.doPost(URL, new NameValuePairs().append("foo",123).append("bar","baz"))
+			.getResponseAsString();
+		assertEquals("Content-Type=[application/x-www-form-urlencoded], contents=[foo=123&bar=baz]", r);
+	}
+
+	public static class A {
+		public int f1 = 1;
+	}
+
+	//====================================================================================================
+	// Form data tests using RestClientBuilder.plainTextParams().
+	//====================================================================================================
+	@Test
+	public void testPlainTextParams() throws Exception {
+		RestClient c = TestMicroservice.client(UrlEncodingSerializer.class, UrlEncodingParser.class).plainTextParams().build();
+		String r;
+
+		Map<String,Object> m = new AMap<String,Object>()
+			.append("foo", "foo")
+			.append("'foo'", "'foo'")
+			.append("(foo)", "(foo)")
+			.append("@(foo)", "@(foo)");
+
+		r = c.doPost(URL, m).getResponseAsString();
+		assertEquals("Content-Type=[application/x-www-form-urlencoded], contents=[foo=foo&'foo'='foo'&(foo)=(foo)&@(foo)=@(foo)]", r);
+
+		List<String> l = new AList<String>().appendAll("foo", "'foo'", "(foo)", "@(foo)");
+		r = c.doPost(URL, l).getResponseAsString();
+		assertEquals("Content-Type=[application/x-www-form-urlencoded], contents=[0=foo&1='foo'&2=(foo)&3=@(foo)]", r);
+
+		NameValuePairs nvp = new NameValuePairs()
+			.append("foo", "foo")
+			.append("'foo'", "'foo'")
+			.append("(foo)", "(foo)")
+			.append("@(foo)", "@(foo)");
+		r = c.doPost(URL, nvp).getResponseAsString();
+		assertEquals("Content-Type=[application/x-www-form-urlencoded], contents=[foo=foo&%27foo%27=%27foo%27&%28foo%29=%28foo%29&%40%28foo%29=%40%28foo%29]", r);
+
+		r = c.doPost(URL)
+			.formData("foo", "foo")
+			.formData("'foo'", "'foo'")
+			.formData("(foo)", "(foo)")
+			.formData("@(foo)", "@(foo)")
+			.getResponseAsString();
+		assertEquals("Content-Type=[application/x-www-form-urlencoded], contents=[foo=foo&%27foo%27=%27foo%27&%28foo%29=%28foo%29&%40%28foo%29=%40%28foo%29]", r);
+	}
+}


[3/7] incubator-juneau git commit: Support for 3rd-party proxy interfaces.

Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/InterfaceProxyTest.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/InterfaceProxyTest.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/InterfaceProxyTest.java
index d82c7a4..e9940d1 100644
--- a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/InterfaceProxyTest.java
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/InterfaceProxyTest.java
@@ -12,8 +12,8 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.rest.test;
 
-import static org.apache.juneau.rest.test.InterfaceProxy.*;
 import static org.apache.juneau.rest.test.TestUtils.*;
+import static org.apache.juneau.rest.test.pojos.Constants.*;
 import static org.junit.Assert.*;
 
 import java.util.*;
@@ -23,7 +23,7 @@ import org.apache.juneau.jena.*;
 import org.apache.juneau.json.*;
 import org.apache.juneau.msgpack.*;
 import org.apache.juneau.parser.*;
-import org.apache.juneau.rest.test.InterfaceProxy.*;
+import org.apache.juneau.rest.test.pojos.*;
 import org.apache.juneau.serializer.*;
 import org.apache.juneau.uon.*;
 import org.apache.juneau.urlencoding.*;
@@ -33,7 +33,7 @@ import org.junit.*;
 import org.junit.runner.*;
 import org.junit.runners.*;
 
-@SuppressWarnings("unused")
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
 @RunWith(Parameterized.class)
 public class InterfaceProxyTest extends RestTestcase {
 
@@ -51,16 +51,14 @@ public class InterfaceProxyTest extends RestTestcase {
 		});
 	}
 
-	private Serializer serializer;
-	private Parser parser;
+	private InterfaceProxy proxy;
 
 	public InterfaceProxyTest(String label, Serializer serializer, Parser parser) {
-		this.serializer = serializer;
-		this.parser = parser;
-	}
-
-	private InterfaceProxy getProxy() {
-		return getClient(serializer, parser).getRemoteableProxy(InterfaceProxy.class, "/testInterfaceProxyResource/proxy");
+		proxy = getCached(label, InterfaceProxy.class);
+		if (proxy == null) {
+			proxy = getClient(label, serializer, parser).getRemoteableProxy(InterfaceProxy.class, "/testInterfaceProxyResource/proxy");
+			cache(label, proxy);
+		}
 	}
 
 	//--------------------------------------------------------------------------------
@@ -69,227 +67,230 @@ public class InterfaceProxyTest extends RestTestcase {
 
 	// Various primitives
 	@Test
-	public void returnVoid() {
-		getProxy().returnVoid();
+	public void a01_returnVoid() {
+		proxy.returnVoid();
 	}
 
 	@Test
-	public void returnInteger() {
-		assertEquals((Integer)1, getProxy().returnInteger());
+	public void a02_returnInteger() {
+		assertEquals((Integer)1, proxy.returnInteger());
 	}
 
 	@Test
-	public void returnInt() {
-		assertEquals(1, getProxy().returnInt());
+	public void a03_returnInt() {
+		assertEquals(1, proxy.returnInt());
 	}
 
 	@Test
-	public void returnBoolean() {
-		assertEquals(true, getProxy().returnBoolean());
+	public void a04_returnBoolean() {
+		assertEquals(true, proxy.returnBoolean());
 	}
 
 	@Test
-	public void returnFloat() {
-		assertTrue(1f == getProxy().returnFloat());
+	public void a05_returnFloat() {
+		assertTrue(1f == proxy.returnFloat());
 	}
 
 	@Test
-	public void returnFloatObject() {
-		assertTrue(1f == getProxy().returnFloatObject());
+	public void a06_returnFloatObject() {
+		assertTrue(1f == proxy.returnFloatObject());
 	}
 
 	@Test
-	public void returnString() {
-		assertEquals("foobar", getProxy().returnString());
+	public void a07_returnString() {
+		assertEquals("foobar", proxy.returnString());
 	}
 
 	@Test
-	public void returnNullString() {
-		assertNull(getProxy().returnNullString());
+	public void a08_returnNullString() {
+		assertNull(proxy.returnNullString());
 	}
 
 	@Test
-	public void returnInt3dArray() {
-		assertObjectEquals("[[[1,2],null],null]", getProxy().returnInt3dArray());
+	public void a09_returnInt3dArray() {
+		assertObjectEquals("[[[1,2],null],null]", proxy.returnInt3dArray());
 	}
 
 	@Test
-	public void returnInteger3dArray() {
-		assertObjectEquals("[[[1,null],null],null]", getProxy().returnInteger3dArray());
+	public void a10_returnInteger3dArray() {
+		assertObjectEquals("[[[1,null],null],null]", proxy.returnInteger3dArray());
 	}
 
 	@Test
-	public void returnString3dArray() {
-		assertObjectEquals("[[['foo','bar',null],null],null]", getProxy().returnString3dArray());
+	public void a11_returnString3dArray() {
+		assertObjectEquals("[[['foo','bar',null],null],null]", proxy.returnString3dArray());
 	}
 
 	@Test
-	public void returnIntegerList() {
-		List<Integer> x = getProxy().returnIntegerList();
+	public void a12_returnIntegerList() {
+		List<Integer> x = proxy.returnIntegerList();
 		assertObjectEquals("[1,null]", x);
-		assertEquals(Integer.class, x.get(0).getClass());
+		assertClass(Integer.class, x.get(0));
 	}
 
 	@Test
-	public void returnInteger3dList() {
-		List<List<List<Integer>>> x = getProxy().returnInteger3dList();
+	public void a13_returnInteger3dList() {
+		List<List<List<Integer>>> x = proxy.returnInteger3dList();
 		assertObjectEquals("[[[1,null],null],null]", x);
-		assertEquals(Integer.class, x.get(0).get(0).get(0).getClass());
+		assertClass(Integer.class, x.get(0).get(0).get(0));
 	}
 
 	@Test
-	public void returnInteger1d3dList() {
-		List<Integer[][][]> x = getProxy().returnInteger1d3dList();
+	public void a14_returnInteger1d3dList() {
+		List<Integer[][][]> x = proxy.returnInteger1d3dList();
 		assertObjectEquals("[[[[1,null],null],null],null]", x);
-		assertEquals(Integer.class, x.get(0)[0][0][0].getClass());
+		assertClass(Integer.class, x.get(0)[0][0][0]);
 	}
 
 	@Test
-	public void returnInt1d3dList() {
-		List<int[][][]> x = getProxy().returnInt1d3dList();
+	public void a15_returnInt1d3dList() {
+		List<int[][][]> x = proxy.returnInt1d3dList();
 		assertObjectEquals("[[[[1,2],null],null],null]", x);
-		assertEquals(int[][][].class, x.get(0).getClass());
+		assertClass(int[][][].class, x.get(0));
 	}
 
 	@Test
-	public void returnStringList() {
-		assertObjectEquals("['foo','bar',null]", getProxy().returnStringList());
+	public void a16_returnStringList() {
+		assertObjectEquals("['foo','bar',null]", proxy.returnStringList());
 	}
 
 	// Beans
+
 	@Test
-	public void returnBean() {
-		Bean x = getProxy().returnBean();
+	public void b01_returnBean() {
+		ABean x = proxy.returnBean();
 		assertObjectEquals("{a:1,b:'foo'}", x);
-		assertEquals(InterfaceProxy.Bean.class, x.getClass());
+		assertClass(ABean.class, x);
 	}
 
 	@Test
-	public void returnBean3dArray() {
-		Bean[][][] x = getProxy().returnBean3dArray();
+	public void b02_returnBean3dArray() {
+		ABean[][][] x = proxy.returnBean3dArray();
 		assertObjectEquals("[[[{a:1,b:'foo'},null],null],null]", x);
-		assertEquals(InterfaceProxy.Bean.class, x[0][0][0].getClass());
+		assertClass(ABean.class, x[0][0][0]);
 	}
 
 	@Test
-	public void returnBeanList() {
-		List<Bean> x = getProxy().returnBeanList();
+	public void b03_returnBeanList() {
+		List<ABean> x = proxy.returnBeanList();
 		assertObjectEquals("[{a:1,b:'foo'}]", x);
-		assertEquals(InterfaceProxy.Bean.class, x.get(0).getClass());
+		assertClass(ABean.class, x.get(0));
 	}
 
 	@Test
-	public void returnBean1d3dList() {
-		List<Bean[][][]> x = getProxy().returnBean1d3dList();
+	public void b04_returnBean1d3dList() {
+		List<ABean[][][]> x = proxy.returnBean1d3dList();
 		assertObjectEquals("[[[[{a:1,b:'foo'},null],null],null],null]", x);
-		assertEquals(InterfaceProxy.Bean.class, x.get(0)[0][0][0].getClass());
+		assertClass(ABean.class, x.get(0)[0][0][0]);
 	}
 
 	@Test
-	public void returnBeanMap() {
-		Map<String,Bean> x = getProxy().returnBeanMap();
+	public void b05_returnBeanMap() {
+		Map<String,ABean> x = proxy.returnBeanMap();
 		assertObjectEquals("{foo:{a:1,b:'foo'}}", x);
-		assertEquals(InterfaceProxy.Bean.class, x.get("foo").getClass());
+		assertClass(ABean.class, x.get("foo"));
 	}
 
 	@Test
-	public void returnBeanListMap() {
-		Map<String,List<Bean>> x = getProxy().returnBeanListMap();
+	public void b06_returnBeanListMap() {
+		Map<String,List<ABean>> x = proxy.returnBeanListMap();
 		assertObjectEquals("{foo:[{a:1,b:'foo'}]}", x);
-		assertEquals(InterfaceProxy.Bean.class, x.get("foo").get(0).getClass());
+		assertClass(ABean.class, x.get("foo").get(0));
 	}
 
 	@Test
-	public void returnBean1d3dListMap() {
-		Map<String,List<Bean[][][]>> x = getProxy().returnBean1d3dListMap();
+	public void b07_returnBean1d3dListMap() {
+		Map<String,List<ABean[][][]>> x = proxy.returnBean1d3dListMap();
 		assertObjectEquals("{foo:[[[[{a:1,b:'foo'},null],null],null],null]}", x);
-		assertEquals(InterfaceProxy.Bean.class, x.get("foo").get(0)[0][0][0].getClass());
+		assertClass(ABean.class, x.get("foo").get(0)[0][0][0]);
 	}
 
 	@Test
-	public void returnBeanListMapIntegerKeys() {
+	public void b08_returnBeanListMapIntegerKeys() {
 		// Note: JsonSerializer serializes key as string.
-		Map<Integer,List<Bean>> x = getProxy().returnBeanListMapIntegerKeys();
+		Map<Integer,List<ABean>> x = proxy.returnBeanListMapIntegerKeys();
 		assertObjectEquals("{'1':[{a:1,b:'foo'}]}", x);
-		assertEquals(Integer.class, x.keySet().iterator().next().getClass());
+		assertClass(Integer.class, x.keySet().iterator().next());
 	}
 
 	// Typed beans
+
 	@Test
-	public void returnTypedBean() {
-		TypedBean x = getProxy().returnTypedBean();
+	public void c01_returnTypedBean() {
+		TypedBean x = proxy.returnTypedBean();
 		assertObjectEquals("{_type:'TypedBeanImpl',a:1,b:'foo'}", x);
-		assertEquals(TypedBeanImpl.class, x.getClass());
+		assertClass(TypedBeanImpl.class, x);
 	}
 
 	@Test
-	public void returnTypedBean3dArray() {
-		TypedBean[][][] x = getProxy().returnTypedBean3dArray();
+	public void c02_returnTypedBean3dArray() {
+		TypedBean[][][] x = proxy.returnTypedBean3dArray();
 		assertObjectEquals("[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null]", x);
-		assertEquals(TypedBeanImpl.class, x[0][0][0].getClass());
+		assertClass(TypedBeanImpl.class, x[0][0][0]);
 	}
 
 	@Test
-	public void returnTypedBeanList() {
-		List<TypedBean> x = getProxy().returnTypedBeanList();
+	public void c03_returnTypedBeanList() {
+		List<TypedBean> x = proxy.returnTypedBeanList();
 		assertObjectEquals("[{_type:'TypedBeanImpl',a:1,b:'foo'}]", x);
-		assertEquals(TypedBeanImpl.class, x.get(0).getClass());
+		assertClass(TypedBeanImpl.class, x.get(0));
 	}
 
 	@Test
-	public void returnTypedBean1d3dList() {
-		List<TypedBean[][][]> x = getProxy().returnTypedBean1d3dList();
+	public void c04_returnTypedBean1d3dList() {
+		List<TypedBean[][][]> x = proxy.returnTypedBean1d3dList();
 		assertObjectEquals("[[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null],null]", x);
-		assertEquals(TypedBeanImpl.class, x.get(0)[0][0][0].getClass());
+		assertClass(TypedBeanImpl.class, x.get(0)[0][0][0]);
 	}
 
 	@Test
-	public void returnTypedBeanMap() {
-		Map<String,TypedBean> x = getProxy().returnTypedBeanMap();
+	public void c05_returnTypedBeanMap() {
+		Map<String,TypedBean> x = proxy.returnTypedBeanMap();
 		assertObjectEquals("{foo:{_type:'TypedBeanImpl',a:1,b:'foo'}}", x);
-		assertEquals(TypedBeanImpl.class, x.get("foo").getClass());
+		assertClass(TypedBeanImpl.class, x.get("foo"));
 	}
 
 	@Test
-	public void returnTypedBeanListMap() {
-		Map<String,List<TypedBean>> x = getProxy().returnTypedBeanListMap();
+	public void c06_returnTypedBeanListMap() {
+		Map<String,List<TypedBean>> x = proxy.returnTypedBeanListMap();
 		assertObjectEquals("{foo:[{_type:'TypedBeanImpl',a:1,b:'foo'}]}", x);
-		assertEquals(TypedBeanImpl.class, x.get("foo").get(0).getClass());
+		assertClass(TypedBeanImpl.class, x.get("foo").get(0));
 	}
 
 	@Test
-	public void returnTypedBean1d3dListMap() {
-		Map<String,List<TypedBean[][][]>> x = getProxy().returnTypedBean1d3dListMap();
+	public void c07_returnTypedBean1d3dListMap() {
+		Map<String,List<TypedBean[][][]>> x = proxy.returnTypedBean1d3dListMap();
 		assertObjectEquals("{foo:[[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null],null]}", x);
-		assertEquals(TypedBeanImpl.class, x.get("foo").get(0)[0][0][0].getClass());
+		assertClass(TypedBeanImpl.class, x.get("foo").get(0)[0][0][0]);
 	}
 
 	@Test
-	public void returnTypedBeanListMapIntegerKeys() {
+	public void c08_returnTypedBeanListMapIntegerKeys() {
 		// Note: JsonSerializer serializes key as string.
-		Map<Integer,List<TypedBean>> x = getProxy().returnTypedBeanListMapIntegerKeys();
+		Map<Integer,List<TypedBean>> x = proxy.returnTypedBeanListMapIntegerKeys();
 		assertObjectEquals("{'1':[{_type:'TypedBeanImpl',a:1,b:'foo'}]}", x);
-		assertEquals(TypedBeanImpl.class, x.get(1).get(0).getClass());
+		assertClass(TypedBeanImpl.class, x.get(1).get(0));
 	}
 
 	// Swapped POJOs
+
 	@Test
-	public void returnSwappedPojo() {
-		SwappedPojo x = getProxy().returnSwappedPojo();
+	public void d01_returnSwappedPojo() {
+		SwappedPojo x = proxy.returnSwappedPojo();
 		assertObjectEquals("'"+SWAP+"'", x);
 		assertTrue(x.wasUnswapped);
 	}
 
 	@Test
-	public void returnSwappedPojo3dArray() {
-		SwappedPojo[][][] x = getProxy().returnSwappedPojo3dArray();
+	public void d02_returnSwappedPojo3dArray() {
+		SwappedPojo[][][] x = proxy.returnSwappedPojo3dArray();
 		assertObjectEquals("[[['"+SWAP+"',null],null],null]", x);
 		assertTrue(x[0][0][0].wasUnswapped);
 	}
 
 	@Test
-	public void returnSwappedPojoMap() {
-		Map<SwappedPojo,SwappedPojo> x = getProxy().returnSwappedPojoMap();
+	public void d03_returnSwappedPojoMap() {
+		Map<SwappedPojo,SwappedPojo> x = proxy.returnSwappedPojoMap();
 		assertObjectEquals("{'"+SWAP+"':'"+SWAP+"'}", x);
 		Map.Entry<SwappedPojo,SwappedPojo> e = x.entrySet().iterator().next();
 		assertTrue(e.getKey().wasUnswapped);
@@ -297,8 +298,8 @@ public class InterfaceProxyTest extends RestTestcase {
 	}
 
 	@Test
-	public void returnSwappedPojo3dMap() {
-		Map<SwappedPojo,SwappedPojo[][][]> x = getProxy().returnSwappedPojo3dMap();
+	public void d04_returnSwappedPojo3dMap() {
+		Map<SwappedPojo,SwappedPojo[][][]> x = proxy.returnSwappedPojo3dMap();
 		assertObjectEquals("{'"+SWAP+"':[[['"+SWAP+"',null],null],null]}", x);
 		Map.Entry<SwappedPojo,SwappedPojo[][][]> e = x.entrySet().iterator().next();
 		assertTrue(e.getKey().wasUnswapped);
@@ -306,23 +307,24 @@ public class InterfaceProxyTest extends RestTestcase {
 	}
 
 	// Implicit swapped POJOs
+
 	@Test
-	public void returnImplicitSwappedPojo() {
-		ImplicitSwappedPojo x = getProxy().returnImplicitSwappedPojo();
+	public void e01_returnImplicitSwappedPojo() {
+		ImplicitSwappedPojo x = proxy.returnImplicitSwappedPojo();
 		assertObjectEquals("'"+SWAP+"'", x);
 		assertTrue(x.wasUnswapped);
 	}
 
 	@Test
-	public void returnImplicitSwappedPojo3dArray() {
-		ImplicitSwappedPojo[][][] x = getProxy().returnImplicitSwappedPojo3dArray();
+	public void e02_returnImplicitSwappedPojo3dArray() {
+		ImplicitSwappedPojo[][][] x = proxy.returnImplicitSwappedPojo3dArray();
 		assertObjectEquals("[[['"+SWAP+"',null],null],null]", x);
 		assertTrue(x[0][0][0].wasUnswapped);
 	}
 
 	@Test
-	public void returnImplicitSwappedPojoMap() {
-		Map<ImplicitSwappedPojo,ImplicitSwappedPojo> x = getProxy().returnImplicitSwappedPojoMap();
+	public void e03_returnImplicitSwappedPojoMap() {
+		Map<ImplicitSwappedPojo,ImplicitSwappedPojo> x = proxy.returnImplicitSwappedPojoMap();
 		assertObjectEquals("{'"+SWAP+"':'"+SWAP+"'}", x);
 		Map.Entry<ImplicitSwappedPojo,ImplicitSwappedPojo> e = x.entrySet().iterator().next();
 		assertTrue(e.getKey().wasUnswapped);
@@ -330,8 +332,8 @@ public class InterfaceProxyTest extends RestTestcase {
 	}
 
 	@Test
-	public void returnImplicitSwappedPojo3dMap() {
-		Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> x = getProxy().returnImplicitSwappedPojo3dMap();
+	public void e04_returnImplicitSwappedPojo3dMap() {
+		Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> x = proxy.returnImplicitSwappedPojo3dMap();
 		assertObjectEquals("{'"+SWAP+"':[[['"+SWAP+"',null],null],null]}", x);
 		Map.Entry<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> e = x.entrySet().iterator().next();
 		assertTrue(e.getKey().wasUnswapped);
@@ -339,63 +341,64 @@ public class InterfaceProxyTest extends RestTestcase {
 	}
 
 	// Enums
+
 	@Test
-	public void returnEnum() {
-		TestEnum x = getProxy().returnEnum();
+	public void f01_returnEnum() {
+		TestEnum x = proxy.returnEnum();
 		assertObjectEquals("'TWO'", x);
 	}
 
 	@Test
-	public void returnEnum3d() {
-		TestEnum[][][] x = getProxy().returnEnum3d();
+	public void f02_returnEnum3d() {
+		TestEnum[][][] x = proxy.returnEnum3d();
 		assertObjectEquals("[[['TWO',null],null],null]", x);
-		assertEquals(TestEnum.class, x[0][0][0].getClass());
+		assertClass(TestEnum.class, x[0][0][0]);
 	}
 
 	@Test
-	public void returnEnumList() {
-		List<TestEnum> x = getProxy().returnEnumList();
+	public void f03_returnEnumList() {
+		List<TestEnum> x = proxy.returnEnumList();
 		assertObjectEquals("['TWO',null]", x);
-		assertEquals(TestEnum.class, x.get(0).getClass());
+		assertClass(TestEnum.class, x.get(0));
 	}
 
 	@Test
-	public void returnEnum3dList() {
-		List<List<List<TestEnum>>> x = getProxy().returnEnum3dList();
+	public void f04_returnEnum3dList() {
+		List<List<List<TestEnum>>> x = proxy.returnEnum3dList();
 		assertObjectEquals("[[['TWO',null],null,null]]", x);
-		assertEquals(TestEnum.class, x.get(0).get(0).get(0).getClass());
+		assertClass(TestEnum.class, x.get(0).get(0).get(0));
 	}
 
 	@Test
-	public void returnEnum1d3dList() {
-		List<TestEnum[][][]> x = getProxy().returnEnum1d3dList();
+	public void f05_returnEnum1d3dList() {
+		List<TestEnum[][][]> x = proxy.returnEnum1d3dList();
 		assertObjectEquals("[[[['TWO',null],null],null],null]", x);
-		assertEquals(TestEnum[][][].class, x.get(0).getClass());
+		assertClass(TestEnum[][][].class, x.get(0));
 	}
 
 	@Test
-	public void returnEnumMap() {
-		Map<TestEnum,TestEnum> x = getProxy().returnEnumMap();
+	public void f06_returnEnumMap() {
+		Map<TestEnum,TestEnum> x = proxy.returnEnumMap();
 		assertObjectEquals("{ONE:'TWO'}", x);
 		Map.Entry<TestEnum,TestEnum> e = x.entrySet().iterator().next();
-		assertEquals(TestEnum.class, e.getKey().getClass());
-		assertEquals(TestEnum.class, e.getValue().getClass());
+		assertClass(TestEnum.class, e.getKey());
+		assertClass(TestEnum.class, e.getValue());
 	}
 
 	@Test
-	public void returnEnum3dArrayMap() {
-		Map<TestEnum,TestEnum[][][]> x = getProxy().returnEnum3dArrayMap();
+	public void f07_returnEnum3dArrayMap() {
+		Map<TestEnum,TestEnum[][][]> x = proxy.returnEnum3dArrayMap();
 		assertObjectEquals("{ONE:[[['TWO',null],null],null]}", x);
 		Map.Entry<TestEnum,TestEnum[][][]> e = x.entrySet().iterator().next();
-		assertEquals(TestEnum.class, e.getKey().getClass());
-		assertEquals(TestEnum[][][].class, e.getValue().getClass());
+		assertClass(TestEnum.class, e.getKey());
+		assertClass(TestEnum[][][].class, e.getValue());
 	}
 
 	@Test
-	public void returnEnum1d3dListMap() {
-		Map<TestEnum,List<TestEnum[][][]>> x = getProxy().returnEnum1d3dListMap();
+	public void f08_returnEnum1d3dListMap() {
+		Map<TestEnum,List<TestEnum[][][]>> x = proxy.returnEnum1d3dListMap();
 		assertObjectEquals("{ONE:[[[['TWO',null],null],null],null]}", x);
-		assertEquals(TestEnum[][][].class, x.get(TestEnum.ONE).get(0).getClass());
+		assertClass(TestEnum[][][].class, x.get(TestEnum.ONE).get(0));
 	}
 
 	//--------------------------------------------------------------------------------
@@ -403,9 +406,9 @@ public class InterfaceProxyTest extends RestTestcase {
 	//--------------------------------------------------------------------------------
 
 	@Test
-	public void throwException1() {
+	public void g01_throwException1() {
 		try {
-			getProxy().throwException1();
+			proxy.throwException1();
 			fail("Exception expected");
 		} catch (InterfaceProxy.InterfaceProxyException1 e) {
 			assertEquals("foo", e.getMessage());
@@ -413,9 +416,9 @@ public class InterfaceProxyTest extends RestTestcase {
 	}
 
 	@Test
-	public void throwException2() {
+	public void g02_throwException2() {
 		try {
-			getProxy().throwException2();
+			proxy.throwException2();
 			fail("Exception expected");
 		} catch (InterfaceProxy.InterfaceProxyException2 e) {
 		}
@@ -427,19 +430,19 @@ public class InterfaceProxyTest extends RestTestcase {
 
 	// Various primitives
 	@Test
-	public void setNothing() {
-		getProxy().setNothing();
+	public void h01_setNothing() {
+		proxy.setNothing();
 	}
 
 	@Test
-	public void setInt() {
-		getProxy().setInt(1);
+	public void h02_setInt() {
+		proxy.setInt(1);
 	}
 
 	@Test
-	public void setWrongInt() {
+	public void h03_setWrongInt() {
 		try {
-			getProxy().setInt(2);
+			proxy.setInt(2);
 			fail("Exception expected");
 		} catch (AssertionError e) { // AssertionError thrown on server side.
 			assertEquals("expected:<1> but was:<2>", e.getMessage());
@@ -447,39 +450,39 @@ public class InterfaceProxyTest extends RestTestcase {
 	}
 
 	@Test
-	public void setInteger() {
-		getProxy().setInteger(1);
+	public void h04_setInteger() {
+		proxy.setInteger(1);
 	}
 
 	@Test
-	public void setBoolean() {
-		getProxy().setBoolean(true);
+	public void h05_setBoolean() {
+		proxy.setBoolean(true);
 	}
 
 	@Test
-	public void setFloat() {
-		getProxy().setFloat(1f);
+	public void h06_setFloat() {
+		proxy.setFloat(1f);
 	}
 
 	@Test
-	public void setFloatObject() {
-		getProxy().setFloatObject(1f);
+	public void h07_setFloatObject() {
+		proxy.setFloatObject(1f);
 	}
 
 	@Test
-	public void setString() {
-		getProxy().setString("foo");
+	public void h08_setString() {
+		proxy.setString("foo");
 	}
 
 	@Test
-	public void setNullString() {
-		getProxy().setNullString(null);
+	public void h09_setNullString() {
+		proxy.setNullString(null);
 	}
 
 	@Test
-	public void setNullStringBad() {
+	public void h10_setNullStringBad() {
 		try {
-			getProxy().setNullString("foo");
+			proxy.setNullString("foo");
 			fail("Exception expected");
 		} catch (AssertionError e) { // AssertionError thrown on server side.
 			assertEquals("expected null, but was:<foo>", e.getLocalizedMessage());
@@ -487,28 +490,28 @@ public class InterfaceProxyTest extends RestTestcase {
 	}
 
 	@Test
-	public void setInt3dArray() {
-		getProxy().setInt3dArray(new int[][][]{{{1,2},null},null});
+	public void h11_setInt3dArray() {
+		proxy.setInt3dArray(new int[][][]{{{1,2},null},null});
 	}
 
 	@Test
-	public void setInteger3dArray() {
-		getProxy().setInteger3dArray(new Integer[][][]{{{1,null},null},null});
+	public void h12_setInteger3dArray() {
+		proxy.setInteger3dArray(new Integer[][][]{{{1,null},null},null});
 	}
 
 	@Test
-	public void setString3dArray() {
-		getProxy().setString3dArray(new String[][][]{{{"foo",null},null},null});
+	public void h13_setString3dArray() {
+		proxy.setString3dArray(new String[][][]{{{"foo",null},null},null});
 	}
 
 	@Test
-	public void setIntegerList() {
-		getProxy().setIntegerList(new AList<Integer>().append(1).append(null));
+	public void h14_setIntegerList() {
+		proxy.setIntegerList(new AList<Integer>().append(1).append(null));
 	}
 
 	@Test
-	public void setInteger3dList() {
-		getProxy().setInteger3dList(
+	public void h15_setInteger3dList() {
+		proxy.setInteger3dList(
 			new AList<List<List<Integer>>>()
 			.append(
 				new AList<List<Integer>>()
@@ -520,167 +523,170 @@ public class InterfaceProxyTest extends RestTestcase {
 	}
 
 	@Test
-	public void setInteger1d3dList() {
-		getProxy().setInteger1d3dList(
+	public void h16_setInteger1d3dList() {
+		proxy.setInteger1d3dList(
 			new AList<Integer[][][]>().append(new Integer[][][]{{{1,null},null},null}).append(null)
 		);
 	}
 
 	@Test
-	public void setInt1d3dList() {
-		getProxy().setInt1d3dList(
+	public void h17_setInt1d3dList() {
+		proxy.setInt1d3dList(
 			new AList<int[][][]>().append(new int[][][]{{{1,2},null},null}).append(null)
 		);
 	}
 
 	@Test
-	public void setStringList() {
-		getProxy().setStringList(Arrays.asList("foo","bar",null));
+	public void h18_setStringList() {
+		proxy.setStringList(Arrays.asList("foo","bar",null));
 	}
 
 	// Beans
 	@Test
-	public void setBean() {
-		getProxy().setBean(new Bean().init());
+	public void h19_setBean() {
+		proxy.setBean(new ABean().init());
 	}
 
 	@Test
-	public void setBean3dArray() {
-		getProxy().setBean3dArray(new Bean[][][]{{{new Bean().init(),null},null},null});
+	public void h20_setBean3dArray() {
+		proxy.setBean3dArray(new ABean[][][]{{{new ABean().init(),null},null},null});
 	}
 
 	@Test
-	public void setBeanList() {
-		getProxy().setBeanList(Arrays.asList(new Bean().init()));
+	public void h21_setBeanList() {
+		proxy.setBeanList(Arrays.asList(new ABean().init()));
 	}
 
 	@Test
-	public void setBean1d3dList() {
-		getProxy().setBean1d3dList(new AList<Bean[][][]>().append(new Bean[][][]{{{new Bean().init(),null},null},null}).append(null));
+	public void h22_setBean1d3dList() {
+		proxy.setBean1d3dList(new AList<ABean[][][]>().append(new ABean[][][]{{{new ABean().init(),null},null},null}).append(null));
 	}
 
 	@Test
-	public void setBeanMap() {
-		getProxy().setBeanMap(new AMap<String,Bean>().append("foo",new Bean().init()));
+	public void h23_setBeanMap() {
+		proxy.setBeanMap(new AMap<String,ABean>().append("foo",new ABean().init()));
 	}
 
 	@Test
-	public void setBeanListMap() {
-		getProxy().setBeanListMap(new AMap<String,List<Bean>>().append("foo",Arrays.asList(new Bean().init())));
+	public void h24_setBeanListMap() {
+		proxy.setBeanListMap(new AMap<String,List<ABean>>().append("foo",Arrays.asList(new ABean().init())));
 	}
 
 	@Test
-	public void setBean1d3dListMap() {
-		getProxy().setBean1d3dListMap(new AMap<String,List<Bean[][][]>>().append("foo",new AList<Bean[][][]>().append(new Bean[][][]{{{new Bean().init(),null},null},null}).append(null)));
+	public void h25_setBean1d3dListMap() {
+		proxy.setBean1d3dListMap(new AMap<String,List<ABean[][][]>>().append("foo",new AList<ABean[][][]>().append(new ABean[][][]{{{new ABean().init(),null},null},null}).append(null)));
 	}
 
 	@Test
-	public void setBeanListMapIntegerKeys() {
-		getProxy().setBeanListMapIntegerKeys(new AMap<Integer,List<Bean>>().append(1,Arrays.asList(new Bean().init())));
+	public void h26_setBeanListMapIntegerKeys() {
+		proxy.setBeanListMapIntegerKeys(new AMap<Integer,List<ABean>>().append(1,Arrays.asList(new ABean().init())));
 	}
 
 	// Typed beans
+
 	@Test
-	public void setTypedBean() {
-		getProxy().setTypedBean(new TypedBeanImpl().init());
+	public void i01_setTypedBean() {
+		proxy.setTypedBean(new TypedBeanImpl().init());
 	}
 
 	@Test
-	public void setTypedBean3dArray() {
-		getProxy().setTypedBean3dArray(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null});
+	public void i02_setTypedBean3dArray() {
+		proxy.setTypedBean3dArray(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null});
 	}
 
 	@Test
-	public void setTypedBeanList() {
-		getProxy().setTypedBeanList(Arrays.asList((TypedBean)new TypedBeanImpl().init()));
+	public void i03_setTypedBeanList() {
+		proxy.setTypedBeanList(Arrays.asList((TypedBean)new TypedBeanImpl().init()));
 	}
 
 	@Test
-	public void setTypedBean1d3dList() {
-		getProxy().setTypedBean1d3dList(new AList<TypedBean[][][]>().append(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null}).append(null));
+	public void i04_setTypedBean1d3dList() {
+		proxy.setTypedBean1d3dList(new AList<TypedBean[][][]>().append(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null}).append(null));
 	}
 
 	@Test
-	public void setTypedBeanMap() {
-		getProxy().setTypedBeanMap(new AMap<String,TypedBean>().append("foo",new TypedBeanImpl().init()));
+	public void i05_setTypedBeanMap() {
+		proxy.setTypedBeanMap(new AMap<String,TypedBean>().append("foo",new TypedBeanImpl().init()));
 	}
 
 	@Test
-	public void setTypedBeanListMap() {
-		getProxy().setTypedBeanListMap(new AMap<String,List<TypedBean>>().append("foo",Arrays.asList((TypedBean)new TypedBeanImpl().init())));
+	public void i06_setTypedBeanListMap() {
+		proxy.setTypedBeanListMap(new AMap<String,List<TypedBean>>().append("foo",Arrays.asList((TypedBean)new TypedBeanImpl().init())));
 	}
 
 	@Test
-	public void setTypedBean1d3dListMap() {
-		getProxy().setTypedBean1d3dListMap(new AMap<String,List<TypedBean[][][]>>().append("foo",new AList<TypedBean[][][]>().append(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null}).append(null)));
+	public void i07_setTypedBean1d3dListMap() {
+		proxy.setTypedBean1d3dListMap(new AMap<String,List<TypedBean[][][]>>().append("foo",new AList<TypedBean[][][]>().append(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null}).append(null)));
 	}
 
 	@Test
-	public void setTypedBeanListMapIntegerKeys() {
-		getProxy().setTypedBeanListMapIntegerKeys(new AMap<Integer,List<TypedBean>>().append(1,Arrays.asList((TypedBean)new TypedBeanImpl().init())));
+	public void i08_setTypedBeanListMapIntegerKeys() {
+		proxy.setTypedBeanListMapIntegerKeys(new AMap<Integer,List<TypedBean>>().append(1,Arrays.asList((TypedBean)new TypedBeanImpl().init())));
 	}
 
 	// Swapped POJOs
+
 	@Test
-	public void setSwappedPojo() {
-		getProxy().setSwappedPojo(new SwappedPojo());
+	public void j01_setSwappedPojo() {
+		proxy.setSwappedPojo(new SwappedPojo());
 	}
 
 	@Test
-	public void setSwappedPojo3dArray() {
-		getProxy().setSwappedPojo3dArray(new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null});
+	public void j02_setSwappedPojo3dArray() {
+		proxy.setSwappedPojo3dArray(new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null});
 	}
 
 	@Test
-	public void setSwappedPojoMap() {
-		getProxy().setSwappedPojoMap(new AMap<SwappedPojo,SwappedPojo>().append(new SwappedPojo(), new SwappedPojo()));
+	public void j03_setSwappedPojoMap() {
+		proxy.setSwappedPojoMap(new AMap<SwappedPojo,SwappedPojo>().append(new SwappedPojo(), new SwappedPojo()));
 	}
 
 	@Test
-	public void setSwappedPojo3dMap() {
-		getProxy().setSwappedPojo3dMap(new AMap<SwappedPojo,SwappedPojo[][][]>().append(new SwappedPojo(), new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null}));
+	public void j04_setSwappedPojo3dMap() {
+		proxy.setSwappedPojo3dMap(new AMap<SwappedPojo,SwappedPojo[][][]>().append(new SwappedPojo(), new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null}));
 	}
 
 	// Implicit swapped POJOs
 	@Test
-	public void setImplicitSwappedPojo() {
-		getProxy().setImplicitSwappedPojo(new ImplicitSwappedPojo());
+	public void k01_setImplicitSwappedPojo() {
+		proxy.setImplicitSwappedPojo(new ImplicitSwappedPojo());
 	}
 
 	@Test
-	public void setImplicitSwappedPojo3dArray() {
-		getProxy().setImplicitSwappedPojo3dArray(new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null});
+	public void k02_setImplicitSwappedPojo3dArray() {
+		proxy.setImplicitSwappedPojo3dArray(new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null});
 	}
 
 	@Test
-	public void setImplicitSwappedPojoMap() {
-		getProxy().setImplicitSwappedPojoMap(new AMap<ImplicitSwappedPojo,ImplicitSwappedPojo>().append(new ImplicitSwappedPojo(), new ImplicitSwappedPojo()));
+	public void k03_setImplicitSwappedPojoMap() {
+		proxy.setImplicitSwappedPojoMap(new AMap<ImplicitSwappedPojo,ImplicitSwappedPojo>().append(new ImplicitSwappedPojo(), new ImplicitSwappedPojo()));
 	}
 
 	@Test
-	public void setImplicitSwappedPojo3dMap() {
-		getProxy().setImplicitSwappedPojo3dMap(new AMap<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]>().append(new ImplicitSwappedPojo(), new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null}));
+	public void k04_setImplicitSwappedPojo3dMap() {
+		proxy.setImplicitSwappedPojo3dMap(new AMap<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]>().append(new ImplicitSwappedPojo(), new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null}));
 	}
 
 	// Enums
+
 	@Test
-	public void setEnum() {
-		getProxy().setEnum(TestEnum.TWO);
+	public void l01_setEnum() {
+		proxy.setEnum(TestEnum.TWO);
 	}
 
 	@Test
-	public void setEnum3d() {
-		getProxy().setEnum3d(new TestEnum[][][]{{{TestEnum.TWO,null},null},null});
+	public void l02_setEnum3d() {
+		proxy.setEnum3d(new TestEnum[][][]{{{TestEnum.TWO,null},null},null});
 	}
 
 	@Test
-	public void setEnumList() {
-		getProxy().setEnumList(new AList<TestEnum>().append(TestEnum.TWO).append(null));
+	public void l03_setEnumList() {
+		proxy.setEnumList(new AList<TestEnum>().append(TestEnum.TWO).append(null));
 	}
 
 	@Test
-	public void setEnum3dList() {
-		getProxy().setEnum3dList(
+	public void l04_setEnum3dList() {
+		proxy.setEnum3dList(
 			new AList<List<List<TestEnum>>>()
 			.append(
 				new AList<List<TestEnum>>()
@@ -694,23 +700,23 @@ public class InterfaceProxyTest extends RestTestcase {
 	}
 
 	@Test
-	public void setEnum1d3dList() {
-		getProxy().setEnum1d3dList(new AList<TestEnum[][][]>().append(new TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null));
+	public void l05_setEnum1d3dList() {
+		proxy.setEnum1d3dList(new AList<TestEnum[][][]>().append(new TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null));
 	}
 
 	@Test
-	public void setEnumMap() {
-		getProxy().setEnumMap(new AMap<TestEnum,TestEnum>().append(TestEnum.ONE,TestEnum.TWO));
+	public void l06_setEnumMap() {
+		proxy.setEnumMap(new AMap<TestEnum,TestEnum>().append(TestEnum.ONE,TestEnum.TWO));
 	}
 
 	@Test
-	public void setEnum3dArrayMap() {
-		getProxy().setEnum3dArrayMap(new AMap<TestEnum,TestEnum[][][]>().append(TestEnum.ONE, new TestEnum[][][]{{{TestEnum.TWO,null},null},null}));
+	public void l07_setEnum3dArrayMap() {
+		proxy.setEnum3dArrayMap(new AMap<TestEnum,TestEnum[][][]>().append(TestEnum.ONE, new TestEnum[][][]{{{TestEnum.TWO,null},null},null}));
 	}
 
 	@Test
-	public void setEnum1d3dListMap() {
-		getProxy().setEnum1d3dListMap(new AMap<TestEnum,List<TestEnum[][][]>>().append(TestEnum.ONE, new AList<TestEnum[][][]>().append(new TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null)));
+	public void l08_setEnum1d3dListMap() {
+		proxy.setEnum1d3dListMap(new AMap<TestEnum,List<TestEnum[][][]>>().append(TestEnum.ONE, new AList<TestEnum[][][]>().append(new TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null)));
 	}
 
 	//--------------------------------------------------------------------------------
@@ -718,67 +724,73 @@ public class InterfaceProxyTest extends RestTestcase {
 	//--------------------------------------------------------------------------------
 
 	@Test
-	public void setMultiParamsInts() {
+	public void m01_setMultiParamsInts() {
 		int x1 = 1;
 		int[][][] x2 = new int[][][]{{{1,2},null},null};
 		int[][][] x2n = null;
 		List<int[][][]> x3 = new AList<int[][][]>().append(x2).append(null);
 		List<int[][][]> x3n = null;
-		getProxy().setMultiParamsInts(x1, x2, x2n, x3, x3n);
+		proxy.setMultiParamsInts(x1, x2, x2n, x3, x3n);
 	}
+
 	@Test
-	public void setMultiParamsInteger() {
+	public void m02_setMultiParamsInteger() {
 		Integer x1 = 1;
 		Integer x1n = null;
 		Integer[][][] x2 = new Integer[][][]{{{1,null},null},null};
 		Integer[][][] x2n = null;
 		List<Integer[][][]> x3 = new AList<Integer[][][]>().append(x2).append(null);
 		List<Integer[][][]> x3n = null;
-		getProxy().setMultiParamsInteger(x1, x1n, x2, x2n, x3, x3n);
+		proxy.setMultiParamsInteger(x1, x1n, x2, x2n, x3, x3n);
 	}
+
 	@Test
-	public void setMultiParamsFloat() {
+	public void m03_setMultiParamsFloat() {
 		float x1 = 1;
 		float[][][] x2 = new float[][][]{{{1,2},null},null};
 		float[][][] x2n = null;
 		List<float[][][]> x3 = new AList<float[][][]>().append(x2).append(null);
 		List<float[][][]> x3n = null;
-		getProxy().setMultiParamsFloat(x1, x2, x2n, x3, x3n);
+		proxy.setMultiParamsFloat(x1, x2, x2n, x3, x3n);
 	}
+
 	@Test
-	public void setMultiParamsFloatObject() {
+	public void m04_setMultiParamsFloatObject() {
 		Float x1 = 1f;
 		Float x1n = null;
 		Float[][][] x2 = new Float[][][]{{{1f,null},null},null};
 		Float[][][] x2n = null;
 		List<Float[][][]> x3 = new AList<Float[][][]>().append(x2).append(null);
 		List<Float[][][]> x3n = null;
-		getProxy().setMultiParamsFloatObject(x1, x1n, x2, x2n, x3, x3n);
+		proxy.setMultiParamsFloatObject(x1, x1n, x2, x2n, x3, x3n);
 	}
+
 	@Test
-	public void setMultiParamsString() {
+	public void m05_setMultiParamsString() {
 		String x1 = "foo";
 		String[][][] x2 = new String[][][]{{{"foo",null},null},null};
 		String[][][] x2n = null;
 		List<String[][][]> x3 = new AList<String[][][]>().append(x2).append(null);
 		List<String[][][]> x3n = null;
-		getProxy().setMultiParamsString(x1, x2, x2n, x3, x3n);
+		proxy.setMultiParamsString(x1, x2, x2n, x3, x3n);
 	}
+
 	@Test
-	public void setMultiParamsBean() {
-		Bean x1 = new Bean().init();
-		Bean[][][] x2 = new Bean[][][]{{{new Bean().init(),null},null},null};
-		Bean[][][] x2n = null;
-		List<Bean[][][]> x3 = new AList<Bean[][][]>().append(x2).append(null);
-		List<Bean[][][]> x3n = null;
-		Map<String,Bean> x4 = new AMap<String,Bean>().append("foo",new Bean().init());
-		Map<String,Bean> x4n = null;
-		Map<String,List<Bean[][][]>> x5 = new AMap<String,List<Bean[][][]>>().append("foo", x3);
-		Map<String,List<Bean[][][]>> x5n = null;
-		getProxy().setMultiParamsBean(x1, x2, x2n, x3, x3n, x4, x4n, x5, x5n);
+	public void m06_setMultiParamsBean() {
+		ABean x1 = new ABean().init();
+		ABean[][][] x2 = new ABean[][][]{{{new ABean().init(),null},null},null};
+		ABean[][][] x2n = null;
+		List<ABean[][][]> x3 = new AList<ABean[][][]>().append(x2).append(null);
+		List<ABean[][][]> x3n = null;
+		Map<String,ABean> x4 = new AMap<String,ABean>().append("foo",new ABean().init());
+		Map<String,ABean> x4n = null;
+		Map<String,List<ABean[][][]>> x5 = new AMap<String,List<ABean[][][]>>().append("foo", x3);
+		Map<String,List<ABean[][][]>> x5n = null;
+		proxy.setMultiParamsBean(x1, x2, x2n, x3, x3n, x4, x4n, x5, x5n);
 	}
+
 	@Test
-	public void setMultiParamsSwappedPojo() {
+	public void m07_setMultiParamsSwappedPojo() {
 		SwappedPojo x1 = new SwappedPojo();
 		SwappedPojo[][][] x2 = new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null};
 		SwappedPojo[][][] x2n = null;
@@ -788,10 +800,11 @@ public class InterfaceProxyTest extends RestTestcase {
 		Map<SwappedPojo,SwappedPojo> x4n = null;
 		Map<SwappedPojo,List<SwappedPojo[][][]>> x5 = new AMap<SwappedPojo,List<SwappedPojo[][][]>>().append(new SwappedPojo(), x3);
 		Map<SwappedPojo,List<SwappedPojo[][][]>> x5n = null;
-		getProxy().setMultiParamsSwappedPojo(x1, x2, x2n, x3, x3n, x4, x4n, x5, x5n);
+		proxy.setMultiParamsSwappedPojo(x1, x2, x2n, x3, x3n, x4, x4n, x5, x5n);
 	}
+
 	@Test
-	public void setMultiParamsImplicitSwappedPojo() {
+	public void m08_setMultiParamsImplicitSwappedPojo() {
 		ImplicitSwappedPojo x1 = new ImplicitSwappedPojo();
 		ImplicitSwappedPojo[][][] x2 = new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null};
 		ImplicitSwappedPojo[][][] x2n = null;
@@ -801,10 +814,11 @@ public class InterfaceProxyTest extends RestTestcase {
 		Map<ImplicitSwappedPojo,ImplicitSwappedPojo> x4n = null;
 		Map<ImplicitSwappedPojo,List<ImplicitSwappedPojo[][][]>> x5 = new AMap<ImplicitSwappedPojo,List<ImplicitSwappedPojo[][][]>>().append(new ImplicitSwappedPojo(), x3);
 		Map<ImplicitSwappedPojo,List<ImplicitSwappedPojo[][][]>> x5n = null;
-		getProxy().setMultiParamsImplicitSwappedPojo(x1, x2, x2n, x3, x3n, x4, x4n, x5, x5n);
+		proxy.setMultiParamsImplicitSwappedPojo(x1, x2, x2n, x3, x3n, x4, x4n, x5, x5n);
 	}
+
 	@Test
-	public void setMultiParamsEnum() {
+	public void m09_setMultiParamsEnum() {
 		TestEnum x1 = TestEnum.TWO;
 		TestEnum[][][] x2 = new TestEnum[][][]{{{TestEnum.TWO,null},null},null};
 		TestEnum[][][] x2n = null;
@@ -814,6 +828,6 @@ public class InterfaceProxyTest extends RestTestcase {
 		Map<TestEnum,TestEnum> x4n = null;
 		Map<TestEnum,List<TestEnum[][][]>> x5 = new AMap<TestEnum,List<TestEnum[][][]>>().append(TestEnum.ONE, x3);
 		Map<TestEnum,List<TestEnum[][][]>> x5n = null;
-		getProxy().setMultiParamsEnum(x1, x2, x2n, x3, x3n, x4, x4n, x5, x5n);
+		proxy.setMultiParamsEnum(x1, x2, x2n, x3, x3n, x4, x4n, x5, x5n);
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/RestTestcase.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/RestTestcase.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/RestTestcase.java
index bd6346c..5a85bde 100644
--- a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/RestTestcase.java
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/RestTestcase.java
@@ -28,7 +28,12 @@ import org.junit.*;
 public class RestTestcase {
 
 	private static boolean microserviceStarted;
-	private static List<RestClient> clients = new ArrayList<RestClient>();
+
+	// Reusable RestClients keyed by label that live for the duration of a testcase class.
+	private static Map<String,RestClient> clients = new LinkedHashMap<String,RestClient>();
+
+	// Reusable object cache that lives for the duration of a testcase class.
+	private static Map<String,Object> cache = new LinkedHashMap<String,Object>();
 
 	@BeforeClass
 	public static void setUp() {
@@ -39,31 +44,42 @@ public class RestTestcase {
 	 * Creates a REST client against the test microservice using the specified serializer and parser.
 	 * Client is automatically closed on tear-down.
 	 */
-	protected RestClient getClient(Serializer serializer, Parser parser) {
-		RestClient rc = TestMicroservice.client(serializer, parser).build();
-		clients.add(rc);
-		return rc;
+	protected RestClient getClient(String label, Serializer serializer, Parser parser) {
+		if (! clients.containsKey(label))
+			clients.put(label, TestMicroservice.client(serializer, parser).build());
+		return clients.get(label);
 	}
 
 	/**
-	 * Same as {@link #getClient(Serializer, Parser)} but sets the debug flag on the client.
+	 * Same as {@link #getClient(String, Serializer, Parser)} but sets the debug flag on the client.
 	 */
-	protected RestClient getDebugClient(Serializer serializer, Parser parser) {
-		RestClient rc = TestMicroservice.client(serializer, parser).debug(true).build();
-		clients.add(rc);
-		return rc;
+	protected RestClient getDebugClient(String label, Serializer serializer, Parser parser) {
+		if (! clients.containsKey(label))
+			clients.put(label, TestMicroservice.client(serializer, parser).debug(true).build());
+		return clients.get(label);
+	}
+
+	@SuppressWarnings("unchecked")
+	protected <T> T getCached(String label, Class<T> c) {
+		return (T)cache.get(label);
+	}
+
+	protected void cache(String label, Object o) {
+		cache.put(label, o);
 	}
 
 	@AfterClass
 	public static void tearDown() {
 		if (microserviceStarted)
 			TestMicroservice.stopMicroservice();
-		for (RestClient rc : clients) {
+		for (RestClient rc : clients.values()) {
 			try {
 				rc.close();
 			} catch (IOException e) {
 				e.printStackTrace();
 			}
 		}
+		clients.clear();
+		cache.clear();
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/RestUtilsTest.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/RestUtilsTest.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/RestUtilsTest.java
index 23ad14d..d9d3341 100644
--- a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/RestUtilsTest.java
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/RestUtilsTest.java
@@ -15,6 +15,7 @@ package org.apache.juneau.rest.test;
 import static org.apache.juneau.rest.RestUtils.*;
 import static org.junit.Assert.*;
 
+import org.apache.juneau.internal.*;
 import org.junit.*;
 
 public class RestUtilsTest extends RestTestcase {
@@ -24,8 +25,8 @@ public class RestUtilsTest extends RestTestcase {
 	//====================================================================================================
 	@Test
 	public void testDecode() throws Exception {
-		assertNull(decode(null));
-		assertEquals("foo/bar baz  bing", decode("foo%2Fbar+baz++bing"));
+		assertNull(StringUtils.urlDecode(null));
+		assertEquals("foo/bar baz  bing", StringUtils.urlDecode("foo%2Fbar+baz++bing"));
 	}
 
 	//====================================================================================================
@@ -33,11 +34,11 @@ public class RestUtilsTest extends RestTestcase {
 	//====================================================================================================
 	@Test
 	public void testEncode() throws Exception {
-		assertNull(encode(null));
-		assertEquals("foo%2Fbar+baz++bing", encode("foo/bar baz  bing"));
-		assertEquals("foobar", encode("foobar"));
-		assertEquals("+", encode(" "));
-		assertEquals("%2F", encode("/"));
+		assertNull(StringUtils.urlEncode(null));
+		assertEquals("foo%2Fbar+baz++bing", StringUtils.urlEncode("foo/bar baz  bing"));
+		assertEquals("foobar", StringUtils.urlEncode("foobar"));
+		assertEquals("+", StringUtils.urlEncode(" "));
+		assertEquals("%2F", StringUtils.urlEncode("/"));
 	}
 
 	//====================================================================================================
@@ -146,14 +147,14 @@ public class RestUtilsTest extends RestTestcase {
 	//====================================================================================================
 	@Test
 	public void testTrimSlashes() throws Exception {
-		assertNull(trimSlashes(null));
-		assertEquals("", trimSlashes(""));
-		assertEquals("", trimSlashes("/"));
-		assertEquals("", trimSlashes("//"));
-		assertEquals("foo/bar", trimSlashes("foo/bar"));
-		assertEquals("foo/bar", trimSlashes("foo/bar//"));
-		assertEquals("foo/bar", trimSlashes("/foo/bar//"));
-		assertEquals("foo/bar", trimSlashes("//foo/bar//"));
+		assertNull(StringUtils.trimSlashes(null));
+		assertEquals("", StringUtils.trimSlashes(""));
+		assertEquals("", StringUtils.trimSlashes("/"));
+		assertEquals("", StringUtils.trimSlashes("//"));
+		assertEquals("foo/bar", StringUtils.trimSlashes("foo/bar"));
+		assertEquals("foo/bar", StringUtils.trimSlashes("foo/bar//"));
+		assertEquals("foo/bar", StringUtils.trimSlashes("/foo/bar//"));
+		assertEquals("foo/bar", StringUtils.trimSlashes("//foo/bar//"));
 	}
 
 	//====================================================================================================
@@ -161,14 +162,14 @@ public class RestUtilsTest extends RestTestcase {
 	//====================================================================================================
 	@Test
 	public void testTrimTrailingSlashes() throws Exception {
-		assertNull(trimTrailingSlashes((String)null));
-		assertEquals("", trimTrailingSlashes(""));
-		assertEquals("", trimTrailingSlashes("/"));
-		assertEquals("", trimTrailingSlashes("//"));
-		assertEquals("foo/bar", trimTrailingSlashes("foo/bar"));
-		assertEquals("foo/bar", trimTrailingSlashes("foo/bar//"));
-		assertEquals("/foo/bar", trimTrailingSlashes("/foo/bar//"));
-		assertEquals("//foo/bar", trimTrailingSlashes("//foo/bar//"));
+		assertNull(StringUtils.trimTrailingSlashes((String)null));
+		assertEquals("", StringUtils.trimTrailingSlashes(""));
+		assertEquals("", StringUtils.trimTrailingSlashes("/"));
+		assertEquals("", StringUtils.trimTrailingSlashes("//"));
+		assertEquals("foo/bar", StringUtils.trimTrailingSlashes("foo/bar"));
+		assertEquals("foo/bar", StringUtils.trimTrailingSlashes("foo/bar//"));
+		assertEquals("/foo/bar", StringUtils.trimTrailingSlashes("/foo/bar//"));
+		assertEquals("//foo/bar", StringUtils.trimTrailingSlashes("//foo/bar//"));
 	}
 
 	//====================================================================================================
@@ -176,13 +177,13 @@ public class RestUtilsTest extends RestTestcase {
 	//====================================================================================================
 	@Test
 	public void testTrimTrailingSlashes2() throws Exception {
-		assertNull(trimTrailingSlashes((StringBuffer)null));
-		assertEquals("", trimTrailingSlashes(new StringBuffer("")).toString());
-		assertEquals("", trimTrailingSlashes(new StringBuffer("/")).toString());
-		assertEquals("", trimTrailingSlashes(new StringBuffer("//")).toString());
-		assertEquals("foo/bar", trimTrailingSlashes(new StringBuffer("foo/bar")).toString());
-		assertEquals("foo/bar", trimTrailingSlashes(new StringBuffer("foo/bar//")).toString());
-		assertEquals("/foo/bar", trimTrailingSlashes(new StringBuffer("/foo/bar//")).toString());
-		assertEquals("//foo/bar", trimTrailingSlashes(new StringBuffer("//foo/bar//")).toString());
+		assertNull(StringUtils.trimTrailingSlashes((StringBuffer)null));
+		assertEquals("", StringUtils.trimTrailingSlashes(new StringBuffer("")).toString());
+		assertEquals("", StringUtils.trimTrailingSlashes(new StringBuffer("/")).toString());
+		assertEquals("", StringUtils.trimTrailingSlashes(new StringBuffer("//")).toString());
+		assertEquals("foo/bar", StringUtils.trimTrailingSlashes(new StringBuffer("foo/bar")).toString());
+		assertEquals("foo/bar", StringUtils.trimTrailingSlashes(new StringBuffer("foo/bar//")).toString());
+		assertEquals("/foo/bar", StringUtils.trimTrailingSlashes(new StringBuffer("/foo/bar//")).toString());
+		assertEquals("//foo/bar", StringUtils.trimTrailingSlashes(new StringBuffer("//foo/bar//")).toString());
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/TestUtils.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/TestUtils.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/TestUtils.java
deleted file mode 100644
index 102c17e..0000000
--- a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/TestUtils.java
+++ /dev/null
@@ -1,79 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
-// * with the License.  You may obtain a copy of the License at                                                              *
-// *                                                                                                                         *
-// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
-// *                                                                                                                         *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
-// * specific language governing permissions and limitations under the License.                                              *
-// ***************************************************************************************************************************
-package org.apache.juneau.rest.test;
-
-import java.text.*;
-
-import org.apache.juneau.json.*;
-import org.apache.juneau.rest.client.*;
-import org.apache.juneau.serializer.*;
-import org.apache.juneau.transforms.*;
-import org.junit.Assert;
-
-import junit.framework.*;
-
-public class TestUtils {
-
-	private static JsonSerializer js2 = new JsonSerializerBuilder()
-		.simple()
-		.pojoSwaps(IteratorSwap.class, EnumerationSwap.class)
-		.build();
-
-	/**
-	 * Assert that the object equals the specified string after running it through JsonSerializer.DEFAULT_LAX.toString().
-	 */
-	public static void assertObjectEquals(String s, Object o) {
-		assertObjectEquals(s, o, js2);
-	}
-
-	/**
-	 * Assert that the object is an instance of the specified class.
-	 */
-	public static void assertClass(Class<?> c, Object o) {
-		Assert.assertEquals(c, o == null ? null : o.getClass());
-	}
-
-	/**
-	 * Assert that the object equals the specified string after running it through ws.toString().
-	 */
-	public static void assertObjectEquals(String s, Object o, WriterSerializer ws) {
-		Assert.assertEquals(s, ws.toString(o));
-	}
-
-	public static void checkErrorResponse(boolean debug, RestCallException e, int status, String...contains) throws AssertionFailedError {
-		String r = e.getResponseMessage();
-		if (debug) {
-			System.err.println(r); // NOT DEBUG
-			e.printStackTrace();
-		}
-		if (status != e.getResponseCode()) {
-			dumpResponse(r, "Response status code was not correct.  Expected: ''{0}''.  Actual: ''{1}''", status, e.getResponseCode());
-			throw new AssertionFailedError(MessageFormat.format("Response status code was not correct.  Expected: ''{0}''.  Actual: ''{1}''", status, e.getResponseCode()));
-		}
-		for (String s : contains) {
-			if (r == null || ! r.contains(s)) {
-				if (! debug)
-					dumpResponse(r, "Response did not have the following expected text: ''{0}''", s);
-				throw new AssertionFailedError(MessageFormat.format("Response did not have the following expected text: ''{0}''", s));
-			}
-		}
-	}
-
-	private static void dumpResponse(String r, String msg, Object...args) {
-		System.err.println("*** Failure ****************************************************************************************"); // NOT DEBUG
-		System.err.println(MessageFormat.format(msg, args));
-		System.err.println("*** Response-Start *********************************************************************************"); // NOT DEBUG
-		System.err.println(r); // NOT DEBUG
-		System.err.println("*** Response-End ***********************************************************************************"); // NOT DEBUG
-	}
-}


[2/7] incubator-juneau git commit: Support for 3rd-party proxy interfaces.

Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ThirdPartyProxyTest.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ThirdPartyProxyTest.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ThirdPartyProxyTest.java
new file mode 100644
index 0000000..2f69bb1
--- /dev/null
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ThirdPartyProxyTest.java
@@ -0,0 +1,1627 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.rest.test;
+
+import static org.apache.juneau.rest.test.TestUtils.*;
+import static org.apache.juneau.rest.test.pojos.Constants.*;
+import static org.junit.Assert.*;
+
+import java.util.*;
+
+import org.apache.juneau.html.*;
+import org.apache.juneau.jena.*;
+import org.apache.juneau.json.*;
+import org.apache.juneau.msgpack.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.remoteable.*;
+import org.apache.juneau.rest.test.pojos.*;
+import org.apache.juneau.serializer.*;
+import org.apache.juneau.uon.*;
+import org.apache.juneau.urlencoding.*;
+import org.apache.juneau.utils.*;
+import org.apache.juneau.xml.*;
+import org.junit.*;
+import org.junit.runner.*;
+import org.junit.runners.*;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@RunWith(Parameterized.class)
+public class ThirdPartyProxyTest extends RestTestcase {
+
+	@Parameterized.Parameters
+	public static Collection<Object[]> getParameters() {
+		return Arrays.asList(new Object[][] {
+			{ /* 0 */ "Json", JsonSerializer.DEFAULT, JsonParser.DEFAULT },
+			{ /* 1 */ "Xml", XmlSerializer.DEFAULT, XmlParser.DEFAULT },
+			{ /* 2 */ "Mixed", JsonSerializer.DEFAULT, XmlParser.DEFAULT },
+			{ /* 3 */ "Html", HtmlSerializer.DEFAULT, HtmlParser.DEFAULT },
+			{ /* 4 */ "MessagePack", MsgPackSerializer.DEFAULT, MsgPackParser.DEFAULT },
+			{ /* 5 */ "UrlEncoding", UrlEncodingSerializer.DEFAULT, UrlEncodingParser.DEFAULT },
+			{ /* 6 */ "Uon", UonSerializer.DEFAULT, UonParser.DEFAULT },
+			{ /* 7 */ "RdfXml", RdfSerializer.DEFAULT_XMLABBREV, RdfParser.DEFAULT_XML },
+		});
+	}
+
+	private ThirdPartyProxy proxy;
+
+	public ThirdPartyProxyTest(String label, Serializer serializer, Parser parser) {
+		proxy = getCached(label, ThirdPartyProxy.class);
+		if (proxy == null) {
+			this.proxy = getClient(label, serializer, parser).getRemoteableProxy(ThirdPartyProxy.class, null, serializer, parser);
+			cache(label, proxy);
+		}
+	}
+
+	//--------------------------------------------------------------------------------
+	// Header tests
+	//--------------------------------------------------------------------------------
+
+	@Test
+	public void a01_primitiveHeaders() throws Exception {
+		String r = proxy.primitiveHeaders(
+			"foo",
+			null,
+			123,
+			123,
+			null,
+			true,
+			1.0f,
+			1.0f
+		);
+		assertEquals("OK", r);
+	}
+
+	@Test
+	public void a02_primitiveCollectionHeaders() throws Exception {
+		String r = proxy.primitiveCollectionHeaders(
+			new int[][][]{{{1,2},null},null},
+			new Integer[][][]{{{1,null},null},null},
+			new String[][][]{{{"foo",null},null},null},
+			new AList<Integer>().append(1).append(null),
+			new AList<List<List<Integer>>>()
+				.append(
+					new AList<List<Integer>>()
+					.append(new AList<Integer>().append(1).append(null))
+					.append(null)
+				)
+				.append(null)
+			,
+			new AList<Integer[][][]>().append(new Integer[][][]{{{1,null},null},null}).append(null),
+			new AList<int[][][]>().append(new int[][][]{{{1,2},null},null}).append(null),
+			Arrays.asList("foo","bar",null)
+		);
+		assertEquals("OK", r);
+	}
+
+	@Test
+	public void a03_beanHeaders() throws Exception {
+		String r = proxy.beanHeaders(
+			new ABean().init(),
+			null,
+			new ABean[][][]{{{new ABean().init(),null},null},null},
+			new AList<ABean>().append(new ABean().init()).append(null),
+			new AList<ABean[][][]>().append(new ABean[][][]{{{new ABean().init(),null},null},null}).append(null),
+			new AMap<String,ABean>().append("foo",new ABean().init()),
+			new AMap<String,List<ABean>>().append("foo",Arrays.asList(new ABean().init())),
+			new AMap<String,List<ABean[][][]>>().append("foo",new AList<ABean[][][]>().append(new ABean[][][]{{{new ABean().init(),null},null},null}).append(null)),
+			new AMap<Integer,List<ABean>>().append(1,Arrays.asList(new ABean().init()))
+		);
+		assertEquals("OK", r);
+	}
+
+
+	@Test
+	public void a04_typedBeanHeaders() throws Exception {
+		String r = proxy.typedBeanHeaders(
+			new TypedBeanImpl().init(),
+			null,
+			new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null},
+			new AList<TypedBean>().append(new TypedBeanImpl().init()).append(null),
+			new AList<TypedBean[][][]>().append(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null}).append(null),
+			new AMap<String,TypedBean>().append("foo",new TypedBeanImpl().init()),
+			new AMap<String,List<TypedBean>>().append("foo",Arrays.asList((TypedBean)new TypedBeanImpl().init())),
+			new AMap<String,List<TypedBean[][][]>>().append("foo",new AList<TypedBean[][][]>().append(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null}).append(null)),
+			new AMap<Integer,List<TypedBean>>().append(1,Arrays.asList((TypedBean)new TypedBeanImpl().init()))
+		);
+		assertEquals("OK", r);
+	}
+
+	@Test
+	public void a05_swappedPojoHeaders() throws Exception {
+		String r = proxy.swappedPojoHeaders(
+			new SwappedPojo(),
+			new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null},
+			new AMap<SwappedPojo,SwappedPojo>().append(new SwappedPojo(), new SwappedPojo()),
+			new AMap<SwappedPojo,SwappedPojo[][][]>().append(new SwappedPojo(), new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null})
+		);
+		assertEquals("OK", r);
+	}
+
+	@Test
+	public void a06_implicitSwappedPojoHeaders() throws Exception {
+		String r = proxy.implicitSwappedPojoHeaders(
+			new ImplicitSwappedPojo(),
+			new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null},
+			new AMap<ImplicitSwappedPojo,ImplicitSwappedPojo>().append(new ImplicitSwappedPojo(), new ImplicitSwappedPojo()),
+			new AMap<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]>().append(new ImplicitSwappedPojo(), new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null})
+		);
+		assertEquals("OK", r);
+	}
+
+	@Test
+	public void a07_enumHeaders() throws Exception {
+		String r = proxy.enumHeaders(
+			TestEnum.TWO,
+			null,
+			new TestEnum[][][]{{{TestEnum.TWO,null},null},null},
+			new AList<TestEnum>().append(TestEnum.TWO).append(null),
+			new AList<List<List<TestEnum>>>()
+				.append(
+					new AList<List<TestEnum>>()
+						.append(
+							new AList<TestEnum>().append(TestEnum.TWO).append(null)
+						)
+					.append(null)
+				).append(null),
+			new AList<TestEnum[][][]>().append(new TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null),
+			new AMap<TestEnum,TestEnum>().append(TestEnum.ONE,TestEnum.TWO),
+			new AMap<TestEnum,TestEnum[][][]>().append(TestEnum.ONE, new TestEnum[][][]{{{TestEnum.TWO,null},null},null}),
+			new AMap<TestEnum,List<TestEnum[][][]>>().append(TestEnum.ONE, new AList<TestEnum[][][]>().append(new TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null))
+		);
+		assertEquals("OK", r);
+	}
+
+	//--------------------------------------------------------------------------------
+	// Query tests
+	//--------------------------------------------------------------------------------
+
+	@Test
+	public void b01_primitiveQueries() throws Exception {
+		String r = proxy.primitiveQueries(
+			"foo",
+			null,
+			123,
+			123,
+			null,
+			true,
+			1.0f,
+			1.0f
+		);
+		assertEquals("OK", r);
+	}
+
+	@Test
+	public void b02_primitiveCollectionQueries() throws Exception {
+		String r = proxy.primitiveCollectionQueries(
+			new int[][][]{{{1,2},null},null},
+			new Integer[][][]{{{1,null},null},null},
+			new String[][][]{{{"foo",null},null},null},
+			new AList<Integer>().append(1).append(null),
+			new AList<List<List<Integer>>>()
+				.append(
+					new AList<List<Integer>>()
+					.append(new AList<Integer>().append(1).append(null))
+					.append(null)
+				)
+				.append(null)
+			,
+			new AList<Integer[][][]>().append(new Integer[][][]{{{1,null},null},null}).append(null),
+			new AList<int[][][]>().append(new int[][][]{{{1,2},null},null}).append(null),
+			Arrays.asList("foo","bar",null)
+		);
+		assertEquals("OK", r);
+	}
+
+	@Test
+	public void b03_beanQueries() throws Exception {
+		String r = proxy.beanQueries(
+			new ABean().init(),
+			null,
+			new ABean[][][]{{{new ABean().init(),null},null},null},
+			new AList<ABean>().append(new ABean().init()).append(null),
+			new AList<ABean[][][]>().append(new ABean[][][]{{{new ABean().init(),null},null},null}).append(null),
+			new AMap<String,ABean>().append("foo",new ABean().init()),
+			new AMap<String,List<ABean>>().append("foo",Arrays.asList(new ABean().init())),
+			new AMap<String,List<ABean[][][]>>().append("foo",new AList<ABean[][][]>().append(new ABean[][][]{{{new ABean().init(),null},null},null}).append(null)),
+			new AMap<Integer,List<ABean>>().append(1,Arrays.asList(new ABean().init()))
+		);
+		assertEquals("OK", r);
+	}
+
+
+	@Test
+	public void b04_typedBeanQueries() throws Exception {
+		String r = proxy.typedBeanQueries(
+			new TypedBeanImpl().init(),
+			null,
+			new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null},
+			new AList<TypedBean>().append(new TypedBeanImpl().init()).append(null),
+			new AList<TypedBean[][][]>().append(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null}).append(null),
+			new AMap<String,TypedBean>().append("foo",new TypedBeanImpl().init()),
+			new AMap<String,List<TypedBean>>().append("foo",Arrays.asList((TypedBean)new TypedBeanImpl().init())),
+			new AMap<String,List<TypedBean[][][]>>().append("foo",new AList<TypedBean[][][]>().append(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null}).append(null)),
+			new AMap<Integer,List<TypedBean>>().append(1,Arrays.asList((TypedBean)new TypedBeanImpl().init()))
+		);
+		assertEquals("OK", r);
+	}
+
+	@Test
+	public void b05_swappedPojoQueries() throws Exception {
+		String r = proxy.swappedPojoQueries(
+			new SwappedPojo(),
+			new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null},
+			new AMap<SwappedPojo,SwappedPojo>().append(new SwappedPojo(), new SwappedPojo()),
+			new AMap<SwappedPojo,SwappedPojo[][][]>().append(new SwappedPojo(), new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null})
+		);
+		assertEquals("OK", r);
+	}
+
+	@Test
+	public void b06_implicitSwappedPojoQueries() throws Exception {
+		String r = proxy.implicitSwappedPojoQueries(
+			new ImplicitSwappedPojo(),
+			new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null},
+			new AMap<ImplicitSwappedPojo,ImplicitSwappedPojo>().append(new ImplicitSwappedPojo(), new ImplicitSwappedPojo()),
+			new AMap<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]>().append(new ImplicitSwappedPojo(), new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null})
+		);
+		assertEquals("OK", r);
+	}
+
+	@Test
+	public void b07_enumQueries() throws Exception {
+		String r = proxy.enumQueries(
+			TestEnum.TWO,
+			null,
+			new TestEnum[][][]{{{TestEnum.TWO,null},null},null},
+			new AList<TestEnum>().append(TestEnum.TWO).append(null),
+			new AList<List<List<TestEnum>>>()
+				.append(
+					new AList<List<TestEnum>>()
+						.append(
+							new AList<TestEnum>().append(TestEnum.TWO).append(null)
+						)
+					.append(null)
+				).append(null),
+			new AList<TestEnum[][][]>().append(new TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null),
+			new AMap<TestEnum,TestEnum>().append(TestEnum.ONE,TestEnum.TWO),
+			new AMap<TestEnum,TestEnum[][][]>().append(TestEnum.ONE, new TestEnum[][][]{{{TestEnum.TWO,null},null},null}),
+			new AMap<TestEnum,List<TestEnum[][][]>>().append(TestEnum.ONE, new AList<TestEnum[][][]>().append(new TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null))
+		);
+		assertEquals("OK", r);
+	}
+
+	//--------------------------------------------------------------------------------
+	// FormData tests
+	//--------------------------------------------------------------------------------
+
+	@Test
+	public void c01_primitiveFormData() throws Exception {
+		String r = proxy.primitiveFormData(
+			"foo",
+			null,
+			123,
+			123,
+			null,
+			true,
+			1.0f,
+			1.0f
+		);
+		assertEquals("OK", r);
+	}
+
+	@Test
+	public void c02_primitiveCollectionFormData() throws Exception {
+		String r = proxy.primitiveCollectionFormData(
+			new int[][][]{{{1,2},null},null},
+			new Integer[][][]{{{1,null},null},null},
+			new String[][][]{{{"foo",null},null},null},
+			new AList<Integer>().append(1).append(null),
+			new AList<List<List<Integer>>>()
+				.append(
+					new AList<List<Integer>>()
+					.append(new AList<Integer>().append(1).append(null))
+					.append(null)
+				)
+				.append(null)
+			,
+			new AList<Integer[][][]>().append(new Integer[][][]{{{1,null},null},null}).append(null),
+			new AList<int[][][]>().append(new int[][][]{{{1,2},null},null}).append(null),
+			Arrays.asList("foo","bar",null)
+		);
+		assertEquals("OK", r);
+	}
+
+	@Test
+	public void c03_beanFormData() throws Exception {
+		String r = proxy.beanFormData(
+			new ABean().init(),
+			null,
+			new ABean[][][]{{{new ABean().init(),null},null},null},
+			new AList<ABean>().append(new ABean().init()).append(null),
+			new AList<ABean[][][]>().append(new ABean[][][]{{{new ABean().init(),null},null},null}).append(null),
+			new AMap<String,ABean>().append("foo",new ABean().init()),
+			new AMap<String,List<ABean>>().append("foo",Arrays.asList(new ABean().init())),
+			new AMap<String,List<ABean[][][]>>().append("foo",new AList<ABean[][][]>().append(new ABean[][][]{{{new ABean().init(),null},null},null}).append(null)),
+			new AMap<Integer,List<ABean>>().append(1,Arrays.asList(new ABean().init()))
+		);
+		assertEquals("OK", r);
+	}
+
+
+	@Test
+	public void c04_typedBeanFormData() throws Exception {
+		String r = proxy.typedBeanFormData(
+			new TypedBeanImpl().init(),
+			null,
+			new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null},
+			new AList<TypedBean>().append(new TypedBeanImpl().init()).append(null),
+			new AList<TypedBean[][][]>().append(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null}).append(null),
+			new AMap<String,TypedBean>().append("foo",new TypedBeanImpl().init()),
+			new AMap<String,List<TypedBean>>().append("foo",Arrays.asList((TypedBean)new TypedBeanImpl().init())),
+			new AMap<String,List<TypedBean[][][]>>().append("foo",new AList<TypedBean[][][]>().append(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null}).append(null)),
+			new AMap<Integer,List<TypedBean>>().append(1,Arrays.asList((TypedBean)new TypedBeanImpl().init()))
+		);
+		assertEquals("OK", r);
+	}
+
+	@Test
+	public void c05_swappedPojoFormData() throws Exception {
+		String r = proxy.swappedPojoFormData(
+			new SwappedPojo(),
+			new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null},
+			new AMap<SwappedPojo,SwappedPojo>().append(new SwappedPojo(), new SwappedPojo()),
+			new AMap<SwappedPojo,SwappedPojo[][][]>().append(new SwappedPojo(), new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null})
+		);
+		assertEquals("OK", r);
+	}
+
+	@Test
+	public void c06_implicitSwappedPojoFormData() throws Exception {
+		String r = proxy.implicitSwappedPojoFormData(
+			new ImplicitSwappedPojo(),
+			new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null},
+			new AMap<ImplicitSwappedPojo,ImplicitSwappedPojo>().append(new ImplicitSwappedPojo(), new ImplicitSwappedPojo()),
+			new AMap<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]>().append(new ImplicitSwappedPojo(), new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null})
+		);
+		assertEquals("OK", r);
+	}
+
+	@Test
+	public void c07_enumFormData() throws Exception {
+		String r = proxy.enumFormData(
+			TestEnum.TWO,
+			null,
+			new TestEnum[][][]{{{TestEnum.TWO,null},null},null},
+			new AList<TestEnum>().append(TestEnum.TWO).append(null),
+			new AList<List<List<TestEnum>>>()
+				.append(
+					new AList<List<TestEnum>>()
+						.append(
+							new AList<TestEnum>().append(TestEnum.TWO).append(null)
+						)
+					.append(null)
+				).append(null),
+			new AList<TestEnum[][][]>().append(new TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null),
+			new AMap<TestEnum,TestEnum>().append(TestEnum.ONE,TestEnum.TWO),
+			new AMap<TestEnum,TestEnum[][][]>().append(TestEnum.ONE, new TestEnum[][][]{{{TestEnum.TWO,null},null},null}),
+			new AMap<TestEnum,List<TestEnum[][][]>>().append(TestEnum.ONE, new AList<TestEnum[][][]>().append(new TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null))
+		);
+		assertEquals("OK", r);
+	}
+
+	//--------------------------------------------------------------------------------
+	// Test return types.
+	//--------------------------------------------------------------------------------
+
+	// Various primitives
+	@Test
+	public void da01_returnVoid() {
+		proxy.returnVoid();
+	}
+
+	@Test
+	public void da02_returnInteger() {
+		assertEquals((Integer)1, proxy.returnInteger());
+	}
+
+	@Test
+	public void da03_returnInt() {
+		assertEquals(1, proxy.returnInt());
+	}
+
+	@Test
+	public void da04_returnBoolean() {
+		assertEquals(true, proxy.returnBoolean());
+	}
+
+	@Test
+	public void da05_returnFloat() {
+		assertTrue(1f == proxy.returnFloat());
+	}
+
+	@Test
+	public void da06_returnFloatObject() {
+		assertTrue(1f == proxy.returnFloatObject());
+	}
+
+	@Test
+	public void da07_returnString() {
+		assertEquals("foobar", proxy.returnString());
+	}
+
+	@Test
+	public void da08_returnNullString() {
+		assertNull(proxy.returnNullString());
+	}
+
+	@Test
+	public void da09_returnInt3dArray() {
+		assertObjectEquals("[[[1,2],null],null]", proxy.returnInt3dArray());
+	}
+
+	@Test
+	public void da10_returnInteger3dArray() {
+		assertObjectEquals("[[[1,null],null],null]", proxy.returnInteger3dArray());
+	}
+
+	@Test
+	public void da11_returnString3dArray() {
+		assertObjectEquals("[[['foo','bar',null],null],null]", proxy.returnString3dArray());
+	}
+
+	@Test
+	public void da12_returnIntegerList() {
+		List<Integer> x = proxy.returnIntegerList();
+		assertObjectEquals("[1,null]", x);
+		assertClass(Integer.class, x.get(0));
+	}
+
+	@Test
+	public void da13_returnInteger3dList() {
+		List<List<List<Integer>>> x = proxy.returnInteger3dList();
+		assertObjectEquals("[[[1,null],null],null]", x);
+		assertClass(Integer.class, x.get(0).get(0).get(0));
+	}
+
+	@Test
+	public void da14_returnInteger1d3dList() {
+		List<Integer[][][]> x = proxy.returnInteger1d3dList();
+		assertObjectEquals("[[[[1,null],null],null],null]", x);
+		assertClass(Integer.class, x.get(0)[0][0][0]);
+	}
+
+	@Test
+	public void da15_returnInt1d3dList() {
+		List<int[][][]> x = proxy.returnInt1d3dList();
+		assertObjectEquals("[[[[1,2],null],null],null]", x);
+		assertClass(int[][][].class, x.get(0));
+	}
+
+	@Test
+	public void da16_returnStringList() {
+		assertObjectEquals("['foo','bar',null]", proxy.returnStringList());
+	}
+
+	// Beans
+
+	@Test
+	public void db01_returnBean() {
+		ABean x = proxy.returnBean();
+		assertObjectEquals("{a:1,b:'foo'}", x);
+		assertClass(ABean.class, x);
+	}
+
+	@Test
+	public void db02_returnBean3dArray() {
+		ABean[][][] x = proxy.returnBean3dArray();
+		assertObjectEquals("[[[{a:1,b:'foo'},null],null],null]", x);
+		assertClass(ABean.class, x[0][0][0]);
+	}
+
+	@Test
+	public void db03_returnBeanList() {
+		List<ABean> x = proxy.returnBeanList();
+		assertObjectEquals("[{a:1,b:'foo'}]", x);
+		assertClass(ABean.class, x.get(0));
+	}
+
+	@Test
+	public void db04_returnBean1d3dList() {
+		List<ABean[][][]> x = proxy.returnBean1d3dList();
+		assertObjectEquals("[[[[{a:1,b:'foo'},null],null],null],null]", x);
+		assertClass(ABean.class, x.get(0)[0][0][0]);
+	}
+
+	@Test
+	public void db05_returnBeanMap() {
+		Map<String,ABean> x = proxy.returnBeanMap();
+		assertObjectEquals("{foo:{a:1,b:'foo'}}", x);
+		assertClass(ABean.class, x.get("foo"));
+	}
+
+	@Test
+	public void db06_returnBeanListMap() {
+		Map<String,List<ABean>> x = proxy.returnBeanListMap();
+		assertObjectEquals("{foo:[{a:1,b:'foo'}]}", x);
+		assertClass(ABean.class, x.get("foo").get(0));
+	}
+
+	@Test
+	public void db07_returnBean1d3dListMap() {
+		Map<String,List<ABean[][][]>> x = proxy.returnBean1d3dListMap();
+		assertObjectEquals("{foo:[[[[{a:1,b:'foo'},null],null],null],null]}", x);
+		assertClass(ABean.class, x.get("foo").get(0)[0][0][0]);
+	}
+
+	@Test
+	public void db08_returnBeanListMapIntegerKeys() {
+		// Note: JsonSerializer serializes key as string.
+		Map<Integer,List<ABean>> x = proxy.returnBeanListMapIntegerKeys();
+		assertObjectEquals("{'1':[{a:1,b:'foo'}]}", x);
+		assertClass(Integer.class, x.keySet().iterator().next());
+	}
+
+	// Typed beans
+
+	@Test
+	public void dc01_returnTypedBean() {
+		TypedBean x = proxy.returnTypedBean();
+		assertObjectEquals("{_type:'TypedBeanImpl',a:1,b:'foo'}", x);
+		assertClass(TypedBeanImpl.class, x);
+	}
+
+	@Test
+	public void dc02_returnTypedBean3dArray() {
+		TypedBean[][][] x = proxy.returnTypedBean3dArray();
+		assertObjectEquals("[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null]", x);
+		assertClass(TypedBeanImpl.class, x[0][0][0]);
+	}
+
+	@Test
+	public void dc03_returnTypedBeanList() {
+		List<TypedBean> x = proxy.returnTypedBeanList();
+		assertObjectEquals("[{_type:'TypedBeanImpl',a:1,b:'foo'}]", x);
+		assertClass(TypedBeanImpl.class, x.get(0));
+	}
+
+	@Test
+	public void dc04_returnTypedBean1d3dList() {
+		List<TypedBean[][][]> x = proxy.returnTypedBean1d3dList();
+		assertObjectEquals("[[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null],null]", x);
+		assertClass(TypedBeanImpl.class, x.get(0)[0][0][0]);
+	}
+
+	@Test
+	public void dc05_returnTypedBeanMap() {
+		Map<String,TypedBean> x = proxy.returnTypedBeanMap();
+		assertObjectEquals("{foo:{_type:'TypedBeanImpl',a:1,b:'foo'}}", x);
+		assertClass(TypedBeanImpl.class, x.get("foo"));
+	}
+
+	@Test
+	public void dc06_returnTypedBeanListMap() {
+		Map<String,List<TypedBean>> x = proxy.returnTypedBeanListMap();
+		assertObjectEquals("{foo:[{_type:'TypedBeanImpl',a:1,b:'foo'}]}", x);
+		assertClass(TypedBeanImpl.class, x.get("foo").get(0));
+	}
+
+	@Test
+	public void dc07_returnTypedBean1d3dListMap() {
+		Map<String,List<TypedBean[][][]>> x = proxy.returnTypedBean1d3dListMap();
+		assertObjectEquals("{foo:[[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null],null]}", x);
+		assertClass(TypedBeanImpl.class, x.get("foo").get(0)[0][0][0]);
+	}
+
+	@Test
+	public void dc08_returnTypedBeanListMapIntegerKeys() {
+		// Note: JsonSerializer serializes key as string.
+		Map<Integer,List<TypedBean>> x = proxy.returnTypedBeanListMapIntegerKeys();
+		assertObjectEquals("{'1':[{_type:'TypedBeanImpl',a:1,b:'foo'}]}", x);
+		assertClass(TypedBeanImpl.class, x.get(1).get(0));
+	}
+
+	// Swapped POJOs
+
+	@Test
+	public void dd01_returnSwappedPojo() {
+		SwappedPojo x = proxy.returnSwappedPojo();
+		assertObjectEquals("'"+SWAP+"'", x);
+		assertTrue(x.wasUnswapped);
+	}
+
+	@Test
+	public void dd02_returnSwappedPojo3dArray() {
+		SwappedPojo[][][] x = proxy.returnSwappedPojo3dArray();
+		assertObjectEquals("[[['"+SWAP+"',null],null],null]", x);
+		assertTrue(x[0][0][0].wasUnswapped);
+	}
+
+	@Test
+	public void dd03_returnSwappedPojoMap() {
+		Map<SwappedPojo,SwappedPojo> x = proxy.returnSwappedPojoMap();
+		assertObjectEquals("{'"+SWAP+"':'"+SWAP+"'}", x);
+		Map.Entry<SwappedPojo,SwappedPojo> e = x.entrySet().iterator().next();
+		assertTrue(e.getKey().wasUnswapped);
+		assertTrue(e.getValue().wasUnswapped);
+	}
+
+	@Test
+	public void dd04_returnSwappedPojo3dMap() {
+		Map<SwappedPojo,SwappedPojo[][][]> x = proxy.returnSwappedPojo3dMap();
+		assertObjectEquals("{'"+SWAP+"':[[['"+SWAP+"',null],null],null]}", x);
+		Map.Entry<SwappedPojo,SwappedPojo[][][]> e = x.entrySet().iterator().next();
+		assertTrue(e.getKey().wasUnswapped);
+		assertTrue(e.getValue()[0][0][0].wasUnswapped);
+	}
+
+	// Implicit swapped POJOs
+
+	@Test
+	public void de01_returnImplicitSwappedPojo() {
+		ImplicitSwappedPojo x = proxy.returnImplicitSwappedPojo();
+		assertObjectEquals("'"+SWAP+"'", x);
+		assertTrue(x.wasUnswapped);
+	}
+
+	@Test
+	public void de02_returnImplicitSwappedPojo3dArray() {
+		ImplicitSwappedPojo[][][] x = proxy.returnImplicitSwappedPojo3dArray();
+		assertObjectEquals("[[['"+SWAP+"',null],null],null]", x);
+		assertTrue(x[0][0][0].wasUnswapped);
+	}
+
+	@Test
+	public void de03_returnImplicitSwappedPojoMap() {
+		Map<ImplicitSwappedPojo,ImplicitSwappedPojo> x = proxy.returnImplicitSwappedPojoMap();
+		assertObjectEquals("{'"+SWAP+"':'"+SWAP+"'}", x);
+		Map.Entry<ImplicitSwappedPojo,ImplicitSwappedPojo> e = x.entrySet().iterator().next();
+		assertTrue(e.getKey().wasUnswapped);
+		assertTrue(e.getValue().wasUnswapped);
+	}
+
+	@Test
+	public void de04_returnImplicitSwappedPojo3dMap() {
+		Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> x = proxy.returnImplicitSwappedPojo3dMap();
+		assertObjectEquals("{'"+SWAP+"':[[['"+SWAP+"',null],null],null]}", x);
+		Map.Entry<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> e = x.entrySet().iterator().next();
+		assertTrue(e.getKey().wasUnswapped);
+		assertTrue(e.getValue()[0][0][0].wasUnswapped);
+	}
+
+	// Enums
+
+	@Test
+	public void df01_returnEnum() {
+		TestEnum x = proxy.returnEnum();
+		assertObjectEquals("'TWO'", x);
+	}
+
+	@Test
+	public void df02_returnEnum3d() {
+		TestEnum[][][] x = proxy.returnEnum3d();
+		assertObjectEquals("[[['TWO',null],null],null]", x);
+		assertClass(TestEnum.class, x[0][0][0]);
+	}
+
+	@Test
+	public void df03_returnEnumList() {
+		List<TestEnum> x = proxy.returnEnumList();
+		assertObjectEquals("['TWO',null]", x);
+		assertClass(TestEnum.class, x.get(0));
+	}
+
+	@Test
+	public void df04_returnEnum3dList() {
+		List<List<List<TestEnum>>> x = proxy.returnEnum3dList();
+		assertObjectEquals("[[['TWO',null],null,null]]", x);
+		assertClass(TestEnum.class, x.get(0).get(0).get(0));
+	}
+
+	@Test
+	public void df05_returnEnum1d3dList() {
+		List<TestEnum[][][]> x = proxy.returnEnum1d3dList();
+		assertObjectEquals("[[[['TWO',null],null],null],null]", x);
+		assertClass(TestEnum[][][].class, x.get(0));
+	}
+
+	@Test
+	public void df06_returnEnumMap() {
+		Map<TestEnum,TestEnum> x = proxy.returnEnumMap();
+		assertObjectEquals("{ONE:'TWO'}", x);
+		Map.Entry<TestEnum,TestEnum> e = x.entrySet().iterator().next();
+		assertClass(TestEnum.class, e.getKey());
+		assertClass(TestEnum.class, e.getValue());
+	}
+
+	@Test
+	public void df07_returnEnum3dArrayMap() {
+		Map<TestEnum,TestEnum[][][]> x = proxy.returnEnum3dArrayMap();
+		assertObjectEquals("{ONE:[[['TWO',null],null],null]}", x);
+		Map.Entry<TestEnum,TestEnum[][][]> e = x.entrySet().iterator().next();
+		assertClass(TestEnum.class, e.getKey());
+		assertClass(TestEnum[][][].class, e.getValue());
+	}
+
+	@Test
+	public void df08_returnEnum1d3dListMap() {
+		Map<TestEnum,List<TestEnum[][][]>> x = proxy.returnEnum1d3dListMap();
+		assertObjectEquals("{ONE:[[[['TWO',null],null],null],null]}", x);
+		assertClass(TestEnum[][][].class, x.get(TestEnum.ONE).get(0));
+	}
+
+	//--------------------------------------------------------------------------------
+	// Test Body
+	//--------------------------------------------------------------------------------
+
+	// Various primitives
+
+	@Test
+	public void ea01_setInt() {
+		proxy.setInt(1);
+	}
+
+	@Test
+	public void ea02_setWrongInt() {
+		try {
+			proxy.setInt(2);
+			fail("Exception expected");
+		} catch (AssertionError e) { // AssertionError thrown on server side.
+			assertEquals("expected:<1> but was:<2>", e.getMessage());
+		}
+	}
+
+	@Test
+	public void ea03_setInteger() {
+		proxy.setInteger(1);
+	}
+
+	@Test
+	public void ea04_setBoolean() {
+		proxy.setBoolean(true);
+	}
+
+	@Test
+	public void ea05_setFloat() {
+		proxy.setFloat(1f);
+	}
+
+	@Test
+	public void ea06_setFloatObject() {
+		proxy.setFloatObject(1f);
+	}
+
+	@Test
+	public void ea07_setString() {
+		proxy.setString("foo");
+	}
+
+	@Test
+	public void ea08_setNullString() {
+		proxy.setNullString(null);
+	}
+
+	@Test
+	public void ea09_setNullStringBad() {
+		try {
+			proxy.setNullString("foo");
+			fail("Exception expected");
+		} catch (AssertionError e) { // AssertionError thrown on server side.
+			assertEquals("expected null, but was:<foo>", e.getLocalizedMessage());
+		}
+	}
+
+	@Test
+	public void ea10_setInt3dArray() {
+		proxy.setInt3dArray(new int[][][]{{{1,2},null},null});
+	}
+
+	@Test
+	public void ea11_setInteger3dArray() {
+		proxy.setInteger3dArray(new Integer[][][]{{{1,null},null},null});
+	}
+
+	@Test
+	public void ea12_setString3dArray() {
+		proxy.setString3dArray(new String[][][]{{{"foo",null},null},null});
+	}
+
+	@Test
+	public void ea13_setIntegerList() {
+		proxy.setIntegerList(new AList<Integer>().append(1).append(null));
+	}
+
+	@Test
+	public void ea14_setInteger3dList() {
+		proxy.setInteger3dList(
+			new AList<List<List<Integer>>>()
+			.append(
+				new AList<List<Integer>>()
+				.append(new AList<Integer>().append(1).append(null))
+				.append(null)
+			)
+			.append(null)
+		);
+	}
+
+	@Test
+	public void ea15_setInteger1d3dList() {
+		proxy.setInteger1d3dList(
+			new AList<Integer[][][]>().append(new Integer[][][]{{{1,null},null},null}).append(null)
+		);
+	}
+
+	@Test
+	public void ea16_setInt1d3dList() {
+		proxy.setInt1d3dList(
+			new AList<int[][][]>().append(new int[][][]{{{1,2},null},null}).append(null)
+		);
+	}
+
+	@Test
+	public void ea17_setStringList() {
+		proxy.setStringList(Arrays.asList("foo","bar",null));
+	}
+
+	// Beans
+	@Test
+	public void eb01_setBean() {
+		proxy.setBean(new ABean().init());
+	}
+
+	@Test
+	public void eb02_setBean3dArray() {
+		proxy.setBean3dArray(new ABean[][][]{{{new ABean().init(),null},null},null});
+	}
+
+	@Test
+	public void eb03_setBeanList() {
+		proxy.setBeanList(Arrays.asList(new ABean().init()));
+	}
+
+	@Test
+	public void eb04_setBean1d3dList() {
+		proxy.setBean1d3dList(new AList<ABean[][][]>().append(new ABean[][][]{{{new ABean().init(),null},null},null}).append(null));
+	}
+
+	@Test
+	public void eb05_setBeanMap() {
+		proxy.setBeanMap(new AMap<String,ABean>().append("foo",new ABean().init()));
+	}
+
+	@Test
+	public void eb06_setBeanListMap() {
+		proxy.setBeanListMap(new AMap<String,List<ABean>>().append("foo",Arrays.asList(new ABean().init())));
+	}
+
+	@Test
+	public void eb07_setBean1d3dListMap() {
+		proxy.setBean1d3dListMap(new AMap<String,List<ABean[][][]>>().append("foo",new AList<ABean[][][]>().append(new ABean[][][]{{{new ABean().init(),null},null},null}).append(null)));
+	}
+
+	@Test
+	public void eb08_setBeanListMapIntegerKeys() {
+		proxy.setBeanListMapIntegerKeys(new AMap<Integer,List<ABean>>().append(1,Arrays.asList(new ABean().init())));
+	}
+
+	// Typed beans
+
+	@Test
+	public void ec01_setTypedBean() {
+		proxy.setTypedBean(new TypedBeanImpl().init());
+	}
+
+	@Test
+	public void ec02_setTypedBean3dArray() {
+		proxy.setTypedBean3dArray(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null});
+	}
+
+	@Test
+	public void ec03_setTypedBeanList() {
+		proxy.setTypedBeanList(Arrays.asList((TypedBean)new TypedBeanImpl().init()));
+	}
+
+	@Test
+	public void ec04_setTypedBean1d3dList() {
+		proxy.setTypedBean1d3dList(new AList<TypedBean[][][]>().append(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null}).append(null));
+	}
+
+	@Test
+	public void ec05_setTypedBeanMap() {
+		proxy.setTypedBeanMap(new AMap<String,TypedBean>().append("foo",new TypedBeanImpl().init()));
+	}
+
+	@Test
+	public void ec06_setTypedBeanListMap() {
+		proxy.setTypedBeanListMap(new AMap<String,List<TypedBean>>().append("foo",Arrays.asList((TypedBean)new TypedBeanImpl().init())));
+	}
+
+	@Test
+	public void ec07_setTypedBean1d3dListMap() {
+		proxy.setTypedBean1d3dListMap(new AMap<String,List<TypedBean[][][]>>().append("foo",new AList<TypedBean[][][]>().append(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null}).append(null)));
+	}
+
+	@Test
+	public void ec08_setTypedBeanListMapIntegerKeys() {
+		proxy.setTypedBeanListMapIntegerKeys(new AMap<Integer,List<TypedBean>>().append(1,Arrays.asList((TypedBean)new TypedBeanImpl().init())));
+	}
+
+	// Swapped POJOs
+
+	@Test
+	public void ed01_setSwappedPojo() {
+		proxy.setSwappedPojo(new SwappedPojo());
+	}
+
+	@Test
+	public void ed02_setSwappedPojo3dArray() {
+		proxy.setSwappedPojo3dArray(new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null});
+	}
+
+	@Test
+	public void ed03_setSwappedPojoMap() {
+		proxy.setSwappedPojoMap(new AMap<SwappedPojo,SwappedPojo>().append(new SwappedPojo(), new SwappedPojo()));
+	}
+
+	@Test
+	public void ed04_setSwappedPojo3dMap() {
+		proxy.setSwappedPojo3dMap(new AMap<SwappedPojo,SwappedPojo[][][]>().append(new SwappedPojo(), new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null}));
+	}
+
+	// Implicit swapped POJOs
+	@Test
+	public void ee01_setImplicitSwappedPojo() {
+		proxy.setImplicitSwappedPojo(new ImplicitSwappedPojo());
+	}
+
+	@Test
+	public void ee02_setImplicitSwappedPojo3dArray() {
+		proxy.setImplicitSwappedPojo3dArray(new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null});
+	}
+
+	@Test
+	public void ee03_setImplicitSwappedPojoMap() {
+		proxy.setImplicitSwappedPojoMap(new AMap<ImplicitSwappedPojo,ImplicitSwappedPojo>().append(new ImplicitSwappedPojo(), new ImplicitSwappedPojo()));
+	}
+
+	@Test
+	public void ee04_setImplicitSwappedPojo3dMap() {
+		proxy.setImplicitSwappedPojo3dMap(new AMap<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]>().append(new ImplicitSwappedPojo(), new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null}));
+	}
+
+	// Enums
+
+	@Test
+	public void ef01_setEnum() {
+		proxy.setEnum(TestEnum.TWO);
+	}
+
+	@Test
+	public void ef02_setEnum3d() {
+		proxy.setEnum3d(new TestEnum[][][]{{{TestEnum.TWO,null},null},null});
+	}
+
+	@Test
+	public void ef03_setEnumList() {
+		proxy.setEnumList(new AList<TestEnum>().append(TestEnum.TWO).append(null));
+	}
+
+	@Test
+	public void ef04_setEnum3dList() {
+		proxy.setEnum3dList(
+			new AList<List<List<TestEnum>>>()
+			.append(
+				new AList<List<TestEnum>>()
+				.append(
+					new AList<TestEnum>().append(TestEnum.TWO).append(null)
+				)
+				.append(null)
+			.append(null)
+			)
+		);
+	}
+
+	@Test
+	public void ef05_setEnum1d3dList() {
+		proxy.setEnum1d3dList(new AList<TestEnum[][][]>().append(new TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null));
+	}
+
+	@Test
+	public void ef06_setEnumMap() {
+		proxy.setEnumMap(new AMap<TestEnum,TestEnum>().append(TestEnum.ONE,TestEnum.TWO));
+	}
+
+	@Test
+	public void ef07_setEnum3dArrayMap() {
+		proxy.setEnum3dArrayMap(new AMap<TestEnum,TestEnum[][][]>().append(TestEnum.ONE, new TestEnum[][][]{{{TestEnum.TWO,null},null},null}));
+	}
+
+	@Test
+	public void ef08_setEnum1d3dListMap() {
+		proxy.setEnum1d3dListMap(new AMap<TestEnum,List<TestEnum[][][]>>().append(TestEnum.ONE, new AList<TestEnum[][][]>().append(new TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null)));
+	}
+
+
+	//--------------------------------------------------------------------------------
+	// Proxy class
+	//--------------------------------------------------------------------------------
+
+	@Remoteable(path="/testThirdPartyProxy")
+	public static interface ThirdPartyProxy {
+
+		//--------------------------------------------------------------------------------
+		// Header tests
+		//--------------------------------------------------------------------------------
+
+		@RemoteMethod(httpMethod="GET", path="/primitiveHeaders")
+		String primitiveHeaders(
+			@Header("h1") String h1,
+			@Header("h1n") String h1n,
+			@Header("h2") int h2,
+			@Header("h3") Integer h3,
+			@Header("h3n") Integer h3n,
+			@Header("h4") Boolean h4,
+			@Header("h5") float h5,
+			@Header("h6") Float h6
+		);
+
+		@RemoteMethod(httpMethod="GET", path="/primitiveCollectionHeaders")
+		String primitiveCollectionHeaders(
+			@Header("h1") int[][][] h1,
+			@Header("h2") Integer[][][] h2,
+			@Header("h3") String[][][] h3,
+			@Header("h4") List<Integer> h4,
+			@Header("h5") List<List<List<Integer>>> h5,
+			@Header("h6") List<Integer[][][]> h6,
+			@Header("h7") List<int[][][]> h7,
+			@Header("h8") List<String> h8
+		);
+
+		@RemoteMethod(httpMethod="GET", path="/beanHeaders")
+		String beanHeaders(
+			@Header("h1") ABean h1,
+			@Header("h1n") ABean h1n,
+			@Header("h2") ABean[][][] h2,
+			@Header("h3") List<ABean> h3,
+			@Header("h4") List<ABean[][][]> h4,
+			@Header("h5") Map<String,ABean> h5,
+			@Header("h6") Map<String,List<ABean>> h6,
+			@Header("h7") Map<String,List<ABean[][][]>> h7,
+			@Header("h8") Map<Integer,List<ABean>> h8
+		);
+
+		@RemoteMethod(httpMethod="GET", path="/typedBeanHeaders")
+		String typedBeanHeaders(
+			@Header("h1") TypedBean h1,
+			@Header("h1n") TypedBean h1n,
+			@Header("h2") TypedBean[][][] h2,
+			@Header("h3") List<TypedBean> h3,
+			@Header("h4") List<TypedBean[][][]> h4,
+			@Header("h5") Map<String,TypedBean> h5,
+			@Header("h6") Map<String,List<TypedBean>> h6,
+			@Header("h7") Map<String,List<TypedBean[][][]>> h7,
+			@Header("h8") Map<Integer,List<TypedBean>> h8
+		);
+
+		@RemoteMethod(httpMethod="GET", path="/swappedPojoHeaders")
+		String swappedPojoHeaders(
+			@Header("h1") SwappedPojo h1,
+			@Header("h2") SwappedPojo[][][] h2,
+			@Header("h3") Map<SwappedPojo,SwappedPojo> h3,
+			@Header("h4") Map<SwappedPojo,SwappedPojo[][][]> h4
+		);
+
+		@RemoteMethod(httpMethod="GET", path="/implicitSwappedPojoHeaders")
+		String implicitSwappedPojoHeaders(
+			@Header("h1") ImplicitSwappedPojo h1,
+			@Header("h2") ImplicitSwappedPojo[][][] h2,
+			@Header("h3") Map<ImplicitSwappedPojo,ImplicitSwappedPojo> h3,
+			@Header("h4") Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> h4
+		);
+
+		@RemoteMethod(httpMethod="GET", path="/enumHeaders")
+		String enumHeaders(
+			@Header("h1") TestEnum h1,
+			@Header("h1n") TestEnum h1n,
+			@Header("h2") TestEnum[][][] h2,
+			@Header("h3") List<TestEnum> h3,
+			@Header("h4") List<List<List<TestEnum>>> h4,
+			@Header("h5") List<TestEnum[][][]> h5,
+			@Header("h6") Map<TestEnum,TestEnum> h6,
+			@Header("h7") Map<TestEnum,TestEnum[][][]> h7,
+			@Header("h8") Map<TestEnum,List<TestEnum[][][]>> h8
+		);
+
+		//--------------------------------------------------------------------------------
+		// Query tests
+		//--------------------------------------------------------------------------------
+
+		@RemoteMethod(httpMethod="GET", path="/primitiveQueries")
+		String primitiveQueries(
+			@Query("h1") String h1,
+			@Query("h1n") String h1n,
+			@Query("h2") int h2,
+			@Query("h3") Integer h3,
+			@Query("h3n") Integer h3n,
+			@Query("h4") Boolean h4,
+			@Query("h5") float h5,
+			@Query("h6") Float h6
+		);
+
+		@RemoteMethod(httpMethod="GET", path="/primitiveCollectionQueries")
+		String primitiveCollectionQueries(
+			@Query("h1") int[][][] h1,
+			@Query("h2") Integer[][][] h2,
+			@Query("h3") String[][][] h3,
+			@Query("h4") List<Integer> h4,
+			@Query("h5") List<List<List<Integer>>> h5,
+			@Query("h6") List<Integer[][][]> h6,
+			@Query("h7") List<int[][][]> h7,
+			@Query("h8") List<String> h8
+		);
+
+		@RemoteMethod(httpMethod="GET", path="/beanQueries")
+		String beanQueries(
+			@Query("h1") ABean h1,
+			@Query("h1n") ABean h1n,
+			@Query("h2") ABean[][][] h2,
+			@Query("h3") List<ABean> h3,
+			@Query("h4") List<ABean[][][]> h4,
+			@Query("h5") Map<String,ABean> h5,
+			@Query("h6") Map<String,List<ABean>> h6,
+			@Query("h7") Map<String,List<ABean[][][]>> h7,
+			@Query("h8") Map<Integer,List<ABean>> h8
+		);
+
+		@RemoteMethod(httpMethod="GET", path="/typedBeanQueries")
+		String typedBeanQueries(
+			@Query("h1") TypedBean h1,
+			@Query("h1n") TypedBean h1n,
+			@Query("h2") TypedBean[][][] h2,
+			@Query("h3") List<TypedBean> h3,
+			@Query("h4") List<TypedBean[][][]> h4,
+			@Query("h5") Map<String,TypedBean> h5,
+			@Query("h6") Map<String,List<TypedBean>> h6,
+			@Query("h7") Map<String,List<TypedBean[][][]>> h7,
+			@Query("h8") Map<Integer,List<TypedBean>> h8
+		);
+
+		@RemoteMethod(httpMethod="GET", path="/swappedPojoQueries")
+		String swappedPojoQueries(
+			@Query("h1") SwappedPojo h1,
+			@Query("h2") SwappedPojo[][][] h2,
+			@Query("h3") Map<SwappedPojo,SwappedPojo> h3,
+			@Query("h4") Map<SwappedPojo,SwappedPojo[][][]> h4
+		);
+
+		@RemoteMethod(httpMethod="GET", path="/implicitSwappedPojoQueries")
+		String implicitSwappedPojoQueries(
+			@Query("h1") ImplicitSwappedPojo h1,
+			@Query("h2") ImplicitSwappedPojo[][][] h2,
+			@Query("h3") Map<ImplicitSwappedPojo,ImplicitSwappedPojo> h3,
+			@Query("h4") Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> h4
+		);
+
+		@RemoteMethod(httpMethod="GET", path="/enumQueries")
+		String enumQueries(
+			@Query("h1") TestEnum h1,
+			@Query("h1n") TestEnum h1n,
+			@Query("h2") TestEnum[][][] h2,
+			@Query("h3") List<TestEnum> h3,
+			@Query("h4") List<List<List<TestEnum>>> h4,
+			@Query("h5") List<TestEnum[][][]> h5,
+			@Query("h6") Map<TestEnum,TestEnum> h6,
+			@Query("h7") Map<TestEnum,TestEnum[][][]> h7,
+			@Query("h8") Map<TestEnum,List<TestEnum[][][]>> h8
+		);
+
+		//--------------------------------------------------------------------------------
+		// FormData tests
+		//--------------------------------------------------------------------------------
+
+		@RemoteMethod(httpMethod="POST", path="/primitiveFormData")
+		String primitiveFormData(
+			@FormData("h1") String h1,
+			@FormData("h1n") String h1n,
+			@FormData("h2") int h2,
+			@FormData("h3") Integer h3,
+			@FormData("h3n") Integer h3n,
+			@FormData("h4") Boolean h4,
+			@FormData("h5") float h5,
+			@FormData("h6") Float h6
+		);
+
+		@RemoteMethod(httpMethod="POST", path="/primitiveCollectionFormData")
+		String primitiveCollectionFormData(
+			@FormData("h1") int[][][] h1,
+			@FormData("h2") Integer[][][] h2,
+			@FormData("h3") String[][][] h3,
+			@FormData("h4") List<Integer> h4,
+			@FormData("h5") List<List<List<Integer>>> h5,
+			@FormData("h6") List<Integer[][][]> h6,
+			@FormData("h7") List<int[][][]> h7,
+			@FormData("h8") List<String> h8
+		);
+
+		@RemoteMethod(httpMethod="POST", path="/beanFormData")
+		String beanFormData(
+			@FormData("h1") ABean h1,
+			@FormData("h1n") ABean h1n,
+			@FormData("h2") ABean[][][] h2,
+			@FormData("h3") List<ABean> h3,
+			@FormData("h4") List<ABean[][][]> h4,
+			@FormData("h5") Map<String,ABean> h5,
+			@FormData("h6") Map<String,List<ABean>> h6,
+			@FormData("h7") Map<String,List<ABean[][][]>> h7,
+			@FormData("h8") Map<Integer,List<ABean>> h8
+		);
+
+		@RemoteMethod(httpMethod="POST", path="/typedBeanFormData")
+		String typedBeanFormData(
+			@FormData("h1") TypedBean h1,
+			@FormData("h1n") TypedBean h1n,
+			@FormData("h2") TypedBean[][][] h2,
+			@FormData("h3") List<TypedBean> h3,
+			@FormData("h4") List<TypedBean[][][]> h4,
+			@FormData("h5") Map<String,TypedBean> h5,
+			@FormData("h6") Map<String,List<TypedBean>> h6,
+			@FormData("h7") Map<String,List<TypedBean[][][]>> h7,
+			@FormData("h8") Map<Integer,List<TypedBean>> h8
+		);
+
+		@RemoteMethod(httpMethod="POST", path="/swappedPojoFormData")
+		String swappedPojoFormData(
+			@FormData("h1") SwappedPojo h1,
+			@FormData("h2") SwappedPojo[][][] h2,
+			@FormData("h3") Map<SwappedPojo,SwappedPojo> h3,
+			@FormData("h4") Map<SwappedPojo,SwappedPojo[][][]> h4
+		);
+
+		@RemoteMethod(httpMethod="POST", path="/implicitSwappedPojoFormData")
+		String implicitSwappedPojoFormData(
+			@FormData("h1") ImplicitSwappedPojo h1,
+			@FormData("h2") ImplicitSwappedPojo[][][] h2,
+			@FormData("h3") Map<ImplicitSwappedPojo,ImplicitSwappedPojo> h3,
+			@FormData("h4") Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> h4
+		);
+
+		@RemoteMethod(httpMethod="POST", path="/enumFormData")
+		String enumFormData(
+			@FormData("h1") TestEnum h1,
+			@FormData("h1n") TestEnum h1n,
+			@FormData("h2") TestEnum[][][] h2,
+			@FormData("h3") List<TestEnum> h3,
+			@FormData("h4") List<List<List<TestEnum>>> h4,
+			@FormData("h5") List<TestEnum[][][]> h5,
+			@FormData("h6") Map<TestEnum,TestEnum> h6,
+			@FormData("h7") Map<TestEnum,TestEnum[][][]> h7,
+			@FormData("h8") Map<TestEnum,List<TestEnum[][][]>> h8
+		);
+
+		//--------------------------------------------------------------------------------
+		// Test return types.
+		//--------------------------------------------------------------------------------
+
+		// Various primitives
+
+		@RemoteMethod(httpMethod="GET", path="/returnVoid")
+		void returnVoid();
+
+		@RemoteMethod(httpMethod="GET", path="/returnInt")
+		int returnInt();
+
+		@RemoteMethod(httpMethod="GET", path="/returnInteger")
+		Integer returnInteger();
+
+		@RemoteMethod(httpMethod="GET", path="/returnBoolean")
+		boolean returnBoolean();
+
+		@RemoteMethod(httpMethod="GET", path="/returnFloat")
+		float returnFloat();
+
+		@RemoteMethod(httpMethod="GET", path="/returnFloatObject")
+		Float returnFloatObject();
+
+		@RemoteMethod(httpMethod="GET", path="/returnString")
+		String returnString();
+
+		@RemoteMethod(httpMethod="GET", path="/returnNullString")
+		String returnNullString();
+
+		@RemoteMethod(httpMethod="GET", path="/returnInt3dArray")
+		int[][][] returnInt3dArray();
+
+		@RemoteMethod(httpMethod="GET", path="/returnInteger3dArray")
+		Integer[][][] returnInteger3dArray();
+
+		@RemoteMethod(httpMethod="GET", path="/returnString3dArray")
+		String[][][] returnString3dArray();
+
+		@RemoteMethod(httpMethod="GET", path="/returnIntegerList")
+		List<Integer> returnIntegerList();
+
+		@RemoteMethod(httpMethod="GET", path="/returnInteger3dList")
+		List<List<List<Integer>>> returnInteger3dList();
+
+		@RemoteMethod(httpMethod="GET", path="/returnInteger1d3dList")
+		List<Integer[][][]> returnInteger1d3dList();
+
+		@RemoteMethod(httpMethod="GET", path="/returnInt1d3dList")
+		List<int[][][]> returnInt1d3dList();
+
+		@RemoteMethod(httpMethod="GET", path="/returnStringList")
+		List<String> returnStringList();
+
+		// Beans
+
+		@RemoteMethod(httpMethod="GET", path="/returnBean")
+		ABean returnBean();
+
+		@RemoteMethod(httpMethod="GET", path="/returnBean3dArray")
+		ABean[][][] returnBean3dArray();
+
+		@RemoteMethod(httpMethod="GET", path="/returnBeanList")
+		List<ABean> returnBeanList();
+
+		@RemoteMethod(httpMethod="GET", path="/returnBean1d3dList")
+		List<ABean[][][]> returnBean1d3dList();
+
+		@RemoteMethod(httpMethod="GET", path="/returnBeanMap")
+		Map<String,ABean> returnBeanMap();
+
+		@RemoteMethod(httpMethod="GET", path="/returnBeanListMap")
+		Map<String,List<ABean>> returnBeanListMap();
+
+		@RemoteMethod(httpMethod="GET", path="/returnBean1d3dListMap")
+		Map<String,List<ABean[][][]>> returnBean1d3dListMap();
+
+		@RemoteMethod(httpMethod="GET", path="/returnBeanListMapIntegerKeys")
+		Map<Integer,List<ABean>> returnBeanListMapIntegerKeys();
+
+		// Typed beans
+
+		@RemoteMethod(httpMethod="GET", path="/returnTypedBean")
+		TypedBean returnTypedBean();
+
+		@RemoteMethod(httpMethod="GET", path="/returnTypedBean3dArray")
+		TypedBean[][][] returnTypedBean3dArray();
+
+		@RemoteMethod(httpMethod="GET", path="/returnTypedBeanList")
+		List<TypedBean> returnTypedBeanList();
+
+		@RemoteMethod(httpMethod="GET", path="/returnTypedBean1d3dList")
+		List<TypedBean[][][]> returnTypedBean1d3dList();
+
+		@RemoteMethod(httpMethod="GET", path="/returnTypedBeanMap")
+		Map<String,TypedBean> returnTypedBeanMap();
+
+		@RemoteMethod(httpMethod="GET", path="/returnTypedBeanListMap")
+		Map<String,List<TypedBean>> returnTypedBeanListMap();
+
+		@RemoteMethod(httpMethod="GET", path="/returnTypedBean1d3dListMap")
+		Map<String,List<TypedBean[][][]>> returnTypedBean1d3dListMap();
+
+		@RemoteMethod(httpMethod="GET", path="/returnTypedBeanListMapIntegerKeys")
+		Map<Integer,List<TypedBean>> returnTypedBeanListMapIntegerKeys();
+
+		// Swapped POJOs
+
+		@RemoteMethod(httpMethod="GET", path="/returnSwappedPojo")
+		SwappedPojo returnSwappedPojo();
+
+		@RemoteMethod(httpMethod="GET", path="/returnSwappedPojo3dArray")
+		SwappedPojo[][][] returnSwappedPojo3dArray();
+
+		@RemoteMethod(httpMethod="GET", path="/returnSwappedPojoMap")
+		Map<SwappedPojo,SwappedPojo> returnSwappedPojoMap();
+
+		@RemoteMethod(httpMethod="GET", path="/returnSwappedPojo3dMap")
+		Map<SwappedPojo,SwappedPojo[][][]> returnSwappedPojo3dMap();
+
+		// Implicit swapped POJOs
+
+		@RemoteMethod(httpMethod="GET", path="/returnImplicitSwappedPojo")
+		ImplicitSwappedPojo returnImplicitSwappedPojo();
+
+		@RemoteMethod(httpMethod="GET", path="/returnImplicitSwappedPojo3dArray")
+		ImplicitSwappedPojo[][][] returnImplicitSwappedPojo3dArray();
+
+		@RemoteMethod(httpMethod="GET", path="/returnImplicitSwappedPojoMap")
+		Map<ImplicitSwappedPojo,ImplicitSwappedPojo> returnImplicitSwappedPojoMap();
+
+		@RemoteMethod(httpMethod="GET", path="/returnImplicitSwappedPojo3dMap")
+		Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> returnImplicitSwappedPojo3dMap();
+
+		// Enums
+
+		@RemoteMethod(httpMethod="GET", path="/returnEnum")
+		TestEnum returnEnum();
+
+		@RemoteMethod(httpMethod="GET", path="/returnEnum3d")
+		TestEnum[][][] returnEnum3d();
+
+		@RemoteMethod(httpMethod="GET", path="/returnEnumList")
+		List<TestEnum> returnEnumList();
+
+		@RemoteMethod(httpMethod="GET", path="/returnEnum3dList")
+		List<List<List<TestEnum>>> returnEnum3dList();
+
+		@RemoteMethod(httpMethod="GET", path="/returnEnum1d3dList")
+		List<TestEnum[][][]> returnEnum1d3dList();
+
+		@RemoteMethod(httpMethod="GET", path="/returnEnumMap")
+		Map<TestEnum,TestEnum> returnEnumMap();
+
+		@RemoteMethod(httpMethod="GET", path="/returnEnum3dArrayMap")
+		Map<TestEnum,TestEnum[][][]> returnEnum3dArrayMap();
+
+		@RemoteMethod(httpMethod="GET", path="/returnEnum1d3dListMap")
+		Map<TestEnum,List<TestEnum[][][]>> returnEnum1d3dListMap();
+
+		//--------------------------------------------------------------------------------
+		// Test parameters
+		//--------------------------------------------------------------------------------
+
+		// Various primitives
+
+		@RemoteMethod(httpMethod="POST", path="/setInt")
+		void setInt(@Body int x);
+
+		@RemoteMethod(httpMethod="POST", path="/setInteger")
+		void setInteger(@Body Integer x);
+
+		@RemoteMethod(httpMethod="POST", path="/setBoolean")
+		void setBoolean(@Body boolean x);
+
+		@RemoteMethod(httpMethod="POST", path="/setFloat")
+		void setFloat(@Body float x);
+
+		@RemoteMethod(httpMethod="POST", path="/setFloatObject")
+		void setFloatObject(@Body Float x);
+
+		@RemoteMethod(httpMethod="POST", path="/setString")
+		void setString(@Body String x);
+
+		@RemoteMethod(httpMethod="POST", path="/setNullString")
+		void setNullString(@Body String x);
+
+		@RemoteMethod(httpMethod="POST", path="/setInt3dArray")
+		void setInt3dArray(@Body int[][][] x);
+
+		@RemoteMethod(httpMethod="POST", path="/setInteger3dArray")
+		void setInteger3dArray(@Body Integer[][][] x);
+
+		@RemoteMethod(httpMethod="POST", path="/setString3dArray")
+		void setString3dArray(@Body String[][][] x);
+
+		@RemoteMethod(httpMethod="POST", path="/setIntegerList")
+		void setIntegerList(@Body List<Integer> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setInteger3dList")
+		void setInteger3dList(@Body List<List<List<Integer>>> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setInteger1d3dList")
+		void setInteger1d3dList(@Body List<Integer[][][]> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setInt1d3dList")
+		void setInt1d3dList(@Body List<int[][][]> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setStringList")
+		void setStringList(@Body List<String> x);
+
+		// Beans
+
+		@RemoteMethod(httpMethod="POST", path="/setBean")
+		void setBean(@Body ABean x);
+
+		@RemoteMethod(httpMethod="POST", path="/setBean3dArray")
+		void setBean3dArray(@Body ABean[][][] x);
+
+		@RemoteMethod(httpMethod="POST", path="/setBeanList")
+		void setBeanList(@Body List<ABean> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setBean1d3dList")
+		void setBean1d3dList(@Body List<ABean[][][]> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setBeanMap")
+		void setBeanMap(@Body Map<String,ABean> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setBeanListMap")
+		void setBeanListMap(@Body Map<String,List<ABean>> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setBean1d3dListMap")
+		void setBean1d3dListMap(@Body Map<String,List<ABean[][][]>> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setBeanListMapIntegerKeys")
+		void setBeanListMapIntegerKeys(@Body Map<Integer,List<ABean>> x);
+
+		// Typed beans
+
+		@RemoteMethod(httpMethod="POST", path="/setTypedBean")
+		void setTypedBean(@Body TypedBean x);
+
+		@RemoteMethod(httpMethod="POST", path="/setTypedBean3dArray")
+		void setTypedBean3dArray(@Body TypedBean[][][] x);
+
+		@RemoteMethod(httpMethod="POST", path="/setTypedBeanList")
+		void setTypedBeanList(@Body List<TypedBean> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setTypedBean1d3dList")
+		void setTypedBean1d3dList(@Body List<TypedBean[][][]> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setTypedBeanMap")
+		void setTypedBeanMap(@Body Map<String,TypedBean> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setTypedBeanListMap")
+		void setTypedBeanListMap(@Body Map<String,List<TypedBean>> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setTypedBean1d3dListMap")
+		void setTypedBean1d3dListMap(@Body Map<String,List<TypedBean[][][]>> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setTypedBeanListMapIntegerKeys")
+		void setTypedBeanListMapIntegerKeys(@Body Map<Integer,List<TypedBean>> x);
+
+		// Swapped POJOs
+
+		@RemoteMethod(httpMethod="POST", path="/setSwappedPojo")
+		void setSwappedPojo(@Body SwappedPojo x);
+
+		@RemoteMethod(httpMethod="POST", path="/setSwappedPojo3dArray")
+		void setSwappedPojo3dArray(@Body SwappedPojo[][][] x);
+
+		@RemoteMethod(httpMethod="POST", path="/setSwappedPojoMap")
+		void setSwappedPojoMap(@Body Map<SwappedPojo,SwappedPojo> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setSwappedPojo3dMap")
+		void setSwappedPojo3dMap(@Body Map<SwappedPojo,SwappedPojo[][][]> x);
+
+		// Implicit swapped POJOs
+
+		@RemoteMethod(httpMethod="POST", path="/setImplicitSwappedPojo")
+		void setImplicitSwappedPojo(@Body ImplicitSwappedPojo x);
+
+		@RemoteMethod(httpMethod="POST", path="/setImplicitSwappedPojo3dArray")
+		void setImplicitSwappedPojo3dArray(@Body ImplicitSwappedPojo[][][] x);
+
+		@RemoteMethod(httpMethod="POST", path="/setImplicitSwappedPojoMap")
+		void setImplicitSwappedPojoMap(@Body Map<ImplicitSwappedPojo,ImplicitSwappedPojo> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setImplicitSwappedPojo3dMap")
+		void setImplicitSwappedPojo3dMap(@Body Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> x);
+
+		// Enums
+
+		@RemoteMethod(httpMethod="POST", path="/setEnum")
+		void setEnum(@Body TestEnum x);
+
+		@RemoteMethod(httpMethod="POST", path="/setEnum3d")
+		void setEnum3d(@Body TestEnum[][][] x);
+
+		@RemoteMethod(httpMethod="POST", path="/setEnumList")
+		void setEnumList(@Body List<TestEnum> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setEnum3dList")
+		void setEnum3dList(@Body List<List<List<TestEnum>>> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setEnum1d3dList")
+		void setEnum1d3dList(@Body List<TestEnum[][][]> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setEnumMap")
+		void setEnumMap(@Body Map<TestEnum,TestEnum> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setEnum3dArrayMap")
+		void setEnum3dArrayMap(@Body Map<TestEnum,TestEnum[][][]> x);
+
+		@RemoteMethod(httpMethod="POST", path="/setEnum1d3dListMap")
+		void setEnum1d3dListMap(@Body Map<TestEnum,List<TestEnum[][][]>> x);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/_TestSuite.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/_TestSuite.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/_TestSuite.java
index ec817ff..985c115 100644
--- a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/_TestSuite.java
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/_TestSuite.java
@@ -34,6 +34,7 @@ import org.junit.runners.Suite.*;
 	ContentTest.class,
 	DefaultContentTypesTest.class,
 	ErrorConditionsTest.class,
+	FormDataTest.class,
 	GroupsTest.class,
 	GzipTest.class,
 	InheritanceTest.class,
@@ -57,6 +58,7 @@ import org.junit.runners.Suite.*;
 	RestUtilsTest.class,
 	SerializersTest.class,
 	StaticFilesTest.class,
+	ThirdPartyProxyTest.class,
 	TransformsTest.class,
 	UrisTest.class,
 	UrlContentTest.class,

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest/src/main/java/org/apache/juneau/rest/Redirect.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/Redirect.java b/juneau-rest/src/main/java/org/apache/juneau/rest/Redirect.java
index f08d679..973452a 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/Redirect.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/Redirect.java
@@ -132,13 +132,13 @@ public final class Redirect {
 	/**
 	 * Calculates the URL to redirect to.
 	 *
-	 * @param s Use this serializer to encode arguments using the {@link UrlEncodingSerializer#serializeUrlPart(Object)} method.
+	 * @param s Use this serializer to encode arguments using the {@link UrlEncodingSerializer#serializePart(Object,Boolean,Boolean)} method.
 	 * @return The URL to redirect to.
 	 */
 	public String toUrl(UrlEncodingSerializer s) {
 		if (url != null && args != null && args.length > 0) {
 			for (int i = 0; i < args.length; i++)
-				args[i] = s.serializeUrlPart(args[i]);
+				args[i] = s.serializePart(args[i], null, true);
 			return MessageFormat.format(url, args);
 		}
 		return url;

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest/src/main/java/org/apache/juneau/rest/RestCallHandler.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/RestCallHandler.java b/juneau-rest/src/main/java/org/apache/juneau/rest/RestCallHandler.java
index 5d6a780..676e9ae 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/RestCallHandler.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/RestCallHandler.java
@@ -14,6 +14,7 @@ package org.apache.juneau.rest;
 
 import static java.util.logging.Level.*;
 import static javax.servlet.http.HttpServletResponse.*;
+import static org.apache.juneau.internal.StringUtils.*;
 
 import java.io.*;
 import java.util.*;
@@ -114,7 +115,7 @@ public class RestCallHandler {
 					final HttpServletRequest childRequest = new HttpServletRequestWrapper(r1) {
 						@Override /* ServletRequest */
 						public String getPathInfo() {
-							return RestUtils.decode(pathInfoRemainder);
+							return urlDecode(pathInfoRemainder);
 						}
 						@Override /* ServletRequest */
 						public String getServletPath() {
@@ -269,6 +270,13 @@ public class RestCallHandler {
 		res.setStatus(status);
 		res.setContentType("text/plain");
 		res.setHeader("Content-Encoding", "identity");
+
+		Throwable t = e.getRootCause();
+		if (t != null) {
+			res.setHeader("Exception-Name", t.getClass().getName());
+			res.setHeader("Exception-Message", t.getMessage());
+		}
+
 		PrintWriter w = null;
 		try {
 			w = res.getWriter();

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest/src/main/java/org/apache/juneau/rest/RestContext.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/RestContext.java b/juneau-rest/src/main/java/org/apache/juneau/rest/RestContext.java
index 2e39b74..2875805 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/RestContext.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/RestContext.java
@@ -13,9 +13,11 @@
 package org.apache.juneau.rest;
 
 import static javax.servlet.http.HttpServletResponse.*;
+import static org.apache.juneau.internal.StringUtils.*;
 
 import java.io.*;
 import java.lang.reflect.*;
+import java.lang.reflect.Method;
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
@@ -412,6 +414,10 @@ public final class RestContext extends Context {
 						if ("PROXY".equals(httpMethod)) {
 
 							final ClassMeta<?> interfaceClass = beanContext.getClassMeta(method.getGenericReturnType());
+							final Map<String,Method> remoteableMethods = interfaceClass.getRemoteableMethods();
+							if (remoteableMethods.isEmpty())
+								throw new RestException(SC_INTERNAL_SERVER_ERROR, "Method {0} returns an interface {1} that doesn't define any remoteable methods.", ClassUtils.getMethodSignature(method), interfaceClass.getReadableName());
+
 							sm = new CallMethod(resource, method, this) {
 
 								@Override
@@ -424,31 +430,20 @@ public final class RestContext extends Context {
 									final Object o = res.getOutput();
 
 									if ("GET".equals(req.getMethod())) {
-										res.setOutput(ClassUtils.getMethodInfo(interfaceClass.getProxyableMethods().values()));
+										res.setOutput(ClassUtils.getMethodInfo(remoteableMethods.values()));
 										return SC_OK;
 
 									} else if ("POST".equals(req.getMethod())) {
 										if (pathInfo.indexOf('/') != -1)
 											pathInfo = pathInfo.substring(pathInfo.lastIndexOf('/')+1);
-										pathInfo = RestUtils.decode(pathInfo);
-										java.lang.reflect.Method m = interfaceClass.getProxyableMethods().get(pathInfo);
+										pathInfo = urlDecode(pathInfo);
+										java.lang.reflect.Method m = remoteableMethods.get(pathInfo);
 										if (m != null) {
 											try {
 												// Parse the args and invoke the method.
 												Parser p = req.getParser();
 												Object input = p.isReaderParser() ? req.getReader() : req.getInputStream();
-												Object output = null;
-												try {
-													output = m.invoke(o, p.parseArgs(input, m.getGenericParameterTypes()));
-												} catch (InvocationTargetException e) {
-													res.setHeader("Exception-Name", e.getCause().getClass().getName());
-													res.setHeader("Exception-Message", e.getCause().getMessage());
-													throw e;
-												} catch (Exception e) {
-													res.setHeader("Exception-Name", e.getClass().getName());
-													res.setHeader("Exception-Message", e.getMessage());
-													throw e;
-												}
+												Object output = m.invoke(o, p.parseArgs(input, m.getGenericParameterTypes()));
 												res.setOutput(output);
 												return SC_OK;
 											} catch (Exception e) {
@@ -595,7 +590,7 @@ public final class RestContext extends Context {
 			defaultCharset = ps.getProperty(REST_defaultCharset, String.class, "utf-8");
 			paramFormat = ps.getProperty(REST_paramFormat, String.class, "");
 
-			for (String m : StringUtils.split(ps.getProperty(REST_allowMethodParam, String.class, ""), ','))
+			for (String m : split(ps.getProperty(REST_allowMethodParam, String.class, ""), ','))
 				if (m.equals("true"))  // For backwards compatibility when this was a boolean field.
 					allowMethodParams.add("*");
 				else
@@ -659,7 +654,7 @@ public final class RestContext extends Context {
 				for (Object o : sc.styleSheets) {
 					if (o instanceof Pair) {
 						Pair<Class<?>,String> p = (Pair<Class<?>,String>)o;
-						for (String path : StringUtils.split(vr.resolve(StringUtils.toString(p.second())), ','))
+						for (String path : split(vr.resolve(StringUtils.toString(p.second())), ','))
 							if (path.startsWith("file://"))
 								contents.add(new FileInputStream(path));
 							else
@@ -782,15 +777,15 @@ public final class RestContext extends Context {
 	 */
 	public StreamResource resolveStaticFile(String pathInfo) throws IOException {
 		if (! staticFilesCache.containsKey(pathInfo)) {
-			String p = RestUtils.decode(RestUtils.trimSlashes(pathInfo));
+			String p = urlDecode(trimSlashes(pathInfo));
 			if (p.indexOf("..") != -1)
 				throw new RestException(SC_NOT_FOUND, "Invalid path");
 			for (Map.Entry<String,String> e : staticFilesMap.entrySet()) {
-				String key = RestUtils.trimSlashes(e.getKey());
+				String key = trimSlashes(e.getKey());
 				if (p.startsWith(key)) {
 					String remainder = (p.equals(key) ? "" : p.substring(key.length()));
 					if (remainder.isEmpty() || remainder.startsWith("/")) {
-						String p2 = RestUtils.trimSlashes(e.getValue()) + remainder;
+						String p2 = trimSlashes(e.getValue()) + remainder;
 						InputStream is = getResource(p2, null);
 						if (is != null) {
 							try {
@@ -1211,7 +1206,7 @@ public final class RestContext extends Context {
 	 * @return <jk>true</jk> if this resource allows the specified method to be overridden.
 	 */
 	protected boolean allowMethodParam(String m) {
-		return (! StringUtils.isEmpty(m) && (allowMethodParams.contains(m) || allowMethodParams.contains("*")));
+		return (! isEmpty(m) && (allowMethodParams.contains(m) || allowMethodParams.contains("*")));
 	}
 
 	/**
@@ -1448,7 +1443,7 @@ public final class RestContext extends Context {
 	 * @return <jk>true</jk> if the specified path refers to a static file.
 	 */
 	protected boolean isStaticFile(String p) {
-		return StringUtils.pathStartsWith(p, staticFilesPrefixes);
+		return pathStartsWith(p, staticFilesPrefixes);
 	}
 
 	/**

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest/src/main/java/org/apache/juneau/rest/RestException.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/RestException.java b/juneau-rest/src/main/java/org/apache/juneau/rest/RestException.java
index 299883a..c9a9a5c 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/RestException.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/RestException.java
@@ -12,6 +12,7 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.rest;
 
+import java.lang.reflect.*;
 import java.text.*;
 
 /**
@@ -64,6 +65,24 @@ public class RestException extends RuntimeException {
 		return this;
 	}
 
+	/**
+	 * Returns the root cause of this exception.
+	 * The root cause is the first exception in the init-cause parent chain that's not one of the following:
+	 * <ul>
+	 * 	<li>{@link RestException}
+	 * 	<li>{@link InvocationTargetException}
+	 * </ul>
+	 * @return The root cause of this exception, or <jk>null</jk> if no root cause was found.
+	 */
+	public Throwable getRootCause() {
+		Throwable t = this;
+		while(t != null) {
+			t = t.getCause();
+			if (! (t instanceof RestException || t instanceof InvocationTargetException))
+				return t;
+		}
+		return null;
+	}
 
 	/**
 	 * Returns all error messages from all errors in this stack.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest/src/main/java/org/apache/juneau/rest/RestRequest.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/RestRequest.java b/juneau-rest/src/main/java/org/apache/juneau/rest/RestRequest.java
index 99f09d0..86d2db7 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/RestRequest.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/RestRequest.java
@@ -15,6 +15,7 @@ package org.apache.juneau.rest;
 import static java.util.Collections.*;
 import static java.util.logging.Level.*;
 import static javax.servlet.http.HttpServletResponse.*;
+import static org.apache.juneau.internal.StringUtils.*;
 
 import java.io.*;
 import java.lang.reflect.*;
@@ -81,6 +82,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	private BeanSession beanSession;
 	private VarResolverSession varSession;
 	private final Map<String,String[]> queryParams;
+	private Map<String,String> formData;
 	private final Map<String,String> defaultServletHeaders;
 	private Map<String,String> defaultMethodHeaders, overriddenHeaders, overriddenQueryParams, overriddenFormDataParams, pathParameters;
 	private boolean isPost;
@@ -316,10 +318,11 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	 * 	<br>Ignored if the main type is not a map or collection.
 	 * @param <T> The class type to convert the header value to.
 	 * @return The parameter value converted to the specified class type.
+	 * @throws ParseException If the header could not be converted to the specified type.
 	 */
-	public <T> T getHeader(String name, Type type, Type...args) {
+	public <T> T getHeader(String name, Type type, Type...args) throws ParseException {
 		String h = getHeader(name);
-		return (T)beanSession.convertToType(null, h, beanSession.getClassMeta(type, args));
+		return urlEncodingParser.parsePart(h, type, args);
 	}
 
 	/**
@@ -801,7 +804,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
 		if (s != null)
 			return s;
 
-		return super.getParameter(name);
+		return getFormParameterInner(name);
 	}
 
 	/**
@@ -812,7 +815,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	 * @return The parameter value, or the default value if <jk>null</jk> or empty.
 	 */
 	public String getFormDataParameter(String name, String def) {
-		String val = getParameter(name);
+		String val = getFormParameterInner(name);
 		if (val == null || val.isEmpty())
 			return def;
 		return val;
@@ -953,9 +956,22 @@ public final class RestRequest extends HttpServletRequestWrapper {
 		return getParameterMap().containsKey(name);
 	}
 
+	/**
+	 * Retrieves the URL-encoded from data from the request if the body has already been cached locally.
+	 */
+	private Map<String,String> getFormData() {
+		try {
+			if (formData == null)
+				formData = urlEncodingParser.parse(body, Map.class, String.class, String.class);
+			return formData;
+		} catch (ParseException e) {
+			throw new RestException(SC_INTERNAL_SERVER_ERROR, e);
+		}
+	}
+
 	/* Workhorse method */
 	<T> T getFormDataParameter(String name, T def, ClassMeta<T> cm) throws ParseException {
-		String val = getParameter(name);
+		String val = getFormParameterInner(name);
 		if (val == null)
 			return def;
 		return parseParameter(val, cm);
@@ -963,12 +979,16 @@ public final class RestRequest extends HttpServletRequestWrapper {
 
 	/* Workhorse method */
 	<T> T getFormDataParameter(String name, ClassMeta<T> cm) throws ParseException {
-		String val = getParameter(name);
+		String val = getFormParameterInner(name);
 		if (cm.isPrimitive() && (val == null || val.isEmpty()))
 			return cm.getPrimitiveDefault();
 		return parseParameter(val, cm);
 	}
 
+	private String getFormParameterInner(String name) {
+		return (body == null ? super.getParameter(name) : getFormData().get(name));
+	}
+
 	/* Workhorse method */
 	@SuppressWarnings("rawtypes")
 	<T> T getFormDataParameters(String name, ClassMeta<T> cm) throws ParseException {
@@ -1101,7 +1121,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
 		Object attr = getPathParameter(name);
 		T t = null;
 		if (attr != null)
-			t = urlEncodingParser.parseParameter(attr.toString(), cm);
+			t = urlEncodingParser.parsePart(attr.toString(), cm);
 		if (t == null && cm.isPrimitive())
 			return cm.getPrimitiveDefault();
 		return t;
@@ -1392,9 +1412,9 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	public URL getURL(String path) throws MalformedURLException {
 		if (path.startsWith("http://") || path.startsWith("https://"))
 			return new URL(path);
-		if (StringUtils.startsWith(path, '/'))
+		if (startsWith(path, '/'))
 			return new URL(getScheme(), getLocalName(), getLocalPort(), path);
-		return new URL(getScheme(), getLocalName(), getLocalPort(), getContextPath() + getServletPath() + (StringUtils.isEmpty(path) ? "" : ('/' + path)));
+		return new URL(getScheme(), getLocalName(), getLocalPort(), getContextPath() + getServletPath() + (isEmpty(path) ? "" : ('/' + path)));
 	}
 
 	/**
@@ -1462,7 +1482,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	 * @return The path remainder string.
 	 */
 	public String getPathRemainder() {
-		return RestUtils.decode(pathRemainder);
+		return urlDecode(pathRemainder);
 	}
 
 	/**
@@ -1515,7 +1535,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	 */
 	public String getRequestParentURI() {
 		String uri = getRequestURI();
-		while (StringUtils.endsWith(uri, '/'))
+		while (endsWith(uri, '/'))
 			uri = uri.substring(0, uri.length()-1);
 		int i = uri.lastIndexOf('/');
 		if (i <= 0)
@@ -1529,7 +1549,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	 * @return The trimmed request URI.
 	 */
 	public String getTrimmedRequestURI() {
-		return RestUtils.trimTrailingSlashes(getRequestURI());
+		return trimTrailingSlashes(getRequestURI());
 	}
 
 	/**
@@ -1538,7 +1558,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	 * @return The trimmed request URL.
 	 */
 	public StringBuffer getTrimmedRequestURL() {
-		return RestUtils.trimTrailingSlashes(getRequestURL());
+		return trimTrailingSlashes(getRequestURL());
 	}
 
 	/**
@@ -1632,11 +1652,11 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	 */
 	protected String getPageTitle() {
 		String s = pageTitle;
-		if (StringUtils.isEmpty(s))
+		if (isEmpty(s))
 			s = context.getMessages().findFirstString(getLocale(), javaMethod.getName() + ".pageTitle");
-		if (StringUtils.isEmpty(s))
+		if (isEmpty(s))
 			s = context.getMessages().findFirstString(getLocale(), "pageTitle");
-		if (! StringUtils.isEmpty(s))
+		if (! isEmpty(s))
 			return resolveVars(s);
 		s = getServletTitle();
 		return s;
@@ -1649,14 +1669,14 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	 */
 	protected String getPageText() {
 		String s = pageText;
-		if (StringUtils.isEmpty(s))
+		if (isEmpty(s))
 			s = context.getMessages().findFirstString(getLocale(), javaMethod.getName() + ".pageText");
-		if (StringUtils.isEmpty(s))
+		if (isEmpty(s))
 			s = context.getMessages().findFirstString(getLocale(), "pageText");
-		if (! StringUtils.isEmpty(s))
+		if (! isEmpty(s))
 			return resolveVars(s);
 		s = getMethodSummary();
-		if (StringUtils.isEmpty(s))
+		if (isEmpty(s))
 			s = getServletDescription();
 		return s;
 	}
@@ -1668,9 +1688,9 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	 */
 	protected String getPageLinks() {
 		String s = pageLinks;
-		if (StringUtils.isEmpty(s))
+		if (isEmpty(s))
 			s = context.getMessages().findFirstString(getLocale(), javaMethod.getName() + ".pageLinks");
-		if (StringUtils.isEmpty(s))
+		if (isEmpty(s))
 			s = context.getMessages().findFirstString(getLocale(), "pageLinks");
 		return resolveVars(s);
 	}
@@ -1950,9 +1970,12 @@ public final class RestRequest extends HttpServletRequestWrapper {
 		if (javaMethod == null) {
 			sb.append("***init() not called yet!***\n");
 		} else if (method.equals("PUT") || method.equals("POST")) {
-			sb.append("---Body---\n");
 			try {
-				sb.append(getBodyAsString()).append("\n");
+				body = IOUtils.readBytes(getInputStream(), 1024);
+				sb.append("---Body UTF-8---\n");
+				sb.append(new String(body, "UTF-8")).append("\n");
+				sb.append("---Body Hex---\n");
+				sb.append(StringUtils.toHex(body)).append("\n");
 			} catch (Exception e1) {
 				sb.append(e1.getLocalizedMessage());
 				context.getLogger().log(WARNING, e1, "Error occurred while trying to read debug input.");
@@ -1967,21 +1990,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	//--------------------------------------------------------------------------------
 
 	private <T> T parseParameter(String val, ClassMeta<T> c) throws ParseException {
-		if (val == null)
-			return null;
-
-		// Shortcut - If we're returning a string and the value doesn't start with "'" or is "null", then
-		// just return the string since it's a plain value.
-		// This allows us to bypass the creation of a UonParserSession object.
-		if (c.getInnerClass() == String.class && val.length() > 0) {
-			char x = val.charAt(0);
-			if (x != '\'' && x != 'n' && val.indexOf('~') == -1)
-				return (T)val;
-			if (x == 'n' && "null".equals(val))
-				return null;
-		}
-
-		return urlEncodingParser.parseParameter(val, c);
+		return urlEncodingParser.parsePart(val, c);
 	}
 
 	/*

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest/src/main/java/org/apache/juneau/rest/RestResponse.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/RestResponse.java b/juneau-rest/src/main/java/org/apache/juneau/rest/RestResponse.java
index 2d50376..00ac554 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/RestResponse.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/RestResponse.java
@@ -74,7 +74,8 @@ public final class RestResponse extends HttpServletResponseWrapper {
 		try {
 			String passThroughHeaders = req.getHeader("x-response-headers");
 			if (passThroughHeaders != null) {
-				ObjectMap m = context.getUrlEncodingParser().parseParameter(passThroughHeaders, ObjectMap.class);
+				UrlEncodingParser p = context.getUrlEncodingParser();
+				ObjectMap m = p.parsePart(passThroughHeaders, p.getBeanContext().getClassMeta(ObjectMap.class));
 				for (Map.Entry<String,Object> e : m.entrySet())
 					setHeader(e.getKey(), e.getValue().toString());
 			}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest/src/main/java/org/apache/juneau/rest/RestServlet.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/RestServlet.java b/juneau-rest/src/main/java/org/apache/juneau/rest/RestServlet.java
index d7288d3..d91a7f0 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/RestServlet.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/RestServlet.java
@@ -147,9 +147,9 @@ public abstract class RestServlet extends HttpServlet {
 			context.getCallHandler().service(r1, r2);
 
 		} catch (RestException e) {
-			context.getCallHandler().handleError(r1, r2, e);
+			r2.sendError(SC_INTERNAL_SERVER_ERROR, e.getLocalizedMessage());
 		} catch (Throwable e) {
-			context.getCallHandler().handleError(r1, r2, new RestException(SC_INTERNAL_SERVER_ERROR, e));
+			r2.sendError(SC_INTERNAL_SERVER_ERROR, e.getLocalizedMessage());
 		}
 	}
 
@@ -249,7 +249,8 @@ public abstract class RestServlet extends HttpServlet {
 
 	@Override /* GenericServlet */
 	public void destroy() {
-		context.destroy();
+		if (context != null)
+			context.destroy();
 		super.destroy();
 	}
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest/src/main/java/org/apache/juneau/rest/RestUtils.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/RestUtils.java b/juneau-rest/src/main/java/org/apache/juneau/rest/RestUtils.java
index 607f659..73a89a9 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/RestUtils.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/RestUtils.java
@@ -12,13 +12,10 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.rest;
 
-import java.io.*;
-import java.net.*;
 import java.util.*;
 
 import javax.servlet.http.*;
 
-import org.apache.juneau.internal.*;
 import org.apache.juneau.utils.*;
 
 /**
@@ -76,94 +73,6 @@ public final class RestUtils {
 	;
 
 	/**
-	 * Trims <js>'/'</js> characters from both the start and end of the specified string.
-	 *
-	 * @param s The string to trim.
-	 * @return A new trimmed string, or the same string if no trimming was necessary.
-	 */
-	public static String trimSlashes(String s) {
-		if (s == null)
-			return null;
-		while (StringUtils.endsWith(s, '/'))
-			s = s.substring(0, s.length()-1);
-		while (s.length() > 0 && s.charAt(0) == '/')
-			s = s.substring(1);
-		return s;
-	}
-
-	/**
-	 * Trims <js>'/'</js> characters from the end of the specified string.
-	 *
-	 * @param s The string to trim.
-	 * @return A new trimmed string, or the same string if no trimming was necessary.
-	 */
-	public static String trimTrailingSlashes(String s) {
-		if (s == null)
-			return null;
-		while (StringUtils.endsWith(s, '/'))
-			s = s.substring(0, s.length()-1);
-		return s;
-	}
-
-	/**
-	 * Trims <js>'/'</js> characters from the end of the specified string.
-	 *
-	 * @param s The string to trim.
-	 * @return The same string buffer.
-	 */
-	public static StringBuffer trimTrailingSlashes(StringBuffer s) {
-		if (s == null)
-			return null;
-		while (s.length() > 0 && s.charAt(s.length()-1) == '/')
-			s.setLength(s.length()-1);
-		return s;
-	}
-
-	/**
-	 * Decodes a <code>application/x-www-form-urlencoded</code> string using <code>UTF-8</code> encoding scheme.
-	 *
-	 * @param s The string to decode.
-	 * @return The decoded string, or <jk>null</jk> if input is <jk>null</jk>.
-	 */
-	public static String decode(String s) {
-		if (s == null)
-			return s;
-		boolean needsDecode = false;
-		for (int i = 0; i < s.length() && ! needsDecode; i++) {
-			char c = s.charAt(i);
-			if (c == '+' || c == '%')
-				needsDecode = true;
-		}
-		if (needsDecode)
-		try {
-				return URLDecoder.decode(s, "UTF-8");
-			} catch (UnsupportedEncodingException e) {/* Won't happen */}
-		return s;
-	}
-
-	// Characters that do not need to be URL-encoded
-	private static final AsciiSet unencodedChars = new AsciiSet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.!~*'()\\");
-
-	/**
-	 * Encodes a <code>application/x-www-form-urlencoded</code> string using <code>UTF-8</code> encoding scheme.
-	 *
-	 * @param s The string to encode.
-	 * @return The encoded string, or <jk>null</jk> if input is <jk>null</jk>.
-	 */
-	public static String encode(String s) {
-		if (s == null)
-			return null;
-		boolean needsEncode = false;
-		for (int i = 0; i < s.length() && ! needsEncode; i++)
-			needsEncode |= (! unencodedChars.contains(s.charAt(i)));
-		if (needsEncode)
-		try {
-				return URLEncoder.encode(s, "UTF-8");
-			} catch (UnsupportedEncodingException e) {/* Won't happen */}
-		return s;
-	}
-
-	/**
 	 * Identical to {@link HttpServletRequest#getPathInfo()} but doesn't decode encoded characters.
 	 *
 	 * @param req The HTTP request

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest/src/main/java/org/apache/juneau/rest/UrlPathPattern.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/UrlPathPattern.java b/juneau-rest/src/main/java/org/apache/juneau/rest/UrlPathPattern.java
index ad6eb60..1d97933 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/UrlPathPattern.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/UrlPathPattern.java
@@ -12,12 +12,11 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.rest;
 
-import static org.apache.juneau.rest.RestUtils.*;
+import static org.apache.juneau.internal.StringUtils.*;
 
 import java.util.*;
 import java.util.regex.*;
 
-import org.apache.juneau.internal.*;
 import org.apache.juneau.rest.annotation.*;
 
 /**
@@ -53,7 +52,7 @@ public final class UrlPathPattern implements Comparable<UrlPathPattern> {
 		List<String> vars = new LinkedList<String>();
 
 		private Builder(String patternString) {
-			if (! StringUtils.startsWith(patternString, '/'))
+			if (! startsWith(patternString, '/'))
 				patternString = '/' + patternString;
 			if (patternString.equals("/*")) {
 				isOnlyDotAll = true;
@@ -105,7 +104,7 @@ public final class UrlPathPattern implements Comparable<UrlPathPattern> {
 			if (isDotAll && i == len-1)
 				v[i] = m.group(i+1).isEmpty() ? null : m.group(i+1).substring(1);
 			else
-			v[i] = decode(m.group(i+1));
+			v[i] = urlDecode(m.group(i+1));
 		}
 
 		return v;

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java b/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java
index 1720066..fdaa469 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java
@@ -17,9 +17,9 @@ import static java.lang.annotation.RetentionPolicy.*;
 
 import java.lang.annotation.*;
 
-import org.apache.juneau.annotation.*;
 import org.apache.juneau.encoders.*;
 import org.apache.juneau.parser.*;
+import org.apache.juneau.remoteable.*;
 import org.apache.juneau.rest.*;
 import org.apache.juneau.serializer.*;
 


[5/7] incubator-juneau git commit: Support for 3rd-party proxy interfaces.

Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCall.java
----------------------------------------------------------------------
diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCall.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCall.java
index 52af23f..7bc9449 100644
--- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCall.java
+++ b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCall.java
@@ -12,6 +12,8 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.rest.client;
 
+import static org.apache.juneau.internal.StringUtils.*;
+
 import java.io.*;
 import java.lang.reflect.*;
 import java.net.*;
@@ -23,6 +25,7 @@ import java.util.regex.*;
 import org.apache.http.*;
 import org.apache.http.client.*;
 import org.apache.http.client.config.*;
+import org.apache.http.client.entity.*;
 import org.apache.http.client.methods.*;
 import org.apache.http.client.utils.*;
 import org.apache.http.impl.client.*;
@@ -78,9 +81,11 @@ public final class RestCall {
 	private boolean isClosed = false;
 	private boolean isFailed = false;
 	private Object input;
+	private boolean hasInput;  // input() was called, even if it's setting 'null'.
 	private Serializer serializer;
 	private Parser parser;
 	private URIBuilder uriBuilder;
+	private NameValuePairs formData;
 
 	/**
 	 * Constructs a REST call with the specified method name.
@@ -164,57 +169,84 @@ public final class RestCall {
 	}
 
 	/**
-	 * Adds a parameter to the URI query.
+	 * Adds a query parameter to the URI query.
 	 *
 	 * @param name The parameter name.
+	 * Can be null/blank if the value is a {@link Map} or {@link String}.
 	 * @param value The parameter value converted to a string using UON notation.
+	 * Can also be a {@link Map} or {@link String} if the name is null/blank.
+	 * If a {@link String} and the name is null/blank, then calls {@link URIBuilder#setCustomQuery(String)}.
+	 * @param skipIfEmpty Don't add the pair if the value is empty.
 	 * @return This object (for method chaining).
-	 * @throws RestCallException
 	 */
-	public RestCall param(String name, Object value) throws RestCallException {
-		uriBuilder.addParameter(name, client.getUrlEncodingSerializer().serializeUrlPart(value));
+	@SuppressWarnings("unchecked")
+	public RestCall query(String name, Object value, boolean skipIfEmpty) {
+		if (! isEmpty(name)) {
+			if (! (isEmpty(value) && skipIfEmpty))
+				uriBuilder.addParameter(name, client.getUrlEncodingSerializer().serializePart(value, false, null));
+		} else {
+			if (value instanceof String) {
+				String s = value.toString();
+				if (! isEmpty(s))
+					uriBuilder.setCustomQuery(s);
+			} else if (value instanceof Map) {
+				for (Map.Entry<String,Object> p : ((Map<String,Object>) value).entrySet())
+					query(p.getKey(), p.getValue(), skipIfEmpty);
+			} else {
+				throw new RuntimeException("Invalid name passed to query(name,value,skipIfEmpty).");
+			}
+		}
 		return this;
 	}
 
 	/**
-	 * Adds parameters to the URI query.
+	 * Adds a query parameter to the URI query.
+	 *
+	 * @param name The parameter name.
+	 * @param value The parameter value converted to a string using UON notation.
+	 * @return This object (for method chaining).
+	 * @throws RestCallException
+	 */
+	public RestCall query(String name, Object value) throws RestCallException {
+		return query(name, value, false);
+	}
+
+	/**
+	 * Adds query parameters to the URI query.
 	 *
 	 * @param params The parameters.  Values are converted to a string using UON notation.
 	 * @return This object (for method chaining).
 	 * @throws RestCallException
 	 */
-	public RestCall params(Map<String,Object> params) throws RestCallException {
-		for (Map.Entry<String,Object> p : params.entrySet())
-			uriBuilder.addParameter(p.getKey(), client.getUrlEncodingSerializer().serializeUrlPart(p.getValue()));
-		return this;
+	public RestCall query(Map<String,Object> params) throws RestCallException {
+		return query(null, params);
 	}
 
 	/**
-	 * Adds a parameter to the URI query if the parameter value is not <jk>null</jk>.
+	 * Adds a query parameter to the URI query if the parameter value is not <jk>null</jk> or an empty string.
+	 * <p>
+	 * NE = "not empty"
 	 *
 	 * @param name The parameter name.
 	 * @param value The parameter value converted to a string using UON notation.
 	 * @return This object (for method chaining).
 	 * @throws RestCallException
 	 */
-	public RestCall paramIfNN(String name, Object value) throws RestCallException {
-		if (value != null)
-			uriBuilder.addParameter(name, client.getUrlEncodingSerializer().serializeUrlPart(value));
-		return this;
+	public RestCall queryIfNE(String name, Object value) throws RestCallException {
+		return query(name, value, true);
 	}
 
 	/**
-	 * Adds a parameter to the URI query if the parameter value is not <jk>null</jk> or an empty string.
+	 * Adds query parameters to the URI for any parameters that aren't null/empty.
+	 * <p>
+	 * NE = "not empty"
 	 *
-	 * @param name The parameter name.
-	 * @param value The parameter value converted to a string using UON notation.
+	 * @param params The parameters.  Values are converted to a string using UON notation.
 	 * @return This object (for method chaining).
 	 * @throws RestCallException
 	 */
-	public RestCall paramIfNE(String name, Object value) throws RestCallException {
-		if (! StringUtils.isEmpty(value))
-			uriBuilder.addParameter(name, client.getUrlEncodingSerializer().serializeUrlPart(value));
-		return this;
+	public RestCall queryIfNE(Map<String,Object> params) throws RestCallException {
+		return query(null, params, true);
 	}
 
 	/**
@@ -229,6 +261,99 @@ public final class RestCall {
 	}
 
 	/**
+	 * Adds a form data pair to this request to perform a URL-encoded form post.
+	 *
+	 * @param name The parameter name.
+	 * Can be null/blank if the value is a {@link Map} or {@link NameValuePairs}.
+	 * @param value The parameter value converted to a string using UON notation.
+	 * Can also be a {@link Map} or {@link NameValuePairs}.
+	 * @param skipIfEmpty Don't add the pair if the value is empty.
+	 * @return This object (for method chaining).
+	 */
+	@SuppressWarnings("unchecked")
+	public RestCall formData(String name, Object value, boolean skipIfEmpty) {
+		if (formData == null)
+			formData = new NameValuePairs();
+		if (! isEmpty(name)) {
+			if (! (isEmpty(value) && skipIfEmpty))
+				formData.add(new SerializedNameValuePair(name, value, client.getUrlEncodingSerializer()));
+		} else {
+			if (value instanceof NameValuePairs) {
+				formData.addAll((NameValuePairs)value);
+			} else if (value instanceof Map) {
+				for (Map.Entry<String,Object> p : ((Map<String,Object>) value).entrySet())
+					formData(p.getKey(), p.getValue(), skipIfEmpty);
+			} else {
+				throw new RuntimeException("Invalid name passed to formData(name,value,skipIfEmpty).");
+			}
+		}
+		return this;
+	}
+
+	/**
+	 * Adds a form data pair to this request to perform a URL-encoded form post.
+	 *
+	 * @param name The parameter name.
+	 * Can be null/blank if the value is a {@link Map} or {@link NameValuePairs}.
+	 * @param value The parameter value converted to a string using UON notation.
+	 * Can also be a {@link Map} or {@link NameValuePairs}.
+	 * @return This object (for method chaining).
+	 * @throws RestCallException If name was null/blank and value wasn't a {@link Map} or {@link NameValuePairs}.
+	 */
+	public RestCall formData(String name, Object value) throws RestCallException {
+		return formData(name, value, false);
+	}
+
+	/**
+	 * Adds form data pairs to this request to perform a URL-encoded form post.
+	 *
+	 * @param nameValuePairs The name-value pairs of the request.
+	 * @return This object (for method chaining).
+	 * @throws RestCallException
+	 */
+	public RestCall formData(NameValuePairs nameValuePairs) throws RestCallException {
+		return formData(null, nameValuePairs);
+	}
+
+	/**
+	 * Adds form data pairs to this request to perform a URL-encoded form post.
+	 *
+	 * @param params The parameters.  Values are converted to a string using UON notation.
+	 * @return This object (for method chaining).
+	 * @throws RestCallException If name was null/blank and value wasn't a {@link Map} or {@link NameValuePairs}.
+	 */
+	public RestCall formData(Map<String,Object> params) throws RestCallException {
+		return formData(null, params);
+	}
+
+	/**
+	 * Adds a form data pair to the request if the parameter value is not <jk>null</jk> or an empty string.
+	 * <p>
+	 * NE = "not empty"
+	 *
+	 * @param name The parameter name.
+	 * @param value The parameter value converted to a string using UON notation.
+	 * @return This object (for method chaining).
+	 * @throws RestCallException
+	 */
+	public RestCall formDataIfNE(String name, Object value) throws RestCallException {
+		return formData(name, value, true);
+	}
+
+	/**
+	 * Adds form data parameters to the request for any parameters that aren't null/empty.
+	 * <p>
+	 * NE = "not empty"
+	 *
+	 * @param params The parameters.  Values are converted to a string using UON notation.
+	 * @return This object (for method chaining).
+	 * @throws RestCallException
+	 */
+	public RestCall formDataIfNE(Map<String,Object> params) throws RestCallException {
+		return formData(null, params, true);
+	}
+
+	/**
 	 * Sets the URI user info.
 	 *
 	 * @param userInfo The new URI user info.
@@ -261,12 +386,14 @@ public final class RestCall {
 	 * 	<li>{@link InputStream} - Raw contents of {@code InputStream} will be serialized to remote resource.
 	 * 	<li>{@link Object} - POJO to be converted to text using the {@link Serializer} registered with the {@link RestClient}.
 	 * 	<li>{@link HttpEntity} - Bypass Juneau serialization and pass HttpEntity directly to HttpClient.
+	 * 	<li>{@link NameValuePairs} - Converted to a URL-encoded FORM post.
 	 * </ul>
 	 * @return This object (for method chaining).
 	 * @throws RestCallException If a retry was attempted, but the entity was not repeatable.
 	 */
 	public RestCall input(final Object input) throws RestCallException {
 		this.input = input;
+		this.hasInput = true;
 		return this;
 	}
 
@@ -302,19 +429,79 @@ public final class RestCall {
 	//--------------------------------------------------------------------------------
 
 	/**
-	 * Convenience method for setting a header value on the request.
-	 * <p>
-	 * Equivalent to calling <code>restCall.getRequest().setHeader(name, value.toString())</code>.
+	 * Sets a header on the request.
 	 *
 	 * @param name The header name.
+	 * The name can be null/empty if the value is a {@link Map}.
 	 * @param value The header value.
+	 * @param skipIfEmpty Don't add the header if the name is null/empty.
 	 * @return This object (for method chaining).
 	 */
-	public RestCall header(String name, Object value) {
-		request.setHeader(name, value.toString());
+	@SuppressWarnings("unchecked")
+	public RestCall header(String name, Object value, boolean skipIfEmpty) {
+		if (! isEmpty(name)) {
+			if (! (isEmpty(value) && skipIfEmpty))
+				request.setHeader(name, client.getUrlEncodingSerializer().serializePart(value, false, true));
+		} else {
+			if (value instanceof Map) {
+				for (Map.Entry<String,Object> p : ((Map<String,Object>) value).entrySet())
+					header(p.getKey(), p.getValue(), skipIfEmpty);
+			} else {
+				throw new RuntimeException("Invalid name passed to formData(name,value,skipIfEmpty).");
+			}
+		}
 		return this;
 	}
 
+
+	/**
+	 * Sets a header on the request.
+	 *
+	 * @param name The header name.
+	 * The name can be null/empty if the value is a {@link Map}.
+	 * @param value The header value.
+	 * @return This object (for method chaining).
+	 */
+	public RestCall header(String name, Object value) {
+		return header(name, value, false);
+	}
+
+	/**
+	 * Sets headers on the request.
+	 *
+	 * @param values The header values.
+	 * @return This object (for method chaining).
+	 */
+	public RestCall headers(Map<String,Object> values) {
+		return header(null, values, false);
+	}
+
+	/**
+	 * Sets a header on the request if the value is not null/empty.
+	 * <p>
+	 * NE = "not empty"
+	 *
+	 * @param name The header name.
+	 * The name can be null/empty if the value is a {@link Map}.
+	 * @param value The header value.
+	 * @return This object (for method chaining).
+	 */
+	public RestCall headerIfNE(String name, Object value) {
+		return header(name, value, true);
+	}
+
+	/**
+	 * Sets headers on the request if the values are not null/empty.
+	 * <p>
+	 * NE = "not empty"
+	 *
+	 * @param values The header values.
+	 * @return This object (for method chaining).
+	 */
+	public RestCall headersIfNE(Map<String,Object> values) {
+		return header(null, values, true);
+	}
+
 	/**
 	 * Sets the value for the <code>Accept</code> request header.
 	 * <p>
@@ -1082,13 +1269,28 @@ public final class RestCall {
 
 			request.setURI(uriBuilder.build());
 
-			if (input != null) {
+			if (hasInput || formData != null) {
+
+				if (hasInput && formData != null)
+					throw new RestCallException("Both input and form data found on same request.");
+
 				if (! (request instanceof HttpEntityEnclosingRequestBase))
 					throw new RestCallException(0, "Method does not support content entity.", request.getMethod(), request.getURI(), null);
-				HttpEntity entity = (input instanceof HttpEntity) ? (HttpEntity)input : new RestRequestEntity(input, getSerializer());
-				((HttpEntityEnclosingRequestBase)request).setEntity(entity);
+
+				HttpEntity entity = null;
+				if (formData != null)
+					entity = new UrlEncodedFormEntity(formData);
+				else if (input instanceof NameValuePairs)
+					entity = new UrlEncodedFormEntity((NameValuePairs)input);
+				else if (input instanceof HttpEntity)
+					entity = (HttpEntity)input;
+				else
+					entity = new RestRequestEntity(input, getSerializer());
+
 				if (retries > 1 && ! entity.isRepeatable())
 					throw new RestCallException("Rest call set to retryable, but entity is not repeatable.");
+
+				((HttpEntityEnclosingRequestBase)request).setEntity(entity);
 			}
 
 			int sc = 0;
@@ -1104,7 +1306,7 @@ public final class RestCall {
 					if (response != null)
 						EntityUtils.consumeQuietly(response.getEntity());
 				}
-				if (! retryOn.onCode(sc))
+				if (! retryOn.onResponse(response))
 					retries = 0;
 				if (retries > 0) {
 					for (RestCallInterceptor rci : interceptors)
@@ -1360,6 +1562,16 @@ public final class RestCall {
 	 * 	<jc>// Parse into a map of object keys/values.</jc>
 	 * 	Map m = restClient.doGet(url).getResponse(TreeMap.<jk>class</jk>);
 	 * </p>
+	 * <p>
+	 * <h5 class='section'>Notes:</h5>
+	 * <ul>
+	 * 	<li>You can also specify any of the following types:
+	 * 		<ul>
+	 * 			<li>{@link HttpResponse} - Returns the raw <code>HttpResponse</code> returned by the inner <code>HttpClient</code>.
+	 * 			<li>{@link Reader} - Returns access to the raw reader of the response.
+	 * 			<li>{@link InputStream} - Returns access to the raw input stream of the response.
+	 * 		</ul>
+	 * </ul>
 	 *
 	 * @param <T> The class type of the object being created.
 	 * See {@link #getResponse(Type, Type...)} for details.
@@ -1427,6 +1639,12 @@ public final class RestCall {
 	 * <h5 class='section'>Notes:</h5>
 	 * <ul>
 	 * 	<li>Use the {@link #getResponse(Class)} method instead if you don't need a parameterized map/collection.
+	 * 	<li>You can also specify any of the following types:
+	 * 		<ul>
+	 * 			<li>{@link HttpResponse} - Returns the raw <code>HttpResponse</code> returned by the inner <code>HttpClient</code>.
+	 * 			<li>{@link Reader} - Returns access to the raw reader of the response.
+	 * 			<li>{@link InputStream} - Returns access to the raw input stream of the response.
+	 * 		</ul>
 	 * </ul>
 	 *
 	 * @param <T> The class type of the object to create.
@@ -1500,8 +1718,15 @@ public final class RestCall {
 		return getResponsePojoRest(ObjectMap.class);
 	}
 
+	@SuppressWarnings("unchecked")
 	<T> T getResponse(ClassMeta<T> type) throws IOException, ParseException {
 		try {
+			if (type.getInnerClass().equals(HttpResponse.class))
+				return (T)response;
+			if (type.getInnerClass().equals(Reader.class))
+				return (T)getReader();
+			if (type.getInnerClass().equals(InputStream.class))
+				return (T)getInputStream();
 			Parser p = getParser();
 			T o = null;
 			if (! p.isReaderParser()) {

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
----------------------------------------------------------------------
diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
index df91067..e5f9a32 100644
--- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
+++ b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
@@ -12,6 +12,8 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.rest.client;
 
+import static org.apache.juneau.internal.StringUtils.*;
+
 import java.io.*;
 import java.lang.reflect.*;
 import java.lang.reflect.Proxy;
@@ -29,6 +31,7 @@ import org.apache.juneau.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.json.*;
 import org.apache.juneau.parser.*;
+import org.apache.juneau.remoteable.*;
 import org.apache.juneau.serializer.*;
 import org.apache.juneau.urlencoding.*;
 
@@ -55,7 +58,6 @@ public class RestClient extends CoreObject {
 	private final CloseableHttpClient httpClient;
 	private final boolean keepHttpClientOpen;
 	private final UrlEncodingSerializer urlEncodingSerializer;  // Used for form posts only.
-	private final String remoteableServletUri;
 	private final String rootUrl;
 	private volatile boolean isClosed = false;
 	private final StackTraceElement[] creationStack;
@@ -84,7 +86,6 @@ public class RestClient extends CoreObject {
 			UrlEncodingSerializer urlEncodingSerializer,
 			Map<String,String> headers,
 			List<RestCallInterceptor> interceptors,
-			String remoteableServletUri,
 			String rootUri,
 			RetryOn retryOn,
 			int retries,
@@ -102,7 +103,6 @@ public class RestClient extends CoreObject {
 		Map<String,String> h2 = new ConcurrentHashMap<String,String>(headers);
 
 		this.headers = Collections.unmodifiableMap(h2);
-		this.remoteableServletUri = remoteableServletUri;
 		this.rootUrl = rootUri;
 		this.retryOn = retryOn;
 		this.retries = retries;
@@ -220,6 +220,21 @@ public class RestClient extends CoreObject {
 	}
 
 	/**
+	 * Same as {@link #doPost(Object, Object)} but don't specify the input yet.
+	 * <p>
+	 * You must call either {@link RestCall#input(Object)} or {@link RestCall#formData(String, Object)}
+	 * to set the contents on the result object.
+	 *
+	 * @param url The URL of the remote REST resource.  Can be any of the following:  {@link String}, {@link URI}, {@link URL}.
+	 * @return A {@link RestCall} object that can be further tailored before executing the request
+	 * 	and getting the response as a parsed object.
+	 * @throws RestCallException
+	 */
+	public RestCall doPost(Object url) throws RestCallException {
+		return doCall("POST", url, true);
+	}
+
+	/**
 	 * Perform a <code>DELETE</code> request against the specified URL.
 	 *
 	 * @param url The URL of the remote REST resource.  Can be any of the following:  {@link String}, {@link URI}, {@link URL}.
@@ -337,6 +352,7 @@ public class RestClient extends CoreObject {
 	 * 	<li>{@link InputStream} - Raw contents of {@code InputStream} will be serialized to remote resource.
 	 * 	<li>{@link Object} - POJO to be converted to text using the {@link Serializer} registered with the {@link RestClient}.
 	 * 	<li>{@link HttpEntity} - Bypass Juneau serialization and pass HttpEntity directly to HttpClient.
+	 * 	<li>{@link NameValuePairs} - Converted to a URL-encoded FORM post.
 	 * </ul>
 	 * This parameter is IGNORED if {@link HttpMethod#hasContent()} is <jk>false</jk>.
 	 * @return A {@link RestCall} object that can be further tailored before executing the request
@@ -405,64 +421,144 @@ public class RestClient extends CoreObject {
 	}
 
 	/**
-	 * Create a new proxy interface for the specified remoteable service interface.
+	 * Create a new proxy interface against a REST interface.
+	 * <p>
+	 * The URL to the REST interface is based on the following values:
+	 * <ul>
+	 * 	<li>The {@link Remoteable#path() @Remoteable.path()} annotation on the interface (<code>remoteable-path</code>).
+	 * 	<li>The {@link RestClientBuilder#rootUrl(Object) rootUrl} on the client (<code>root-url</code>).
+	 * 	<li>The fully-qualified class name of the interface (<code>class-name</code>).
+	 * </ul>
+	 * <p>
+	 * The URL calculation is as follows:
+	 * <ul>
+	 * 	<li><code>remoteable-path</code> - If remoteable path is absolute.
+	 * 	<li><code>root-url/remoteable-path</code> - If remoteable path is relative and root-url has been specified.
+	 * 	<li><code>root-url/class-name</code> - If remoteable path is not specified.
+	 * </ul>
+	 * <p>
+	 * If the information is not available to resolve to an absolute URL, a {@link RemoteableMetadataException} is thrown.
+	 * <p>
+	 * Examples:
+	 * <p class='bcode'>
+	 * 	<jk>package</jk> org.apache.foo;
+	 *
+	 * 	<ja>@Remoteable</ja>(path=<js>"http://hostname/resturl/myinterface1"</js>)
+	 * 	<jk>public interface</jk> MyInterface1 { ... }
+	 *
+	 * 	<ja>@Remoteable</ja>(path=<js>"/myinterface2"</js>)
+	 * 	<jk>public interface</jk> MyInterface2 { ... }
+	 *
+	 * 	<jk>public interface</jk> MyInterface3 { ... }
+	 *
+	 * 	<jc>// Resolves to "http://localhost/resturl/myinterface1"</jc>
+	 * 	MyInterface1 i1 = <jk>new</jk> RestClientBuilder()
+	 * 		.build()
+	 * 		.getRemoteableProxy(MyInterface1.<jk>class</jk>);
+	 *
+	 * 	<jc>// Resolves to "http://hostname/resturl/myinterface2"</jc>
+	 * 	MyInterface2 i2 = <jk>new</jk> RestClientBuilder()
+	 * 		.rootUrl(<js>"http://hostname/resturl"</js>)
+	 * 		.build()
+	 * 		.getRemoteableProxy(MyInterface2.<jk>class</jk>);
+	 *
+	 * 	<jc>// Resolves to "http://hostname/resturl/org.apache.foo.MyInterface3"</jc>
+	 * 	MyInterface3 i3 = <jk>new</jk> RestClientBuilder()
+	 * 		.rootUrl(<js>"http://hostname/resturl"</js>)
+	 * 		.build()
+	 * 		.getRemoteableProxy(MyInterface3.<jk>class</jk>);
+	 * </p>
 	 *
 	 * @param interfaceClass The interface to create a proxy for.
 	 * @return The new proxy interface.
-	 * @throws RuntimeException If the Remotable service URI has not been specified on this
-	 * 	client by calling {@link RestClientBuilder#remoteableServletUri(String)}.
+	 * @throws RemoteableMetadataException If the REST URI cannot be determined based on the information given.
 	 */
 	public <T> T getRemoteableProxy(final Class<T> interfaceClass) {
-		if (remoteableServletUri == null)
-			throw new RuntimeException("Remoteable service URI has not been specified.");
-		return getRemoteableProxy(interfaceClass, remoteableServletUri + '/' + interfaceClass.getName());
+		return getRemoteableProxy(interfaceClass, null);
 	}
 
 	/**
-	 * Create a new proxy interface for the specified REST PROXY interface.
+	 * Same as {@link #getRemoteableProxy(Class)} except explicitly specifies the URL of the REST interface.
 	 *
 	 * @param interfaceClass The interface to create a proxy for.
-	 * @param proxyUrl The URL of the REST method annotated with <code><ja>@RestMethod</ja>(name=<js>"PROXY"</js>)</code>.
+	 * @param restUrl The URL of the REST interface.
 	 * @return The new proxy interface.
 	 */
-	public <T> T getRemoteableProxy(final Class<T> interfaceClass, final Object proxyUrl) {
-		return getRemoteableProxy(interfaceClass, proxyUrl, serializer, parser);
+	public <T> T getRemoteableProxy(final Class<T> interfaceClass, final Object restUrl) {
+		return getRemoteableProxy(interfaceClass, restUrl, serializer, parser);
 	}
 
 	/**
 	 * Same as {@link #getRemoteableProxy(Class, Object)} but allows you to override the serializer and parser used.
 	 *
 	 * @param interfaceClass The interface to create a proxy for.
-	 * @param proxyUrl The URL of the REST method annotated with <code><ja>@RestMethod</ja>(name=<js>"PROXY"</js>)</code>.
+	 * @param restUrl The URL of the REST interface.
 	 * @param serializer The serializer used to serialize POJOs to the body of the HTTP request.
 	 * @param parser The parser used to parse POJOs from the body of the HTTP response.
 	 * @return The new proxy interface.
 	 */
 	@SuppressWarnings({ "unchecked", "hiding" })
-	public <T> T getRemoteableProxy(final Class<T> interfaceClass, final Object proxyUrl, final Serializer serializer, final Parser parser) {
+	public <T> T getRemoteableProxy(final Class<T> interfaceClass, Object restUrl, final Serializer serializer, final Parser parser) {
+
+		if (restUrl == null) {
+			Remoteable r = ReflectionUtils.getAnnotation(Remoteable.class, interfaceClass);
+
+			String path = r == null ? "" : trimSlashes(r.path());
+			if (path.indexOf("://") == -1) {
+				if (path.isEmpty())
+					path = interfaceClass.getName();
+				if (rootUrl == null)
+					throw new RemoteableMetadataException(interfaceClass, "Root URI has not been specified.  Cannot construct absolute path to remoteable proxy.");
+				path = trimSlashes(rootUrl) + '/' + path;
+			}
+			restUrl = path;
+		}
+
+		final String restUrl2 = restUrl.toString();
+
 		try {
 			return (T)Proxy.newProxyInstance(
 				interfaceClass.getClassLoader(),
 				new Class[] { interfaceClass },
 				new InvocationHandler() {
 
-					final Map<Method,String> uriCache = new ConcurrentHashMap<Method,String>();
-					final String uri = toURI(proxyUrl).toString();
+					final RemoteableMeta rm = new RemoteableMeta(interfaceClass, restUrl2);
 
 					@Override /* InvocationHandler */
 					public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+						RemoteableMethodMeta rmm = rm.getMethodMeta(method);
 
-						// Constructing this string each time can be time consuming, so cache it.
-						String u = uriCache.get(method);
-						if (u == null) {
-							try {
-								u = uri + '/' + URLEncoder.encode(ClassUtils.getMethodSignature(method), "utf-8");
-							} catch (UnsupportedEncodingException e) {}
-							uriCache.put(method, u);
-						}
+						if (rmm == null)
+							throw new RuntimeException("Method is not exposed as a remoteable method.");
 
 						try {
-							return doPost(u, args).serializer(serializer).parser(parser).getResponse(method.getGenericReturnType());
+							String url = rmm.getUrl();
+							String httpMethod = rmm.getHttpMethod();
+							RestCall rc = (httpMethod.equals("POST") ? doPost(url) : doGet(url));
+							rc.serializer(serializer).parser(parser);
+
+							for (RemoteMethodArg a : rmm.getQueryArgs())
+								rc.query(a.name, args[a.index], a.skipIfNE);
+
+							for (RemoteMethodArg a : rmm.getFormDataArgs())
+								rc.formData(a.name, args[a.index], a.skipIfNE);
+
+							for (RemoteMethodArg a : rmm.getHeaderArgs())
+								rc.header(a.name, args[a.index], a.skipIfNE);
+
+							if (rmm.getBodyArg() != null)
+								rc.input(args[rmm.getBodyArg()]);
+
+							if (rmm.getOtherArgs().length > 0) {
+								Object[] otherArgs = new Object[rmm.getOtherArgs().length];
+								int i = 0;
+								for (Integer otherArg : rmm.getOtherArgs())
+									otherArgs[i++] = args[otherArg];
+								rc.input(otherArgs);
+							}
+
+							return rc.getResponse(method.getGenericReturnType());
+
 						} catch (RestCallException e) {
 							// Try to throw original exception if possible.
 							e.throwServerException(interfaceClass.getClassLoader());

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
index faea9f8..e3ffcc8 100644
--- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
+++ b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
@@ -67,7 +67,6 @@ public class RestClientBuilder extends CoreObjectBuilder {
 
 	private List<RestCallInterceptor> interceptors = new ArrayList<RestCallInterceptor>();
 
-	private String remoteableServletUri;
 	private String rootUrl;
 	private SSLOpts sslOpts;
 	private boolean pooled;
@@ -140,7 +139,7 @@ public class RestClientBuilder extends CoreObjectBuilder {
 
 			UrlEncodingSerializer us = new SerializerBuilder(propertyStore).build(UrlEncodingSerializer.class);
 
-			return new RestClient(propertyStore, httpClient, keepHttpClientOpen, s, p, us, headers, interceptors, remoteableServletUri, rootUrl, retryOn, retries, retryInterval, debug, executorService, executorServiceShutdownOnClose);
+			return new RestClient(propertyStore, httpClient, keepHttpClientOpen, s, p, us, headers, interceptors, rootUrl, retryOn, retries, retryInterval, debug, executorService, executorServiceShutdownOnClose);
 		} catch (Exception e) {
 			throw new RuntimeException(e);
 		}
@@ -231,18 +230,6 @@ public class RestClientBuilder extends CoreObjectBuilder {
 	}
 
 	/**
-	 * Sets the URI of the remoteable services REST servlet for invoking remoteable services.
-	 *
-	 * @param remoteableServletUri The URI of the REST resource implementing a remoteable services servlet.
-	 * 	(typically an instance of <code>RemoteableServlet</code>).
-	 * @return This object (for method chaining).
-	 */
-	public RestClientBuilder remoteableServletUri(String remoteableServletUri) {
-		this.remoteableServletUri = remoteableServletUri;
-		return this;
-	}
-
-	/**
 	 * Set a root URL for this client.
 	 * <p>
 	 * When set, URL strings passed in through the various rest call methods (e.g. {@link RestClient#doGet(Object)}
@@ -1064,6 +1051,31 @@ public class RestClientBuilder extends CoreObjectBuilder {
 		return header("No-Trace", true);
 	}
 
+	/**
+	 * Sets the {@link UrlEncodingSerializerContext#URLENC_paramFormat} property on the URL-encoding serializers in this group.
+	 * <p>
+	 * This overrides the behavior of the URL-encoding serializer to quote and escape characters
+	 * in query names and values that may be confused for UON notation (e.g. <js>"'(foo=123)'"</js>, <js>"'@(1,2,3)'"</js>).
+	 * <p>
+	 *
+	 * @param value The new value for this property.
+	 * @return This object (for method chaining).
+	 * @see UrlEncodingSerializerContext#URLENC_paramFormat
+	 */
+	public RestClientBuilder paramFormat(String value) {
+		super.property(UrlEncodingSerializerContext.URLENC_paramFormat, value);
+		return this;
+	}
+
+	/**
+	 * Shortcut for calling <code>paramFormat(<js>"PLAINTEXT"</js>)</code>.
+	 *
+	 * @return This object (for method chaining).
+	 */
+	public RestClientBuilder plainTextParams() {
+		super.property(UrlEncodingSerializerContext.URLENC_paramFormat, "PLAINTEXT");
+		return this;
+	}
 
 	@Override /* CoreObjectBuilder */
 	public RestClientBuilder beansRequireDefaultConstructor(boolean value) {

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequestEntity.java
----------------------------------------------------------------------
diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequestEntity.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequestEntity.java
index 712c043..96c10e6 100644
--- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequestEntity.java
+++ b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequestEntity.java
@@ -54,11 +54,13 @@ public final class RestRequestEntity extends BasicHttpEntity {
 				} else if (! serializer.isWriterSerializer()) {
 					OutputStreamSerializer s2 = (OutputStreamSerializer)serializer;
 					s2.serialize(output, os);
+					os.flush();
 					os.close();
 				} else {
 					Writer w = new OutputStreamWriter(os, IOUtils.UTF8);
 					WriterSerializer s2 = (WriterSerializer)serializer;
 					s2.serialize(output, w);
+					w.flush();
 					w.close();
 				}
 			} catch (SerializeException e) {

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RetryOn.java
----------------------------------------------------------------------
diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RetryOn.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RetryOn.java
index 6a1c542..6d225b0 100644
--- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RetryOn.java
+++ b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RetryOn.java
@@ -12,10 +12,16 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.rest.client;
 
+import org.apache.http.*;
+
 /**
  * Used to determine whether a request should be retried based on the HTTP response code.
+ * <p>
+ * Subclasses should override either the {@link #onCode(int)} method (if you only care about
+ * the HTTP status code) or {@link #onResponse(HttpResponse)} (if you want full access to
+ * the HTTP response object.
  */
-public interface RetryOn {
+public abstract class RetryOn {
 
 	/**
 	 * Default RetryOn that returns <jk>true</jk> of any HTTP response &gt;= 400 is received.
@@ -40,8 +46,20 @@ public interface RetryOn {
 	/**
 	 * Subclasses should override this method to determine whether the HTTP response is retryable.
 	 *
-	 * @param httpResponseCode The HTTP response code.
+	 * @param response The HTTP response object.  May be <jk>null</jk> if a connection could not be made.
+	 * @return <jk>true</jk> if the specified response code is retryable.
+	 */
+	protected boolean onResponse(HttpResponse response) {
+		return onCode(response == null || response.getStatusLine() == null ? -1 : response.getStatusLine().getStatusCode());
+	}
+
+	/**
+	 * Subclasses should override this method to determine whether the HTTP response is retryable.
+	 *
+	 * @param httpResponseCode The HTTP response code.  <code>-1</code> if a connection could not be made.
 	 * @return <jk>true</jk> if the specified response code is retryable.
 	 */
-	boolean onCode(int httpResponseCode);
+	protected boolean onCode(int httpResponseCode) {
+		return false;
+	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/SerializedNameValuePair.java
----------------------------------------------------------------------
diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/SerializedNameValuePair.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/SerializedNameValuePair.java
index f90c393..11382a6 100644
--- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/SerializedNameValuePair.java
+++ b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/SerializedNameValuePair.java
@@ -12,13 +12,7 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.rest.client;
 
-import static org.apache.juneau.uon.UonSerializerContext.*;
-
-import java.io.*;
-
 import org.apache.http.*;
-import org.apache.juneau.*;
-import org.apache.juneau.uon.*;
 import org.apache.juneau.urlencoding.*;
 
 /**
@@ -38,9 +32,6 @@ public final class SerializedNameValuePair implements NameValuePair {
 	private Object value;
 	private UrlEncodingSerializer serializer;
 
-	// We must be sure to disable character encoding since it's done in the http client layer.
-	private static final ObjectMap op = new ObjectMap().append(UON_encodeChars, false);
-
 	/**
 	 * Constructor.
 	 *
@@ -56,29 +47,11 @@ public final class SerializedNameValuePair implements NameValuePair {
 
 	@Override /* NameValuePair */
 	public String getName() {
-		if (name != null && name.length() > 0) {
-			char c = name.charAt(0);
-			if (c == '$' || c == '(') {
-				try {
-					UonSerializerSession s = serializer.createSession(new StringWriter(), op, null, null, null, MediaType.UON);
-					serializer.serialize(s, name);
-					return s.getWriter().toString();
-				} catch (Exception e) {
-					throw new RuntimeException(e);
-				}
-			}
-		}
-		return name;
+		return serializer.serializePart(name, false, null);
 	}
 
 	@Override /* NameValuePair */
 	public String getValue() {
-		try {
-			UonSerializerSession s = serializer.createSession(new StringWriter(), op, null, null, null, MediaType.UON);
-			serializer.serialize(s, value);
-			return s.getWriter().toString();
-		} catch (Exception e) {
-			throw new RuntimeException(e);
-		}
+		return serializer.serializePart(value, false, null);
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/package.html
----------------------------------------------------------------------
diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/package.html b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/package.html
index 5bc9368..0f685ef 100644
--- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/package.html
+++ b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/package.html
@@ -821,8 +821,6 @@
 		</p>
 		<p>
 			Proxy interfaces are retrieved using the {@link org.apache.juneau.rest.client.RestClient#getRemoteableProxy(Class)} method.
-			The {@link org.apache.juneau.rest.client.RestClientBuilder#remoteableServletUri(String)} method is used to specify the location
-				of the remoteable services servlet running on the server.
 			The remoteable servlet is a specialized subclass of {@link org.apache.juneau.rest.RestServlet} that provides a full-blown
 				REST interface for calling interfaces remotely. 
 		</p>
@@ -840,7 +838,7 @@
 		<p class='bcode'>
 	<jc>// Create a RestClient using JSON for serialization, and point to the server-side remoteable servlet.</jc>
 	RestClient client = <jk>new</jk> RestClientBuilder()
-		.remoteableServletUri(<js>"https://localhost:9080/juneau/sample/remoteable"</js>)
+		.rootUrl(<js>"https://localhost:9080/juneau/sample/remoteable"</js>)
 		.build();
 	
 	<jc>// Create a proxy interface.</jc>

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/FormDataResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/FormDataResource.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/FormDataResource.java
new file mode 100644
index 0000000..3bced3f
--- /dev/null
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/FormDataResource.java
@@ -0,0 +1,37 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.rest.test;
+
+import java.io.*;
+
+import org.apache.juneau.internal.*;
+import org.apache.juneau.rest.*;
+import org.apache.juneau.rest.annotation.*;
+
+/**
+ * JUnit automated testcase resource.
+ */
+@RestResource(
+	path="/testFormData"
+)
+public class FormDataResource extends RestServletDefault {
+	private static final long serialVersionUID = 1L;
+
+	//====================================================================================================
+	// Basic tests
+	//====================================================================================================
+	@RestMethod(name="POST", path="/*")
+	public Reader test(RestRequest req) throws IOException {
+		return new StringReader("Content-Type=["+req.getContentType()+"], contents=["+IOUtils.read(req.getReader())+"]");
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxy.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxy.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxy.java
index 9f8da38..b2af7a6 100644
--- a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxy.java
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxy.java
@@ -14,15 +14,13 @@ package org.apache.juneau.rest.test;
 
 import java.util.*;
 
-import org.apache.juneau.*;
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.parser.*;
-import org.apache.juneau.serializer.*;
-import org.apache.juneau.transform.*;
+import org.apache.juneau.remoteable.*;
+import org.apache.juneau.rest.test.pojos.*;
 
 /**
  * Interface proxy exposed in InterfaceProxyResource and tested in InterfaceProxyTest.
  */
+@Remoteable
 public interface InterfaceProxy {
 
 	public static final String SWAP = "swap-~!@#$%^&*()_+`-={}[]|:;\"<,>.?/";
@@ -50,14 +48,14 @@ public interface InterfaceProxy {
 	List<String> returnStringList();
 
 	// Beans
-	Bean returnBean();
-	Bean[][][] returnBean3dArray();
-	List<Bean> returnBeanList();
-	List<Bean[][][]> returnBean1d3dList();
-	Map<String,Bean> returnBeanMap();
-	Map<String,List<Bean>> returnBeanListMap();
-	Map<String,List<Bean[][][]>> returnBean1d3dListMap();
-	Map<Integer,List<Bean>> returnBeanListMapIntegerKeys();
+	ABean returnBean();
+	ABean[][][] returnBean3dArray();
+	List<ABean> returnBeanList();
+	List<ABean[][][]> returnBean1d3dList();
+	Map<String,ABean> returnBeanMap();
+	Map<String,List<ABean>> returnBeanListMap();
+	Map<String,List<ABean[][][]>> returnBean1d3dListMap();
+	Map<Integer,List<ABean>> returnBeanListMapIntegerKeys();
 
 	// Typed beans
 	TypedBean returnTypedBean();
@@ -121,14 +119,14 @@ public interface InterfaceProxy {
 	void setStringList(List<String> x);
 
 	// Beans
-	void setBean(Bean x);
-	void setBean3dArray(Bean[][][] x);
-	void setBeanList(List<Bean> x);
-	void setBean1d3dList(List<Bean[][][]> x);
-	void setBeanMap(Map<String,Bean> x);
-	void setBeanListMap(Map<String,List<Bean>> x);
-	void setBean1d3dListMap(Map<String,List<Bean[][][]>> x);
-	void setBeanListMapIntegerKeys(Map<Integer,List<Bean>> x);
+	void setBean(ABean x);
+	void setBean3dArray(ABean[][][] x);
+	void setBeanList(List<ABean> x);
+	void setBean1d3dList(List<ABean[][][]> x);
+	void setBeanMap(Map<String,ABean> x);
+	void setBeanListMap(Map<String,List<ABean>> x);
+	void setBean1d3dListMap(Map<String,List<ABean[][][]>> x);
+	void setBeanListMapIntegerKeys(Map<Integer,List<ABean>> x);
 
 	// Typed beans
 	void setTypedBean(TypedBean x);
@@ -171,7 +169,7 @@ public interface InterfaceProxy {
 	void setMultiParamsFloat(float x1, float[][][] x2, float[][][] x2n, List<float[][][]> x3, List<float[][][]> x3n);
 	void setMultiParamsFloatObject(Float x1, Float x1n, Float[][][] x2, Float[][][] x2n, List<Float[][][]> x3, List<Float[][][]> x3n);
 	void setMultiParamsString(String x1, String[][][] x2, String[][][] x2n, List<String[][][]> x3, List<String[][][]> x3n);
-	void setMultiParamsBean(Bean x1, Bean[][][] x2, Bean[][][] x2n, List<Bean[][][]> x3, List<Bean[][][]> x3n, Map<String,Bean> x4, Map<String,Bean> x4n, Map<String,List<Bean[][][]>> x5, Map<String,List<Bean[][][]>> x5n);
+	void setMultiParamsBean(ABean x1, ABean[][][] x2, ABean[][][] x2n, List<ABean[][][]> x3, List<ABean[][][]> x3n, Map<String,ABean> x4, Map<String,ABean> x4n, Map<String,List<ABean[][][]>> x5, Map<String,List<ABean[][][]>> x5n);
 	void setMultiParamsSwappedPojo(SwappedPojo x1, SwappedPojo[][][] x2, SwappedPojo[][][] x2n, List<SwappedPojo[][][]> x3, List<SwappedPojo[][][]> x3n, Map<SwappedPojo,SwappedPojo> x4, Map<SwappedPojo,SwappedPojo> x4n, Map<SwappedPojo,List<SwappedPojo[][][]>> x5, Map<SwappedPojo,List<SwappedPojo[][][]>> x5n);
 	void setMultiParamsImplicitSwappedPojo(ImplicitSwappedPojo x1, ImplicitSwappedPojo[][][] x2, ImplicitSwappedPojo[][][] x2n, List<ImplicitSwappedPojo[][][]> x3, List<ImplicitSwappedPojo[][][]> x3n, Map<ImplicitSwappedPojo,ImplicitSwappedPojo> x4, Map<ImplicitSwappedPojo,ImplicitSwappedPojo> x4n, Map<ImplicitSwappedPojo,List<ImplicitSwappedPojo[][][]>> x5, Map<ImplicitSwappedPojo,List<ImplicitSwappedPojo[][][]>> x5n);
 	void setMultiParamsEnum(TestEnum x1, TestEnum[][][] x2, TestEnum[][][] x2n, List<TestEnum[][][]> x3, List<TestEnum[][][]> x3n, Map<TestEnum,TestEnum> x4, Map<TestEnum,TestEnum> x4n, Map<TestEnum,List<TestEnum[][][]>> x5, Map<TestEnum,List<TestEnum[][][]>> x5n);
@@ -180,17 +178,6 @@ public interface InterfaceProxy {
 	// Helper classes
 	//--------------------------------------------------------------------------------
 
-	public static class Bean {
-		public int a;
-		public String b;
-
-		Bean init() {
-			this.a = 1;
-			this.b = "foo";
-			return this;
-		}
-	}
-
 	@SuppressWarnings("serial")
 	public static class InterfaceProxyException1 extends Throwable {
 		public InterfaceProxyException1(String msg) {
@@ -201,59 +188,4 @@ public interface InterfaceProxy {
 	@SuppressWarnings("serial")
 	public static class InterfaceProxyException2 extends Throwable {
 	}
-
-	@Pojo(swap=SwappedPojoSwap.class)
-	public static class SwappedPojo {
-		public boolean wasUnswapped;
-	}
-
-	public static class SwappedPojoSwap extends PojoSwap<SwappedPojo,String> {
-		@Override
-		public String swap(BeanSession session, SwappedPojo c) throws SerializeException {
-			return SWAP;
-		}
-
-		@Override
-		public SwappedPojo unswap(BeanSession session, String f, ClassMeta<?> hint) throws ParseException {
-			SwappedPojo c = new SwappedPojo();
-			if (f.equals(SWAP))
-				c.wasUnswapped = true;
-			return c;
-		}
-	}
-
-	@BeanIgnore
-	public static class ImplicitSwappedPojo {
-		public boolean wasUnswapped;
-		@Override
-		public String toString() {
-			return SWAP;
-		}
-		public ImplicitSwappedPojo() {
-		}
-		public ImplicitSwappedPojo(String fromString) {
-			if (fromString.equals(SWAP))
-				wasUnswapped = true;
-		}
-	}
-
-	public static enum TestEnum {
-		ONE,TWO,THREE
-	}
-
-	@org.apache.juneau.annotation.Bean(beanDictionary={TypedBeanImpl.class})
-	public static interface TypedBean {
-	}
-
-	@org.apache.juneau.annotation.Bean(typeName="TypedBeanImpl", sort=true)
-	public static class TypedBeanImpl implements TypedBean {
-		public int a;
-		public String b;
-
-		public TypedBeanImpl init() {
-			this.a = 1;
-			this.b = "foo";
-			return this;
-		}
-	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxyResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxyResource.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxyResource.java
index a5ade59..7b63d6f 100644
--- a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxyResource.java
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxyResource.java
@@ -13,6 +13,7 @@
 package org.apache.juneau.rest.test;
 
 import static java.util.Arrays.*;
+import static org.apache.juneau.rest.test.TestUtils.*;
 import static org.junit.Assert.*;
 
 import java.util.*;
@@ -20,6 +21,7 @@ import java.util.*;
 import org.apache.juneau.json.*;
 import org.apache.juneau.rest.annotation.*;
 import org.apache.juneau.rest.jena.*;
+import org.apache.juneau.rest.test.pojos.*;
 import org.apache.juneau.utils.*;
 import org.junit.*;
 
@@ -43,53 +45,66 @@ public class InterfaceProxyResource extends RestServletJenaDefault {
 			//--------------------------------------------------------------------------------
 
 			// Various primitives
+
 			@Override
 			public void returnVoid() {
 			}
+
 			@Override
 			public Integer returnInteger() {
 				return 1;
 			}
+
 			@Override
 			public int returnInt() {
 				return 1;
 			}
+
 			@Override
 			public boolean returnBoolean() {
 				return true;
 			}
+
 			@Override
 			public float returnFloat() {
 				return 1f;
 			}
+
 			@Override
 			public Float returnFloatObject() {
 				return 1f;
 			}
+
 			@Override
 			public String returnString() {
 				return "foobar";
 			}
+
 			@Override
 			public String returnNullString() {
 				return null;
 			}
+
 			@Override
 			public int[][][] returnInt3dArray() {
 				return new int[][][]{{{1,2},null},null};
 			}
+
 			@Override
 			public Integer[][][] returnInteger3dArray() {
 				return new Integer[][][]{{{1,null},null},null};
 			}
+
 			@Override
 			public String[][][] returnString3dArray() {
 				return new String[][][]{{{"foo","bar",null},null},null};
 			}
+
 			@Override
 			public List<Integer> returnIntegerList() {
 				return asList(new Integer[]{1,null});
 			}
+
 			@Override
 			public List<List<List<Integer>>> returnInteger3dList() {
 				return new AList<List<List<Integer>>>()
@@ -102,136 +117,167 @@ public class InterfaceProxyResource extends RestServletJenaDefault {
 				)
 				.append(null);
 			}
+
 			@Override
 			public List<Integer[][][]> returnInteger1d3dList() {
 				return new AList<Integer[][][]>().append(new Integer[][][]{{{1,null},null},null}).append(null);
 			}
+
 			@Override
 			public List<int[][][]> returnInt1d3dList() {
 				return new AList<int[][][]>().append(new int[][][]{{{1,2},null},null}).append(null);
 			}
+
 			@Override
 			public List<String> returnStringList() {
 				return asList(new String[]{"foo","bar",null});
 			}
 
 			// Beans
+
 			@Override
-			public Bean returnBean() {
-				return new Bean().init();
+			public ABean returnBean() {
+				return new ABean().init();
 			}
+
 			@Override
-			public Bean[][][] returnBean3dArray() {
-				return new Bean[][][]{{{new Bean().init(),null},null},null};
+			public ABean[][][] returnBean3dArray() {
+				return new ABean[][][]{{{new ABean().init(),null},null},null};
 			}
+
 			@Override
-			public List<Bean> returnBeanList() {
-				return asList(new Bean().init());
+			public List<ABean> returnBeanList() {
+				return asList(new ABean().init());
 			}
+
 			@Override
-			public List<Bean[][][]> returnBean1d3dList() {
-				return new AList<Bean[][][]>().append(new Bean[][][]{{{new Bean().init(),null},null},null}).append(null);
+			public List<ABean[][][]> returnBean1d3dList() {
+				return new AList<ABean[][][]>().append(new ABean[][][]{{{new ABean().init(),null},null},null}).append(null);
 			}
+
 			@Override
-			public Map<String,Bean> returnBeanMap() {
-				return new AMap<String,Bean>().append("foo",new Bean().init());
+			public Map<String,ABean> returnBeanMap() {
+				return new AMap<String,ABean>().append("foo",new ABean().init());
 			}
+
 			@Override
-			public Map<String,List<Bean>> returnBeanListMap() {
-				return new AMap<String,List<Bean>>().append("foo",asList(new Bean().init()));
+			public Map<String,List<ABean>> returnBeanListMap() {
+				return new AMap<String,List<ABean>>().append("foo",asList(new ABean().init()));
 			}
+
 			@Override
-			public Map<String,List<Bean[][][]>> returnBean1d3dListMap() {
-				return new AMap<String,List<Bean[][][]>>().append("foo", new AList<Bean[][][]>().append(new Bean[][][]{{{new Bean().init(),null},null},null}).append(null));
+			public Map<String,List<ABean[][][]>> returnBean1d3dListMap() {
+				return new AMap<String,List<ABean[][][]>>().append("foo", new AList<ABean[][][]>().append(new ABean[][][]{{{new ABean().init(),null},null},null}).append(null));
 			}
+
 			@Override
-			public Map<Integer,List<Bean>> returnBeanListMapIntegerKeys() {
-				return new AMap<Integer,List<Bean>>().append(1,asList(new Bean().init()));
+			public Map<Integer,List<ABean>> returnBeanListMapIntegerKeys() {
+				return new AMap<Integer,List<ABean>>().append(1,asList(new ABean().init()));
 			}
 
 			// Typed beans
+
 			@Override
 			public TypedBean returnTypedBean() {
 				return new TypedBeanImpl().init();
 			}
+
 			@Override
 			public TypedBean[][][] returnTypedBean3dArray() {
 				return new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null};
 			}
+
 			@Override
 			public List<TypedBean> returnTypedBeanList() {
 				return asList((TypedBean)new TypedBeanImpl().init());
 			}
+
 			@Override
 			public List<TypedBean[][][]> returnTypedBean1d3dList() {
 				return new AList<TypedBean[][][]>().append(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null}).append(null);
 			}
+
 			@Override
 			public Map<String,TypedBean> returnTypedBeanMap() {
 				return new AMap<String,TypedBean>().append("foo",new TypedBeanImpl().init());
 			}
+
 			@Override
 			public Map<String,List<TypedBean>> returnTypedBeanListMap() {
 				return new AMap<String,List<TypedBean>>().append("foo",asList((TypedBean)new TypedBeanImpl().init()));
 			}
+
 			@Override
 			public Map<String,List<TypedBean[][][]>> returnTypedBean1d3dListMap() {
 				return new AMap<String,List<TypedBean[][][]>>().append("foo", new AList<TypedBean[][][]>().append(new TypedBean[][][]{{{new TypedBeanImpl().init(),null},null},null}).append(null));
 			}
+
 			@Override
 			public Map<Integer,List<TypedBean>> returnTypedBeanListMapIntegerKeys() {
 				return new AMap<Integer,List<TypedBean>>().append(1,asList((TypedBean)new TypedBeanImpl().init()));
 			}
 
 			// Swapped POJOs
+
 			@Override
 			public SwappedPojo returnSwappedPojo() {
 				return new SwappedPojo();
 			}
+
 			@Override
 			public SwappedPojo[][][] returnSwappedPojo3dArray() {
 				return new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null};
 			}
+
 			@Override
 			public Map<SwappedPojo,SwappedPojo> returnSwappedPojoMap() {
 				return new AMap<SwappedPojo,SwappedPojo>().append(new SwappedPojo(), new SwappedPojo());
 			}
+
 			@Override
 			public Map<SwappedPojo,SwappedPojo[][][]> returnSwappedPojo3dMap() {
 				return new AMap<SwappedPojo,SwappedPojo[][][]>().append(new SwappedPojo(), new SwappedPojo[][][]{{{new SwappedPojo(),null},null},null});
 			}
 
 			// Implicit swapped POJOs
+
 			@Override
 			public ImplicitSwappedPojo returnImplicitSwappedPojo() {
 				return new ImplicitSwappedPojo();
 			}
+
 			@Override
 			public ImplicitSwappedPojo[][][] returnImplicitSwappedPojo3dArray() {
 				return new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null};
 			}
+
 			@Override
 			public Map<ImplicitSwappedPojo,ImplicitSwappedPojo> returnImplicitSwappedPojoMap() {
 				return new AMap<ImplicitSwappedPojo,ImplicitSwappedPojo>().append(new ImplicitSwappedPojo(), new ImplicitSwappedPojo());
 			}
+
 			@Override
 			public Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> returnImplicitSwappedPojo3dMap() {
 				return new AMap<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]>().append(new ImplicitSwappedPojo(), new ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null});
 			}
 
 			// Enums
+
 			@Override
 			public TestEnum returnEnum() {
 				return TestEnum.TWO;
 			}
+
 			@Override
 			public TestEnum[][][] returnEnum3d() {
 				return new TestEnum[][][]{{{TestEnum.TWO,null},null},null};
 			}
+
 			@Override
 			public List<TestEnum> returnEnumList() {
 				return new AList<TestEnum>().append(TestEnum.TWO).append(null);
 			}
+
 			@Override
 			public List<List<List<TestEnum>>> returnEnum3dList() {
 				return new AList<List<List<TestEnum>>>()
@@ -244,18 +290,22 @@ public class InterfaceProxyResource extends RestServletJenaDefault {
 				.append(null)
 				);
 			}
+
 			@Override
 			public List<TestEnum[][][]> returnEnum1d3dList() {
 				return new AList<TestEnum[][][]>().append(new TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null);
 			}
+
 			@Override
 			public Map<TestEnum,TestEnum> returnEnumMap() {
 				return new AMap<TestEnum,TestEnum>().append(TestEnum.ONE,TestEnum.TWO);
 			}
+
 			@Override
 			public Map<TestEnum,TestEnum[][][]> returnEnum3dArrayMap() {
 				return new AMap<TestEnum,TestEnum[][][]>().append(TestEnum.ONE, new TestEnum[][][]{{{TestEnum.TWO,null},null},null});
 			}
+
 			@Override
 			public Map<TestEnum,List<TestEnum[][][]>> returnEnum1d3dListMap() {
 				return new AMap<TestEnum,List<TestEnum[][][]>>().append(TestEnum.ONE, new AList<TestEnum[][][]>().append(new TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null));
@@ -269,6 +319,7 @@ public class InterfaceProxyResource extends RestServletJenaDefault {
 			public void throwException1() throws InterfaceProxy.InterfaceProxyException1 {
 				throw new InterfaceProxy.InterfaceProxyException1("foo");
 			}
+
 			@Override
 			public void throwException2() throws InterfaceProxy.InterfaceProxyException2 {
 				throw new InterfaceProxy.InterfaceProxyException2();
@@ -279,162 +330,197 @@ public class InterfaceProxyResource extends RestServletJenaDefault {
 			//--------------------------------------------------------------------------------
 
 			// Various primitives
+
 			@Override
 			public void setNothing() {
 			}
+
 			@Override
 			public void setInt(int x) {
 				assertEquals(1, x);
 			}
+
 			@Override
 			public void setInteger(Integer x) {
 				assertEquals((Integer)1, x);
 			}
+
 			@Override
 			public void setBoolean(boolean x) {
 				assertTrue(x);
 			}
+
 			@Override
 			public void setFloat(float x) {
 				assertTrue(1f == x);
 			}
+
 			@Override
 			public void setFloatObject(Float x) {
 				assertTrue(1f == x);
 			}
+
 			@Override
 			public void setString(String x) {
 				assertEquals("foo", x);
 			}
+
 			@Override
 			public void setNullString(String x) {
 				assertNull(x);
 			}
+
 			@Override
 			public void setInt3dArray(int[][][] x) {
 				assertObjectEquals("[[[1,2],null],null]", x);
 			}
+
 			@Override
 			public void setInteger3dArray(Integer[][][] x) {
 				assertObjectEquals("[[[1,null],null],null]", x);
 			}
+
 			@Override
 			public void setString3dArray(String[][][] x) {
 				assertObjectEquals("[[['foo',null],null],null]", x);
 			}
+
 			@Override
 			public void setIntegerList(List<Integer> x) {
 				assertObjectEquals("[1,null]", x);
-				assertEquals(Integer.class, x.get(0).getClass());
+				assertClass(Integer.class, x.get(0));
 			}
+
 			@Override
 			public void setInteger3dList(List<List<List<Integer>>> x) {
 				assertObjectEquals("[[[1,null],null],null]", x);
-				assertEquals(Integer.class, x.get(0).get(0).get(0).getClass());
+				assertClass(Integer.class, x.get(0).get(0).get(0));
 			}
+
 			@Override
 			public void setInteger1d3dList(List<Integer[][][]> x) {
 				assertObjectEquals("[[[[1,null],null],null],null]", x);
-				assertEquals(Integer[][][].class, x.get(0).getClass());
-				assertEquals(Integer.class, x.get(0)[0][0][0].getClass());
+				assertClass(Integer[][][].class, x.get(0));
+				assertClass(Integer.class, x.get(0)[0][0][0]);
 			}
+
 			@Override
 			public void setInt1d3dList(List<int[][][]> x) {
 				assertObjectEquals("[[[[1,2],null],null],null]", x);
-				assertEquals(int[][][].class, x.get(0).getClass());
+				assertClass(int[][][].class, x.get(0));
 			}
+
 			@Override
 			public void setStringList(List<String> x) {
 				assertObjectEquals("['foo','bar',null]", x);
 			}
 
 			// Beans
+
 			@Override
-			public void setBean(Bean x) {
+			public void setBean(ABean x) {
 				assertObjectEquals("{a:1,b:'foo'}", x);
 			}
+
 			@Override
-			public void setBean3dArray(Bean[][][] x) {
+			public void setBean3dArray(ABean[][][] x) {
 				assertObjectEquals("[[[{a:1,b:'foo'},null],null],null]", x);
 			}
+
 			@Override
-			public void setBeanList(List<Bean> x) {
+			public void setBeanList(List<ABean> x) {
 				assertObjectEquals("[{a:1,b:'foo'}]", x);
 			}
+
 			@Override
-			public void setBean1d3dList(List<Bean[][][]> x) {
+			public void setBean1d3dList(List<ABean[][][]> x) {
 				assertObjectEquals("[[[[{a:1,b:'foo'},null],null],null],null]", x);
 			}
+
 			@Override
-			public void setBeanMap(Map<String,Bean> x) {
+			public void setBeanMap(Map<String,ABean> x) {
 				assertObjectEquals("{foo:{a:1,b:'foo'}}", x);
 			}
+
 			@Override
-			public void setBeanListMap(Map<String,List<Bean>> x) {
+			public void setBeanListMap(Map<String,List<ABean>> x) {
 				assertObjectEquals("{foo:[{a:1,b:'foo'}]}", x);
 			}
+
 			@Override
-			public void setBean1d3dListMap(Map<String,List<Bean[][][]>> x) {
+			public void setBean1d3dListMap(Map<String,List<ABean[][][]>> x) {
 				assertObjectEquals("{foo:[[[[{a:1,b:'foo'},null],null],null],null]}", x);
 			}
+
 			@Override
-			public void setBeanListMapIntegerKeys(Map<Integer,List<Bean>> x) {
+			public void setBeanListMapIntegerKeys(Map<Integer,List<ABean>> x) {
 				assertObjectEquals("{'1':[{a:1,b:'foo'}]}", x);  // Note: JsonSerializer serializes key as string.
-				assertEquals(Integer.class, x.keySet().iterator().next().getClass());
+				assertClass(Integer.class, x.keySet().iterator().next());
 			}
 
 			// Typed beans
+
 			@Override
 			public void setTypedBean(TypedBean x) {
 				assertObjectEquals("{_type:'TypedBeanImpl',a:1,b:'foo'}", x);
-				assertEquals(TypedBeanImpl.class, x.getClass());
+				assertClass(TypedBeanImpl.class, x);
 			}
+
 			@Override
 			public void setTypedBean3dArray(TypedBean[][][] x) {
 				assertObjectEquals("[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null]", x);
-				assertEquals(TypedBeanImpl.class, x[0][0][0].getClass());
+				assertClass(TypedBeanImpl.class, x[0][0][0]);
 			}
+
 			@Override
 			public void setTypedBeanList(List<TypedBean> x) {
 				assertObjectEquals("[{_type:'TypedBeanImpl',a:1,b:'foo'}]", x);
-				assertEquals(TypedBeanImpl.class, x.get(0).getClass());
+				assertClass(TypedBeanImpl.class, x.get(0));
 			}
+
 			@Override
 			public void setTypedBean1d3dList(List<TypedBean[][][]> x) {
 				assertObjectEquals("[[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null],null]", x);
-				assertEquals(TypedBeanImpl.class, x.get(0)[0][0][0].getClass());
+				assertClass(TypedBeanImpl.class, x.get(0)[0][0][0]);
 			}
+
 			@Override
 			public void setTypedBeanMap(Map<String,TypedBean> x) {
 				assertObjectEquals("{foo:{_type:'TypedBeanImpl',a:1,b:'foo'}}", x);
-				assertEquals(TypedBeanImpl.class, x.get("foo").getClass());
+				assertClass(TypedBeanImpl.class, x.get("foo"));
 			}
+
 			@Override
 			public void setTypedBeanListMap(Map<String,List<TypedBean>> x) {
 				assertObjectEquals("{foo:[{_type:'TypedBeanImpl',a:1,b:'foo'}]}", x);
-				assertEquals(TypedBeanImpl.class, x.get("foo").get(0).getClass());
+				assertClass(TypedBeanImpl.class, x.get("foo").get(0));
 			}
+
 			@Override
 			public void setTypedBean1d3dListMap(Map<String,List<TypedBean[][][]>> x) {
 				assertObjectEquals("{foo:[[[[{_type:'TypedBeanImpl',a:1,b:'foo'},null],null],null],null]}", x);
-				assertEquals(TypedBeanImpl.class, x.get("foo").get(0)[0][0][0].getClass());
+				assertClass(TypedBeanImpl.class, x.get("foo").get(0)[0][0][0]);
 			}
+
 			@Override
 			public void setTypedBeanListMapIntegerKeys(Map<Integer,List<TypedBean>> x) {
 				assertObjectEquals("{'1':[{_type:'TypedBeanImpl',a:1,b:'foo'}]}", x);  // Note: JsonSerializer serializes key as string.
-				assertEquals(TypedBeanImpl.class, x.get(1).get(0).getClass());
+				assertClass(TypedBeanImpl.class, x.get(1).get(0));
 			}
 
 			// Swapped POJOs
+
 			@Override
 			public void setSwappedPojo(SwappedPojo x) {
 				assertTrue(x.wasUnswapped);
 			}
+
 			@Override
 			public void setSwappedPojo3dArray(SwappedPojo[][][] x) {
 				assertObjectEquals("[[['"+SWAP+"',null],null],null]", x);
 				assertTrue(x[0][0][0].wasUnswapped);
 			}
+
 			@Override
 			public void setSwappedPojoMap(Map<SwappedPojo,SwappedPojo> x) {
 				assertObjectEquals("{'"+SWAP+"':'"+SWAP+"'}", x);
@@ -442,6 +528,7 @@ public class InterfaceProxyResource extends RestServletJenaDefault {
 				assertTrue(e.getKey().wasUnswapped);
 				assertTrue(e.getValue().wasUnswapped);
 			}
+
 			@Override
 			public void setSwappedPojo3dMap(Map<SwappedPojo,SwappedPojo[][][]> x) {
 				assertObjectEquals("{'"+SWAP+"':[[['"+SWAP+"',null],null],null]}", x);
@@ -451,15 +538,18 @@ public class InterfaceProxyResource extends RestServletJenaDefault {
 			}
 
 			// Implicit swapped POJOs
+
 			@Override
 			public void setImplicitSwappedPojo(ImplicitSwappedPojo x) {
 				assertTrue(x.wasUnswapped);
 			}
+
 			@Override
 			public void setImplicitSwappedPojo3dArray(ImplicitSwappedPojo[][][] x) {
 				assertObjectEquals("[[['"+SWAP+"',null],null],null]", x);
 				assertTrue(x[0][0][0].wasUnswapped);
 			}
+
 			@Override
 			public void setImplicitSwappedPojoMap(Map<ImplicitSwappedPojo,ImplicitSwappedPojo> x) {
 				assertObjectEquals("{'"+SWAP+"':'"+SWAP+"'}", x);
@@ -467,6 +557,7 @@ public class InterfaceProxyResource extends RestServletJenaDefault {
 				assertTrue(e.getKey().wasUnswapped);
 				assertTrue(e.getValue().wasUnswapped);
 			}
+
 			@Override
 			public void setImplicitSwappedPojo3dMap(Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> x) {
 				assertObjectEquals("{'"+SWAP+"':[[['"+SWAP+"',null],null],null]}", x);
@@ -476,49 +567,57 @@ public class InterfaceProxyResource extends RestServletJenaDefault {
 			}
 
 			// Enums
+
 			@Override
 			public void setEnum(TestEnum x) {
 				assertEquals(TestEnum.TWO, x);
 			}
+
 			@Override
 			public void setEnum3d(TestEnum[][][] x) {
 				assertObjectEquals("[[['TWO',null],null],null]", x);
 			}
+
 			@Override
 			public void setEnumList(List<TestEnum> x) {
 				assertObjectEquals("['TWO',null]", x);
-				assertEquals(TestEnum.class, x.get(0).getClass());
+				assertClass(TestEnum.class, x.get(0));
 			}
+
 			@Override
 			public void setEnum3dList(List<List<List<TestEnum>>> x) {
 				assertObjectEquals("[[['TWO',null],null,null]]", x);
-				assertEquals(TestEnum.class, x.get(0).get(0).get(0).getClass());
+				assertClass(TestEnum.class, x.get(0).get(0).get(0));
 			}
+
 			@Override
 			public void setEnum1d3dList(List<TestEnum[][][]> x) {
 				assertObjectEquals("[[[['TWO',null],null],null],null]", x);
-				assertEquals(TestEnum[][][].class, x.get(0).getClass());
+				assertClass(TestEnum[][][].class, x.get(0));
 			}
+
 			@Override
 			public void setEnumMap(Map<TestEnum,TestEnum> x) {
 				assertObjectEquals("{ONE:'TWO'}", x);
 				Map.Entry<TestEnum,TestEnum> e = x.entrySet().iterator().next();
-				assertEquals(TestEnum.class, e.getKey().getClass());
-				assertEquals(TestEnum.class, e.getValue().getClass());
+				assertClass(TestEnum.class, e.getKey());
+				assertClass(TestEnum.class, e.getValue());
 			}
+
 			@Override
 			public void setEnum3dArrayMap(Map<TestEnum,TestEnum[][][]> x) {
 				assertObjectEquals("{ONE:[[['TWO',null],null],null]}", x);
 				Map.Entry<TestEnum,TestEnum[][][]> e = x.entrySet().iterator().next();
-				assertEquals(TestEnum.class, e.getKey().getClass());
-				assertEquals(TestEnum[][][].class, e.getValue().getClass());
+				assertClass(TestEnum.class, e.getKey());
+				assertClass(TestEnum[][][].class, e.getValue());
 			}
+
 			@Override
 			public void setEnum1d3dListMap(Map<TestEnum,List<TestEnum[][][]>> x) {
 				assertObjectEquals("{ONE:[[[['TWO',null],null],null],null]}", x);
 				Map.Entry<TestEnum,List<TestEnum[][][]>> e = x.entrySet().iterator().next();
-				assertEquals(TestEnum.class, e.getKey().getClass());
-				assertEquals(TestEnum[][][].class, e.getValue().get(0).getClass());
+				assertClass(TestEnum.class, e.getKey());
+				assertClass(TestEnum[][][].class, e.getValue().get(0));
 			}
 
 			//--------------------------------------------------------------------------------
@@ -531,91 +630,99 @@ public class InterfaceProxyResource extends RestServletJenaDefault {
 				assertObjectEquals("[[[1,2],null],null]", x2);
 				assertNull(x2n);
 				assertObjectEquals("[[[[1,2],null],null],null]", x3);
-				assertEquals(int[][][].class, x3.get(0).getClass());
+				assertClass(int[][][].class, x3.get(0));
 				assertNull(x3n);
 			}
+
 			@Override
 			public void setMultiParamsInteger(Integer x1, Integer x1n, Integer[][][] x2, Integer[][][] x2n, List<Integer[][][]> x3, List<Integer[][][]> x3n) {
 				assertObjectEquals("1", x1);
 				assertObjectEquals("[[[1,null],null],null]", x2);
 				assertNull(x2n);
 				assertObjectEquals("[[[[1,null],null],null],null]", x3);
-				assertEquals(Integer[][][].class, x3.get(0).getClass());
+				assertClass(Integer[][][].class, x3.get(0));
 				assertNull(x3n);
 			}
+
 			@Override
 			public void setMultiParamsFloat(float x1, float[][][] x2, float[][][] x2n, List<float[][][]> x3, List<float[][][]> x3n) {
 				assertObjectEquals("1.0", x1);
 				assertObjectEquals("[[[1.0,2.0],null],null]", x2);
 				assertNull(x2n);
 				assertObjectEquals("[[[[1.0,2.0],null],null],null]", x3);
-				assertEquals(float[][][].class, x3.get(0).getClass());
+				assertClass(float[][][].class, x3.get(0));
 				assertNull(x3n);
 			}
+
 			@Override
 			public void setMultiParamsFloatObject(Float x1, Float x1n, Float[][][] x2, Float[][][] x2n, List<Float[][][]> x3, List<Float[][][]> x3n) {
 				assertObjectEquals("1.0", x1);
 				assertObjectEquals("[[[1.0,null],null],null]", x2);
 				assertNull(x2n);
 				assertObjectEquals("[[[[1.0,null],null],null],null]", x3);
-				assertEquals(Float[][][].class, x3.get(0).getClass());
+				assertClass(Float[][][].class, x3.get(0));
 				assertNull(x3n);
 			}
+
 			@Override
 			public void setMultiParamsString(String x1, String[][][] x2, String[][][] x2n, List<String[][][]> x3, List<String[][][]> x3n) {
 				assertObjectEquals("'foo'", x1);
 				assertObjectEquals("[[['foo',null],null],null]", x2);
 				assertNull(x2n);
 				assertObjectEquals("[[[['foo',null],null],null],null]", x3);
-				assertEquals(String[][][].class, x3.get(0).getClass());
+				assertClass(String[][][].class, x3.get(0));
 				assertNull(x3n);
 			}
+
 			@Override
-			public void setMultiParamsBean(Bean x1, Bean[][][] x2, Bean[][][] x2n, List<Bean[][][]> x3, List<Bean[][][]> x3n, Map<String,Bean> x4, Map<String,Bean> x4n, Map<String,List<Bean[][][]>> x5, Map<String,List<Bean[][][]>> x5n) {
+			public void setMultiParamsBean(ABean x1, ABean[][][] x2, ABean[][][] x2n, List<ABean[][][]> x3, List<ABean[][][]> x3n, Map<String,ABean> x4, Map<String,ABean> x4n, Map<String,List<ABean[][][]>> x5, Map<String,List<ABean[][][]>> x5n) {
 				assertObjectEquals("{a:1,b:'foo'}", x1);
 				assertObjectEquals("[[[{a:1,b:'foo'},null],null],null]", x2);
 				assertNull(x2n);
 				assertObjectEquals("[[[[{a:1,b:'foo'},null],null],null],null]", x3);
-				assertEquals(Bean[][][].class, x3.get(0).getClass());
+				assertClass(ABean[][][].class, x3.get(0));
 				assertNull(x3n);
 				assertObjectEquals("{foo:{a:1,b:'foo'}}", x4);
 				assertNull(x4n);
 				assertObjectEquals("{foo:[[[[{a:1,b:'foo'},null],null],null],null]}", x5);
 				assertNull(x5n);
 			}
+
 			@Override
 			public void setMultiParamsSwappedPojo(SwappedPojo x1, SwappedPojo[][][] x2, SwappedPojo[][][] x2n, List<SwappedPojo[][][]> x3, List<SwappedPojo[][][]> x3n, Map<SwappedPojo,SwappedPojo> x4, Map<SwappedPojo,SwappedPojo> x4n, Map<SwappedPojo,List<SwappedPojo[][][]>> x5, Map<SwappedPojo,List<SwappedPojo[][][]>> x5n) {
 				assertObjectEquals("'"+SWAP+"'", x1);
 				assertObjectEquals("[[['"+SWAP+"',null],null],null]", x2);
 				assertNull(x2n);
 				assertObjectEquals("[[[['"+SWAP+"',null],null],null],null]", x3);
-				assertEquals(SwappedPojo[][][].class, x3.get(0).getClass());
+				assertClass(SwappedPojo[][][].class, x3.get(0));
 				assertNull(x3n);
 				assertObjectEquals("{'"+SWAP+"':'"+SWAP+"'}", x4);
 				assertNull(x4n);
 				assertObjectEquals("{'"+SWAP+"':[[[['"+SWAP+"',null],null],null],null]}", x5);
 				assertNull(x5n);
 			}
+
 			@Override
 			public void setMultiParamsImplicitSwappedPojo(ImplicitSwappedPojo x1, ImplicitSwappedPojo[][][] x2, ImplicitSwappedPojo[][][] x2n, List<ImplicitSwappedPojo[][][]> x3, List<ImplicitSwappedPojo[][][]> x3n, Map<ImplicitSwappedPojo,ImplicitSwappedPojo> x4, Map<ImplicitSwappedPojo,ImplicitSwappedPojo> x4n, Map<ImplicitSwappedPojo,List<ImplicitSwappedPojo[][][]>> x5, Map<ImplicitSwappedPojo,List<ImplicitSwappedPojo[][][]>> x5n) {
 				assertObjectEquals("'"+SWAP+"'", x1);
 				assertObjectEquals("[[['"+SWAP+"',null],null],null]", x2);
 				assertNull(x2n);
 				assertObjectEquals("[[[['"+SWAP+"',null],null],null],null]", x3);
-				assertEquals(ImplicitSwappedPojo[][][].class, x3.get(0).getClass());
+				assertClass(ImplicitSwappedPojo[][][].class, x3.get(0));
 				assertNull(x3n);
 				assertObjectEquals("{'"+SWAP+"':'"+SWAP+"'}", x4);
 				assertNull(x4n);
 				assertObjectEquals("{'"+SWAP+"':[[[['"+SWAP+"',null],null],null],null]}", x5);
 				assertNull(x5n);
 			}
+
 			@Override
 			public void setMultiParamsEnum(TestEnum x1, TestEnum[][][] x2, TestEnum[][][] x2n, List<TestEnum[][][]> x3, List<TestEnum[][][]> x3n, Map<TestEnum,TestEnum> x4, Map<TestEnum,TestEnum> x4n, Map<TestEnum,List<TestEnum[][][]>> x5, Map<TestEnum,List<TestEnum[][][]>> x5n) {
 				assertObjectEquals("'TWO'", x1);
 				assertObjectEquals("[[['TWO',null],null],null]", x2);
 				assertNull(x2n);
 				assertObjectEquals("[[[['TWO',null],null],null],null]", x3);
-				assertEquals(TestEnum[][][].class, x3.get(0).getClass());
+				assertClass(TestEnum[][][].class, x3.get(0));
 				assertNull(x3n);
 				assertObjectEquals("{ONE:'TWO'}", x4);
 				assertNull(x4n);

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/Root.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/Root.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/Root.java
index fabb545..34a18eb 100644
--- a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/Root.java
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/Root.java
@@ -31,6 +31,7 @@ import org.apache.juneau.rest.labels.*;
 		DefaultContentTypesResource.class,
 		ErrorConditionsResource.class,
 		TransformsResource.class,
+		FormDataResource.class,
 		GroupsResource.class,
 		GzipResource.TestGzipOff.class,
 		GzipResource.TestGzipOn.class,
@@ -60,6 +61,7 @@ import org.apache.juneau.rest.labels.*;
 		RestClient2Resource.class,
 		SerializersResource.class,
 		StaticFilesResource.class,
+		ThirdPartyProxyResource.class,
 		UrisResource.class,
 		UrlContentResource.class,
 		ShutdownResource.class

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/TestUtils.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/TestUtils.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/TestUtils.java
new file mode 100644
index 0000000..102c17e
--- /dev/null
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/TestUtils.java
@@ -0,0 +1,79 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.rest.test;
+
+import java.text.*;
+
+import org.apache.juneau.json.*;
+import org.apache.juneau.rest.client.*;
+import org.apache.juneau.serializer.*;
+import org.apache.juneau.transforms.*;
+import org.junit.Assert;
+
+import junit.framework.*;
+
+public class TestUtils {
+
+	private static JsonSerializer js2 = new JsonSerializerBuilder()
+		.simple()
+		.pojoSwaps(IteratorSwap.class, EnumerationSwap.class)
+		.build();
+
+	/**
+	 * Assert that the object equals the specified string after running it through JsonSerializer.DEFAULT_LAX.toString().
+	 */
+	public static void assertObjectEquals(String s, Object o) {
+		assertObjectEquals(s, o, js2);
+	}
+
+	/**
+	 * Assert that the object is an instance of the specified class.
+	 */
+	public static void assertClass(Class<?> c, Object o) {
+		Assert.assertEquals(c, o == null ? null : o.getClass());
+	}
+
+	/**
+	 * Assert that the object equals the specified string after running it through ws.toString().
+	 */
+	public static void assertObjectEquals(String s, Object o, WriterSerializer ws) {
+		Assert.assertEquals(s, ws.toString(o));
+	}
+
+	public static void checkErrorResponse(boolean debug, RestCallException e, int status, String...contains) throws AssertionFailedError {
+		String r = e.getResponseMessage();
+		if (debug) {
+			System.err.println(r); // NOT DEBUG
+			e.printStackTrace();
+		}
+		if (status != e.getResponseCode()) {
+			dumpResponse(r, "Response status code was not correct.  Expected: ''{0}''.  Actual: ''{1}''", status, e.getResponseCode());
+			throw new AssertionFailedError(MessageFormat.format("Response status code was not correct.  Expected: ''{0}''.  Actual: ''{1}''", status, e.getResponseCode()));
+		}
+		for (String s : contains) {
+			if (r == null || ! r.contains(s)) {
+				if (! debug)
+					dumpResponse(r, "Response did not have the following expected text: ''{0}''", s);
+				throw new AssertionFailedError(MessageFormat.format("Response did not have the following expected text: ''{0}''", s));
+			}
+		}
+	}
+
+	private static void dumpResponse(String r, String msg, Object...args) {
+		System.err.println("*** Failure ****************************************************************************************"); // NOT DEBUG
+		System.err.println(MessageFormat.format(msg, args));
+		System.err.println("*** Response-Start *********************************************************************************"); // NOT DEBUG
+		System.err.println(r); // NOT DEBUG
+		System.err.println("*** Response-End ***********************************************************************************"); // NOT DEBUG
+	}
+}


[6/7] incubator-juneau git commit: Support for 3rd-party proxy interfaces.

Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializer.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializer.java
index 3079ccb..aef3f64 100644
--- a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializer.java
@@ -203,16 +203,17 @@ public class UonSerializer extends WriterSerializer {
 	 * @param eType The expected type of the object if this is a bean property.
 	 * @param attrName The bean property name if this is a bean property.  <jk>null</jk> if this isn't a bean property being serialized.
 	 * @param pMeta The bean property metadata.
+	 * @param plainTextParams <jk>true</jk> if this is a top level parameter key or value and paramFormat is PLAINTEXT.
 	 *
 	 * @return The same writer passed in.
 	 * @throws Exception
 	 */
 	@SuppressWarnings({ "rawtypes", "unchecked" })
 	protected SerializerWriter serializeAnything(UonSerializerSession session, UonWriter out, Object o, ClassMeta<?> eType,
-			String attrName, BeanPropertyMeta pMeta) throws Exception {
+			String attrName, BeanPropertyMeta pMeta, boolean plainTextParams) throws Exception {
 
 		if (o == null) {
-			out.appendObject(null, false);
+			out.appendObject(null, false, plainTextParams);
 			return out;
 		}
 
@@ -247,7 +248,7 @@ public class UonSerializer extends WriterSerializer {
 
 		// '\0' characters are considered null.
 		if (o == null || (sType.isChar() && ((Character)o).charValue() == 0))
-			out.appendObject(null, false);
+			out.appendObject(null, false, plainTextParams);
 		else if (sType.isBoolean())
 			out.appendBoolean(o);
 		else if (sType.isNumber())
@@ -269,7 +270,7 @@ public class UonSerializer extends WriterSerializer {
 			serializeCollection(session, out, toList(sType.getInnerClass(), o), eType);
 		}
 		else {
-			out.appendObject(o, false);
+			out.appendObject(o, false, plainTextParams);
 		}
 
 		if (! isRecursion)
@@ -293,8 +294,8 @@ public class UonSerializer extends WriterSerializer {
 			Map.Entry e = (Map.Entry) mapEntries.next();
 			Object value = e.getValue();
 			Object key = session.generalize(e.getKey(), keyType);
-			out.cr(depth).appendObject(key, false).append('=');
-			serializeAnything(session, out, value, valueType, (key == null ? null : session.toString(key)), null);
+			out.cr(depth).appendObject(key, false, false).append('=');
+			serializeAnything(session, out, value, valueType, (key == null ? null : session.toString(key)), null, false);
 			if (mapEntries.hasNext())
 				out.append(',');
 		}
@@ -329,9 +330,9 @@ public class UonSerializer extends WriterSerializer {
 			if (addComma)
 				out.append(',');
 
-			out.cr(depth).appendObject(key, false).append('=');
+			out.cr(depth).appendObject(key, false, false).append('=');
 
-			serializeAnything(session, out, value, cMeta, key, pMeta);
+			serializeAnything(session, out, value, cMeta, key, pMeta, false);
 
 			addComma = true;
 		}
@@ -356,7 +357,7 @@ public class UonSerializer extends WriterSerializer {
 
 		for (Iterator i = c.iterator(); i.hasNext();) {
 			out.cr(depth);
-			serializeAnything(session, out, i.next(), elementType, "<iterator>", null);
+			serializeAnything(session, out, i.next(), elementType, "<iterator>", null, false);
 			if (i.hasNext())
 				out.append(',');
 		}
@@ -375,12 +376,12 @@ public class UonSerializer extends WriterSerializer {
 
 	@Override /* Serializer */
 	public UonSerializerSession createSession(Object output, ObjectMap op, Method javaMethod, Locale locale, TimeZone timeZone, MediaType mediaType) {
-		return new UonSerializerSession(ctx, op, output, javaMethod, locale, timeZone, mediaType);
+		return new UonSerializerSession(ctx, null, op, output, javaMethod, locale, timeZone, mediaType);
 	}
 
 	@Override /* Serializer */
 	protected void doSerialize(SerializerSession session, Object o) throws Exception {
 		UonSerializerSession s = (UonSerializerSession)session;
-		serializeAnything(s, s.getWriter(), o, s.getExpectedRootType(o), "root", null);
+		serializeAnything(s, s.getWriter(), o, s.getExpectedRootType(o), "root", null, false);
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerSession.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerSession.java
index 92fbe56..742d0da 100644
--- a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerSession.java
+++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerSession.java
@@ -38,6 +38,7 @@ public class UonSerializerSession extends SerializerSession {
 	 *
 	 * @param ctx The context creating this session object.
 	 * The context contains all the configuration settings for this object.
+	 * @param encode Override the {@link UonSerializerContext#UON_encodeChars} setting.
 	 * @param output The output object.  See {@link JsonSerializerSession#getWriter()} for valid class types.
 	 * @param op The override properties.
 	 * These override any context properties defined in the context.
@@ -48,13 +49,13 @@ public class UonSerializerSession extends SerializerSession {
 	 * If <jk>null</jk>, then the timezone defined on the context is used.
 	 * @param mediaType The session media type (e.g. <js>"application/json"</js>).
 	 */
-	protected UonSerializerSession(UonSerializerContext ctx, ObjectMap op, Object output, Method javaMethod, Locale locale, TimeZone timeZone, MediaType mediaType) {
+	protected UonSerializerSession(UonSerializerContext ctx, Boolean encode, ObjectMap op, Object output, Method javaMethod, Locale locale, TimeZone timeZone, MediaType mediaType) {
 		super(ctx, op, output, javaMethod, locale, timeZone, mediaType);
 		if (op == null || op.isEmpty()) {
-			encodeChars = ctx.encodeChars;
+			encodeChars = encode == null ? ctx.encodeChars : encode;
 			addBeanTypeProperties = ctx.addBeanTypeProperties;
 		} else {
-			encodeChars = op.getBoolean(UON_encodeChars, ctx.encodeChars);
+			encodeChars = encode == null ? op.getBoolean(UON_encodeChars, ctx.encodeChars) : encode;
 			addBeanTypeProperties = op.getBoolean(MSGPACK_addBeanTypeProperties, ctx.addBeanTypeProperties);
 		}
 	}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/uon/UonUtils.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonUtils.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonUtils.java
new file mode 100644
index 0000000..0f68a77
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonUtils.java
@@ -0,0 +1,52 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.uon;
+
+import org.apache.juneau.internal.*;
+
+/**
+ * Utility methods for the UON and UrlEncoding serializers and parsers.
+ */
+public final class UonUtils {
+
+	private static final AsciiSet needsQuoteChars = new AsciiSet("),=\n\t\r\b\f ");
+	private static final AsciiSet maybeNeedsQuotesFirstChar = new AsciiSet("),=\n\t\r\b\f tfn+-.#0123456789");
+
+	/**
+	 * Returns <jk>true</jk> if the specified string needs to be quoted per UON notation.
+	 * <p>
+	 * For example, strings that start with '(' or '@' or look like boolean or numeric values
+	 * need to be quoted.
+	 *
+	 * @param s The string to test.
+	 * @return <jk>true</jk> if the specified string needs to be quoted per UON notation.
+	 */
+	public static final boolean needsQuotes(String s) {
+		char c0 = s.isEmpty() ? 0 : s.charAt(0);
+		return (
+			s.isEmpty()
+			|| c0 == '@'
+			|| c0 == '('
+			|| needsQuoteChars.contains(s)
+			|| (
+				maybeNeedsQuotesFirstChar.contains(c0)
+				&& (
+					"true".equals(s)
+					|| "false".equals(s)
+					|| "null".equals(s)
+					|| StringUtils.isNumeric(s)
+				)
+			)
+		);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/uon/UonWriter.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonWriter.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonWriter.java
index 96f2405..d897e6d 100644
--- a/juneau-core/src/main/java/org/apache/juneau/uon/UonWriter.java
+++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonWriter.java
@@ -40,9 +40,7 @@ public final class UonWriter extends SerializerWriter {
 	// Characters that need to be preceeded with an escape character.
 	private static final AsciiSet escapedChars = new AsciiSet("~'");
 
-	private static final AsciiSet needsQuoteChars = new AsciiSet("),=\n\t\r\b\f ");
-
-	private static final AsciiSet maybeNeedsQuotesFirstChar = new AsciiSet("),=\n\t\r\b\f tfn+-.#0123456789");
+	private static final AsciiSet noChars = new AsciiSet("");
 
 	private static char[] hexArray = "0123456789ABCDEF".toCharArray();
 
@@ -68,10 +66,11 @@ public final class UonWriter extends SerializerWriter {
 	 *
 	 * @param o The object being serialized.
 	 * @param isTopAttrName If this is a top-level attribute name we're serializing.
+	 * @param plainTextParams This is a top-level name or parameter we're serializing and the parameter format is PLAINTEXT.
 	 * @return This object (for method chaining).
 	 * @throws IOException Should never happen.
 	 */
-	public final UonWriter appendObject(Object o, boolean isTopAttrName) throws IOException {
+	public final UonWriter appendObject(Object o, boolean isTopAttrName, boolean plainTextParams) throws IOException {
 
 		if (o instanceof Boolean)
 			return appendBoolean(o);
@@ -81,26 +80,11 @@ public final class UonWriter extends SerializerWriter {
 			return append("null");
 
 		String s = session.toString(o);
-		char c0 = s.isEmpty() ? 0 : s.charAt(0);
-
-		boolean needsQuotes =
-			s.isEmpty()
-			|| c0 == '@'
-			|| c0 == '('
-			|| needsQuoteChars.contains(s)
-			|| (
-				maybeNeedsQuotesFirstChar.contains(c0)
-				&& (
-					"true".equals(s)
-					|| "false".equals(s)
-					|| "null".equals(s)
-					|| StringUtils.isNumeric(s)
-				)
-			)
-		;
+
+		boolean needsQuotes = (! plainTextParams) && UonUtils.needsQuotes(s);
 
 		AsciiSet unenc = (isTopAttrName ? unencodedCharsAttrName : unencodedChars);
-		AsciiSet esc = escapedChars;
+		AsciiSet esc = plainTextParams ? noChars : escapedChars;
 
 		if (needsQuotes)
 			append('\'');
@@ -193,7 +177,7 @@ public final class UonWriter extends SerializerWriter {
 				}
 			}
 		}
-		return appendObject(s, false);
+		return appendObject(s, false, false);
 	}
 
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java
index 6ecf88d..f20b590 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java
@@ -415,7 +415,7 @@ public class UrlEncodingParser extends UonParser {
 	}
 
 	/**
-	 * Parses a single query parameter value into the specified class type.
+	 * Parses a single query parameter or header value into the specified class type.
 	 *
 	 * @param in The input query string value.
 	 * @param type The object type to create.
@@ -426,48 +426,28 @@ public class UrlEncodingParser extends UonParser {
 	 * @return A new instance of the specified type.
 	 * @throws ParseException
 	 */
-	public <T> T parseParameter(CharSequence in, Type type, Type...args) throws ParseException {
+	public <T> T parsePart(String in, Type type, Type...args) throws ParseException {
 		if (in == null)
 			return null;
-		UonParserSession session = createParameterSession(in);
-		try {
-			UonReader r = session.getReader();
-			return (T)super.parseAnything(session, session.getClassMeta(type, args), r, null, true, null);
-		} catch (ParseException e) {
-			throw e;
-		} catch (Exception e) {
-			throw new ParseException(session, e);
-		} finally {
-			session.close();
-		}
+		return (T)parsePart(in, getBeanContext().getClassMeta(type, args));
 	}
 
 	/**
-	 * Parses a single query parameter value into the specified class type.
+	 * Parses a single query parameter or header value into the specified class type.
 	 *
 	 * @param in The input query string value.
 	 * @param type The class type of the object to create.
 	 * @return A new instance of the specified type.
 	 * @throws ParseException
 	 */
-	public <T> T parseParameter(CharSequence in, Class<T> type) throws ParseException {
+	public <T> T parsePart(String in, Class<T> type) throws ParseException {
 		if (in == null)
 			return null;
-		UonParserSession session = createParameterSession(in);
-		try {
-			UonReader r = session.getReader();
-			return super.parseAnything(session, session.getClassMeta(type), r, null, true, null);
-		} catch (ParseException e) {
-			throw e;
-		} catch (Exception e) {
-			throw new ParseException(session, e);
-		} finally {
-			session.close();
-		}
+		return parsePart(in, getBeanContext().getClassMeta(type));
 	}
 
 	/**
-	 * Same as {@link #parseParameter(CharSequence, Type, Type...)} except the type has already
+	 * Same as {@link #parsePart(String, Type, Type...)} except the type has already
 	 * been converted to a {@link ClassMeta} object.
 	 *
 	 * @param in The input query string value.
@@ -475,9 +455,19 @@ public class UrlEncodingParser extends UonParser {
 	 * @return A new instance of the specified type.
 	 * @throws ParseException
 	 */
-	public <T> T parseParameter(CharSequence in, ClassMeta<T> type) throws ParseException {
+	public <T> T parsePart(String in, ClassMeta<T> type) throws ParseException {
 		if (in == null)
 			return null;
+		if (type.isString() && in.length() > 0) {
+			// Shortcut - If we're returning a string and the value doesn't start with "'" or is "null", then
+			// just return the string since it's a plain value.
+			// This allows us to bypass the creation of a UonParserSession object.
+			char x = StringUtils.firstNonWhitespaceChar(in);
+			if (x != '\'' && x != 'n' && in.indexOf('~') == -1)
+				return (T)in;
+			if (x == 'n' && "null".equals(in))
+				return null;
+		}
 		UonParserSession session = createParameterSession(in);
 		try {
 			UonReader r = session.getReader();

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
index 222ad7c..eb7ef87 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
@@ -246,7 +246,7 @@ public class UrlEncodingSerializer extends UonSerializer {
 			// All other types can't be serialized as key/value pairs, so we create a
 			// mock key/value pair with a "_value" key.
 			out.append("_value=");
-			super.serializeAnything(session, out, o, null, null, null);
+			super.serializeAnything(session, out, o, null, null, null, session.plainTextParams());
 		}
 
 		session.pop();
@@ -277,6 +277,7 @@ public class UrlEncodingSerializer extends UonSerializer {
 	@SuppressWarnings({ "rawtypes", "unchecked" })
 	private SerializerWriter serializeMap(UrlEncodingSerializerSession session, UonWriter out, Map m, ClassMeta<?> type) throws Exception {
 
+		boolean plainTextParams = session.plainTextParams();
 		m = session.sort(m);
 
 		ClassMeta<?> keyType = type.getKeyType(), valueType = type.getValueType();
@@ -293,15 +294,15 @@ public class UrlEncodingSerializer extends UonSerializer {
 				while (i.hasNext()) {
 					if (addAmp)
 						out.cr(depth).append('&');
-					out.appendObject(key, true).append('=');
-					super.serializeAnything(session, out, i.next(), null, (key == null ? null : key.toString()), null);
+					out.appendObject(key, true, plainTextParams).append('=');
+					super.serializeAnything(session, out, i.next(), null, (key == null ? null : key.toString()), null, plainTextParams);
 					addAmp = true;
 				}
 			} else {
 				if (addAmp)
 					out.cr(depth).append('&');
-				out.appendObject(key, true).append('=');
-				super.serializeAnything(session, out, value, valueType, (key == null ? null : key.toString()), null);
+				out.appendObject(key, true, plainTextParams).append('=');
+				super.serializeAnything(session, out, value, valueType, (key == null ? null : key.toString()), null, plainTextParams);
 				addAmp = true;
 			}
 		}
@@ -321,7 +322,7 @@ public class UrlEncodingSerializer extends UonSerializer {
 			if (addAmp)
 				out.cr(depth).append('&');
 			out.append(e.getKey()).append('=');
-			super.serializeAnything(session, out, e.getValue(), valueType, null, null);
+			super.serializeAnything(session, out, e.getValue(), valueType, null, null, session.plainTextParams());
 			addAmp = true;
 		}
 
@@ -331,6 +332,7 @@ public class UrlEncodingSerializer extends UonSerializer {
 	@SuppressWarnings({ "rawtypes" })
 	private SerializerWriter serializeBeanMap(UrlEncodingSerializerSession session, UonWriter out, BeanMap<?> m, String typeName) throws Exception {
 		int depth = session.getIndent();
+		boolean plainTextParams = session.plainTextParams();
 
 		boolean addAmp = false;
 
@@ -355,9 +357,9 @@ public class UrlEncodingSerializer extends UonSerializer {
 					if (addAmp)
 						out.cr(depth).append('&');
 
-					out.appendObject(key, true).append('=');
+					out.appendObject(key, true, plainTextParams).append('=');
 
-					super.serializeAnything(session, out, i.next(), cMeta.getElementType(), key, pMeta);
+					super.serializeAnything(session, out, i.next(), cMeta.getElementType(), key, pMeta, plainTextParams);
 
 					addAmp = true;
 				}
@@ -365,9 +367,9 @@ public class UrlEncodingSerializer extends UonSerializer {
 				if (addAmp)
 					out.cr(depth).append('&');
 
-				out.appendObject(key, true).append('=');
+				out.appendObject(key, true, plainTextParams).append('=');
 
-				super.serializeAnything(session, out, value, cMeta, key, pMeta);
+				super.serializeAnything(session, out, value, cMeta, key, pMeta, plainTextParams);
 
 				addAmp = true;
 			}
@@ -387,18 +389,29 @@ public class UrlEncodingSerializer extends UonSerializer {
 	 * Useful for constructing URL parts.
 	 *
 	 * @param o The object to serialize.
+	 * @param urlEncode URL-encode the string if necessary.
+	 * If <jk>null</jk>, then uses the value of the {@link UonSerializerContext#UON_encodeChars} setting.
+	 * @param plainTextParams Whether we're using plain-text params.
+	 * If <jk>null</jk>, then uses the value from the {@link UrlEncodingSerializerContext#URLENC_paramFormat} setting.
 	 * @return The serialized object.
 	 */
-	public String serializeUrlPart(Object o) {
+	public String serializePart(Object o, Boolean urlEncode, Boolean plainTextParams) {
 		try {
 			// Shortcut for simple types.
 			ClassMeta<?> cm = getBeanContext().getClassMetaForObject(o);
-			if (cm != null)
-				if (cm.isCharSequence() || cm.isNumber() || cm.isBoolean())
+			if (cm != null) {
+				if (cm.isNumber() || cm.isBoolean())
 					return o.toString();
+				if (cm.isCharSequence()) {
+					String s = o.toString();
+					boolean ptt = (plainTextParams != null ? plainTextParams : ctx.plainTextParams);
+					if (ptt || ! UonUtils.needsQuotes(s))
+						return (urlEncode ? StringUtils.urlEncode(s) : s);
+				}
+			}
 
 			StringWriter w = new StringWriter();
-			UonSerializerSession s = createSession(w, null, null, null, null, MediaType.UON);
+			UonSerializerSession s = new UrlEncodingSerializerSession(ctx, urlEncode, null, w, null, null, null, MediaType.UON);
 			super.doSerialize(s, o);
 			return w.toString();
 		} catch (Exception e) {
@@ -413,7 +426,7 @@ public class UrlEncodingSerializer extends UonSerializer {
 
 	@Override /* Serializer */
 	public UrlEncodingSerializerSession createSession(Object output, ObjectMap op, Method javaMethod, Locale locale, TimeZone timeZone, MediaType mediaType) {
-		return new UrlEncodingSerializerSession(ctx, op, output, javaMethod, locale, timeZone, mediaType);
+		return new UrlEncodingSerializerSession(ctx, null, op, output, javaMethod, locale, timeZone, mediaType);
 	}
 
 	@Override /* Serializer */

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java
index fbca471..7f8b00a 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java
@@ -97,6 +97,48 @@ public class UrlEncodingSerializerBuilder extends UonSerializerBuilder {
 		return property(UrlEncodingContext.URLENC_expandedParams, value);
 	}
 
+	/**
+	 * <b>Configuration property:</b>  Format to use for top-level query names and simple parameters.
+	 * <p>
+	 * <ul>
+	 * 	<li><b>Name:</b> <js>"UrlEncodingSerializer.paramFormat"</js>
+	 * 	<li><b>Data type:</b> <code>String</code>
+	 * 	<li><b>Default:</b> <js>"UON"</js>
+	 * 	<li><b>Session-overridable:</b> <jk>true</jk>
+	 * </ul>
+	 * <p>
+	 * Specifies the format to use for URL GET parameter keys and values.
+	 * <p>
+	 * The possible values are:
+	 * <ul>
+	 * 	<li><js>"UON"</js> (default) - Use UON notation for values.
+	 * 		<br>String values such as <js>"(foo='bar')"</js> will end up being quoted and escaped to <js>"'(foo=bar~'baz~')'"</js>.
+	 * 		<br>Similarly, boolean and numeric values will also end up quoted.
+	 * 	<li><js>"PLAINTEXT"</js> (default) - Serialize as plain text.
+	 * 		<br>Strings will never be quoted or escaped.
+	 * 		<br>Note that this can cause errors during parsing if you're using the URL-encoding parser to parse
+	 * 		the results since UON constructs won't be differentiatable.
+	 * 		<br>However, this is not an issue if you're simply creating queries or form posts against 3rd-party interfaces.
+	 * </ul>
+	 *
+	 * @param paramFormat The new value for this property.
+	 * @return This object (for method chaining).
+	 * @see UrlEncodingSerializerContext#URLENC_paramFormat
+	 */
+	public UrlEncodingSerializerBuilder paramFormat(String paramFormat) {
+		return property(UrlEncodingSerializerContext.URLENC_paramFormat, paramFormat);
+	}
+
+	/**
+	 * Shortcut for calling <code>paramFormat(<js>"PLAINTEXT"</js>)</code>.
+	 *
+	 * @return This object (for method chaining).
+	 * @see UrlEncodingSerializerContext#URLENC_paramFormat
+	 */
+	public UrlEncodingSerializerBuilder plainTextParams() {
+		return paramFormat("PLAINTEXT");
+	}
+
 	@Override /* UonSerializerBuilder */
 	public UrlEncodingSerializerBuilder encodeChars(boolean value) {
 		super.encodeChars(value);

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerContext.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerContext.java
index 7c546ec..1894b0a 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerContext.java
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerContext.java
@@ -25,8 +25,36 @@ import org.apache.juneau.uon.*;
  */
 public class UrlEncodingSerializerContext extends UonSerializerContext {
 
+	/**
+	 * <b>Configuration property:</b>  Format to use for top-level query names and simple parameters.
+	 * <p>
+	 * <ul>
+	 * 	<li><b>Name:</b> <js>"UrlEncodingSerializer.paramFormat"</js>
+	 * 	<li><b>Data type:</b> <code>String</code>
+	 * 	<li><b>Default:</b> <js>"UON"</js>
+	 * 	<li><b>Session-overridable:</b> <jk>true</jk>
+	 * </ul>
+	 * <p>
+	 * Specifies the format to use for URL GET parameter keys and values.
+	 * <p>
+	 * The possible values are:
+	 * <ul>
+	 * 	<li><js>"UON"</js> (default) - Use UON notation for values.
+	 * 		<br>String values such as <js>"(foo='bar')"</js> will end up being quoted and escaped to <js>"'(foo=bar~'baz~')'"</js>.
+	 * 		<br>Similarly, boolean and numeric values will also end up quoted.
+	 * 	<li><js>"PLAINTEXT"</js> (default) - Serialize as plain text.
+	 * 		<br>Strings will never be quoted or escaped.
+	 * 		<br>Note that this can cause errors during parsing if you're using the URL-encoding parser to parse
+	 * 		the results since UON constructs won't be differentiatable.
+	 * 		<br>However, this is not an issue if you're simply creating queries or form posts against 3rd-party interfaces.
+	 * </ul>
+	 */
+	public static final String URLENC_paramFormat = "UrlEncodingSerializer.paramFormat";
+
+
 	final boolean
-		expandedParams;
+		expandedParams,
+		plainTextParams;
 
 	/**
 	 * Constructor.
@@ -38,6 +66,7 @@ public class UrlEncodingSerializerContext extends UonSerializerContext {
 	public UrlEncodingSerializerContext(PropertyStore ps) {
 		super(ps);
 		this.expandedParams = ps.getProperty(UrlEncodingContext.URLENC_expandedParams, boolean.class, false);
+		this.plainTextParams = ps.getProperty(UrlEncodingSerializerContext.URLENC_paramFormat, String.class, "UON").equals("PLAINTEXT");
 	}
 
 	@Override /* Context */
@@ -45,6 +74,7 @@ public class UrlEncodingSerializerContext extends UonSerializerContext {
 		return super.asMap()
 			.append("UrlEncodingSerializerContext", new ObjectMap()
 				.append("expandedParams", expandedParams)
+				.append("plainTextParams", plainTextParams)
 			);
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java
index 30b5b5c..3f3c47e 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java
@@ -26,13 +26,14 @@ import org.apache.juneau.uon.*;
  */
 public class UrlEncodingSerializerSession extends UonSerializerSession {
 
-	private final boolean expandedParams;
+	private final boolean expandedParams, plainTextParams;
 
 	/**
 	 * Create a new session using properties specified in the context.
 	 *
 	 * @param ctx The context creating this session object.
 	 * The context contains all the configuration settings for this object.
+	 * @param encode Overrides the {@link UonSerializerContext#UON_encodeChars} setting.
 	 * @param output The output object.  See {@link JsonSerializerSession#getWriter()} for valid class types.
 	 * @param op The override properties.
 	 * These override any context properties defined in the context.
@@ -43,12 +44,14 @@ public class UrlEncodingSerializerSession extends UonSerializerSession {
 	 * If <jk>null</jk>, then the timezone defined on the context is used.
 	 * @param mediaType The session media type (e.g. <js>"application/json"</js>).
 	 */
-	public UrlEncodingSerializerSession(UrlEncodingSerializerContext ctx, ObjectMap op, Object output, Method javaMethod, Locale locale, TimeZone timeZone, MediaType mediaType) {
-		super(ctx, op, output, javaMethod, locale, timeZone, mediaType);
+	public UrlEncodingSerializerSession(UrlEncodingSerializerContext ctx, Boolean encode, ObjectMap op, Object output, Method javaMethod, Locale locale, TimeZone timeZone, MediaType mediaType) {
+		super(ctx, encode, op, output, javaMethod, locale, timeZone, mediaType);
 		if (op == null || op.isEmpty()) {
 			expandedParams = ctx.expandedParams;
+			plainTextParams = ctx.plainTextParams;
 		} else {
 			expandedParams = op.getBoolean(UrlEncodingContext.URLENC_expandedParams, false);
+			plainTextParams = op.getString(UrlEncodingSerializerContext.URLENC_paramFormat, "UON").equals("PLAINTEXT");
 		}
 	}
 
@@ -85,4 +88,12 @@ public class UrlEncodingSerializerSession extends UonSerializerSession {
 		}
 		return false;
 	}
+
+	/**
+	 * Returns <jk>true</jk> if the {@link UrlEncodingSerializerContext#URLENC_paramFormat} is <js>"PLAINTEXT"</js>.
+	 * @return <jk>true</jk> if the {@link UrlEncodingSerializerContext#URLENC_paramFormat} is <js>"PLAINTEXT"</js>.
+	 */
+	protected boolean plainTextParams() {
+		return plainTextParams;
+	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/utils/AList.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/utils/AList.java b/juneau-core/src/main/java/org/apache/juneau/utils/AList.java
index f9b7afa..7d5dc64 100644
--- a/juneau-core/src/main/java/org/apache/juneau/utils/AList.java
+++ b/juneau-core/src/main/java/org/apache/juneau/utils/AList.java
@@ -38,4 +38,15 @@ public final class AList<T> extends LinkedList<T> {
 		add(t);
 		return this;
 	}
+
+	/**
+	 * Adds multiple entries to this list.
+	 *
+	 * @param t The entries to add to this list.
+	 * @return This object (for method chaining).
+	 */
+	public AList<T> appendAll(T...t) {
+		addAll(Arrays.asList(t));
+		return this;
+	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/java/org/apache/juneau/utils/ASet.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/utils/ASet.java b/juneau-core/src/main/java/org/apache/juneau/utils/ASet.java
index a743691..86dc8ca 100644
--- a/juneau-core/src/main/java/org/apache/juneau/utils/ASet.java
+++ b/juneau-core/src/main/java/org/apache/juneau/utils/ASet.java
@@ -38,4 +38,15 @@ public final class ASet<T> extends LinkedHashSet<T> {
 		add(t);
 		return this;
 	}
+
+	/**
+	 * Adds multiple entries to this set.
+	 *
+	 * @param t The entries to add to this set.
+	 * @return This object (for method chaining).
+	 */
+	public ASet<T> appendAll(T...t) {
+		addAll(Arrays.asList(t));
+		return this;
+	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-core/src/main/javadoc/overview.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/javadoc/overview.html b/juneau-core/src/main/javadoc/overview.html
index f59f283..6f8bc74 100644
--- a/juneau-core/src/main/javadoc/overview.html
+++ b/juneau-core/src/main/javadoc/overview.html
@@ -99,6 +99,9 @@
 	<li><p><a class='doclink' href='#Server'>Juneau Server (org.apache.juneau.rest)</a></p>
 	<li><p><a class='doclink' href='#Client'>Juneau Client (org.apache.juneau.rest.client)</a></p>
 	<li><p><a class='doclink' href='#Remoteable'>Remoteable services (org.apache.juneau.rest.remoteable)</a></p>
+	<ol>
+	<li><p><a class='doclink' href='#Remoteable.3rdParty'>Interface proxies against 3rd-party REST interfaces</a></p>
+	</ol>
 	<li><p><a class='doclink' href='#Microservices'>Juneau Microservices (org.apache.juneau.microservice)</a></p>
 	<li><p><a class='doclink' href='#Samples'>Samples</a></p>
 	<ol>
@@ -2247,14 +2250,18 @@
 	<p>
 		Juneau provides the capability of calling methods on POJOs on a server through client-side proxy interfaces.
 		It offers a number of advantages over other similar remote proxy interfaces, such as being much simpler to 
-			use and allowing much more flexibility.
+			define and use, and allowing much more flexibility in the types of objects serialized.
 	</p>
 	<p>
 		The remote proxy interface API allows you to invoke server-side POJO methods on the client side using REST as the communications protocol:
 	</p>
 	<p class='bcode'>
+	
+	<jc>// Create a client with basic JSON support.</jc>
+	RestClient client = <jk>new</jk> RestClientBuilder().rootUrl(<js>"http://localhost/remoteable"</js>).build();
+	
  	<jc>// Get an interface proxy.</jc>
- 	IAddressBook ab = restClient.getRemoteableProxy(IAddressBook.<jk>class</jk>);
+ 	IAddressBook ab = client.getRemoteableProxy(IAddressBook.<jk>class</jk>);
 	
 	<jc>// Invoke a method on the server side and get the returned result.</jc>
 	Person p = ab.createPerson(
@@ -2266,9 +2273,53 @@
 	);
 	</p>
 	<p>
+		Under the covers, this method call gets converted to a REST POST.
+	</p>
+	<p class='bcode'>
+	HTTP POST http://localhost/remoteable/org.apache.juneau.examples.rest.IAddressBook/createPerson
+	Accept: application/json
+	Content-Type: application/json
+	
+	[
+		{
+			"name":"John Smith",
+			"birthDate":"Aug 1, 1999",
+			"addresses":[
+				{
+					"street":"My street",
+					"city":"My city",
+					"state":"My state",
+					"zip":12345,
+					"isCurrent":true
+				}
+			]
+		}
+	]
+	</p>
+	<p>
+		Note that the body of the request is an array.  This array contains the serialized arguments of the method.
+		The object returned by the method is then serialized as the body of the response.
+	</p>
+	<p>
+		To define a remoteable interface, simply add the {@link org.apache.juneau.remoteable.Remoteable @Remoteable} annotation
+		to your interface class.  
+	</p>
+	<p class='bcode'>
+	<ja>@Remoteable</ja>
+	<jk>public interface</jk> IAddressBook {...}
+	</p>
+	<p>
+		This annotation tells the framework that all methods defined on this interface can be executed remotely.
+		It can be applied to super-interfaces, super-classes, etc..., and exposes the methods at whatever level it is defined.  
+	</p>
+	<p>
+		The {@link org.apache.juneau.remoteable.RemoteMethod @RemoteMethod} annotation can also be used on individual methods
+		to tailor which methods are exposed or their paths.
+	</p>
+	<p>
 		There are two ways to expose remoteable proxies on the server side:
 	</p>
-	<ol>
+	<ol class='spaced-list'>
 		<li>Extending from <code>RemoteableServlet</code>.
 		<li>Using a <code><ja>@RestMethod</ja>(name=<js>"PROXY"</js>)</code> annotation on a Java method.
 	</ol>
@@ -2310,24 +2361,21 @@
 	}
 	</p>
 	<p>
-		In either case, the proxy communications layer is pure REST.   
-		Parameters passed in on the client side are serialized as an HTTP POST, parsed on the
-		server side, and then passed to the invocation method.  The returned POJO is then marshalled back as an HTTP response.
-		Therefore, in cases where the interface classes are not available on the client side,
+		In either case, the proxy communications layer is pure REST.
+		<br>Therefore, in cases where the interface classes are not available on the client side,
 			the same method calls can be made through pure REST calls.  
-		This can also aid significantly in debugging, since calls to the remoteable service
+		<br>This can also aid significantly in debugging, since calls to the remoteable service
 			can be made directly from a browser with no coding involved.
 	</p>
 	<p>
 		The parameters and return types of the Java methods can be any of the supported serializable and parsable types in <a class='doclink' href='#Core.PojoCategories'>POJO Categories</a>.
-		This ends up being WAY more flexible than other proxy interfaces since Juneau can handle so may POJO types out-of-the-box.
-		Most of the time you don't even need to modify your existing Java implementation code.
+		<br>This ends up being WAY more flexible than other proxy interfaces since Juneau can handle so may POJO types out-of-the-box.
+		<br>Most of the time you don't even need to modify your existing Java implementation code.
 	</p>
 	<p>
-		The RemoteableServlet class itself shows how sophisticated REST interfaces can be built on the Juneau RestServlet
-		API using very little code.  The RemoteableServlet class itself consists of only 53 lines of code, yet is
-		a sophisticated discoverable and self-documenting REST interface.  And since the remote proxy API is built on top 
-		of REST, it can be debugged using just a browser.
+		The RemoteableServlet class itself shows how sophisticated REST interfaces can be built on the Juneau RestServlet API using very little code.  
+		<br>The RemoteableServlet class itself consists of only 53 lines of code, yet is a sophisticated discoverable and self-documenting REST interface.  
+		<br>And since the remote proxy API is built on top of REST, it can be debugged using just a browser.
 	</p>
 	<p>
 		The requirements for a method to be callable through a remoteable service are:
@@ -2343,6 +2391,90 @@
 	<ul class='javahierarchy'>
 		<li class='p'><a class='doclink' href='org/apache/juneau/server/remoteable/package-summary.html#TOC'>org.apache.juneau.rest.remoteable</a> - Juneau Remoteable API Javadocs.
 	</ul>
+	
+	<!-- ======================================================================================================== -->
+	<a id="Remoteable.3rdParty"></a>
+	<h3 class='topic' onclick='toggle(this)'>6.1 - Interface proxies against 3rd-party REST interfaces</h3>
+	<div class='topic'>
+		<p>
+			Remoteable proxies can also be used to define interface proxies against 3rd-party REST interfaces.
+			This is an extremely powerful feature that allows you to quickly define easy-to-use interfaces against virtually any REST interface.
+		</p>
+		<p>
+			Similar in concept to remoteable services defined above, but in this case we simply define our interface with
+			special annotations that tell us how to convert input and output to HTTP headers, query paramters, form post parameters, or request/response bodies.
+		</p>
+		<p class='bcode'>	
+	<ja>@Remoteable</ja>
+	<jk>public interface</jk> MyProxyInterface {
+		
+		<ja>@RemoteMethod</ja>(httpMethod=<js>"POST"</js>, path=<js>"/method"</js>)
+		String doMethod(<ja>@Header</ja>(<js>"E-Tag"</js>) UUID etag, <ja>@Query</ja>("debug") <jk>boolean</jk> debug, <ja>@Body</ja> MyPojo pojo);
+	}
+	
+	RestClient client = <jk>new</jk> RestClientBuilder().build();
+	MyProxyInterface p = client.getRemoteableProxy(MyProxyInterface.<jk>class</jk>, <js>"http://hostname/some/rest/interface"</js>);
+	String response = p.doMethod(UUID.<jsm>generate</jsm>(), <jk>true</jk>, <jk>new</jk> MyPojo());
+		</p>
+		<p>
+			The Java method arguements can be annotated with any of the following:
+		</p>
+		<ul class='spaced-list'>
+			<li>{@link org.apache.juneau.remoteable.Query @Query} - A URL query parameter.
+				<br>The argument can be any of the following types:
+				<ul>
+					<li>Any serializable POJO - Converted to text using {@link org.apache.juneau.urlencoding.UrlEncodingSerializer#serializePart(Object, Boolean, Boolean)}.
+					<li><code>Map&lt;String,Object&gt;</code> - Individual name-value pairs.
+						<br>Values are converted to text using {@link org.apache.juneau.urlencoding.UrlEncodingSerializer#serializePart(Object, Boolean, Boolean)}.
+					<li><code>String</code> - Treated as a query string.
+				</ul>
+			<li>{@link org.apache.juneau.remoteable.QueryIfNE @QueryIfNE} - Same as <ja>@Query</ja> except skips the value if it's null/empty.
+			<li>{@link org.apache.juneau.remoteable.FormData @FormData} - A form-data parameter.
+				<br>Note that this is only available if the HTTP method is <code>POST</code>.
+				<br>The argument can be any of the following types:
+				<ul>
+					<li>Any serializable POJO - Converted to text using {@link org.apache.juneau.urlencoding.UrlEncodingSerializer#serializePart(Object, Boolean, Boolean)}.
+					<li>{@link org.apache.juneau.rest.client.NameValuePairs} - Individual name-value pairs.
+					<li><code>Map&lt;String,Object&gt;</code> - Individual name-value pairs.
+						<br>Values are converted to text using {@link org.apache.juneau.urlencoding.UrlEncodingSerializer#serializePart(Object, Boolean, Boolean)}.
+				</ul>
+			<li>{@link org.apache.juneau.remoteable.FormDataIfNE @FormDataIfNE} - Same as <ja>@FormData</ja> except skips the value if it's null/empty.
+			<li>{@link org.apache.juneau.remoteable.Header @Header} - A request header.
+				<br>The argument can be any of the following types:
+				<ul>
+					<li>Any serializable POJO - Converted to text using {@link org.apache.juneau.urlencoding.UrlEncodingSerializer#serializePart(Object, Boolean, Boolean)}.
+					<li><code>Map&lt;String,Object&gt;</code> - Individual name-value pairs.
+						<br>Values are converted to text using {@link org.apache.juneau.urlencoding.UrlEncodingSerializer#serializePart(Object, Boolean, Boolean)}.
+				</ul>
+			<li>{@link org.apache.juneau.remoteable.HeaderIfNE @HeaderIfNE} - Same as <ja>@Header</ja> except skips the value if it's null/empty.
+			<li>{@link org.apache.juneau.remoteable.Body @Body} - The HTTP request body.
+				<br>The argument can be any of the following types:
+				<ul>
+					<li>Any serializable POJO - Converted to text/bytes using the {@link org.apache.juneau.serializer.Serializer} registered with the <code>RestClient</code>.
+					<li>{@link java.io.Reader} - Raw contents of reader will be serialized to remote resource.
+					<li>{@link java.io.InputStream} - Raw contents of input stream will be serialized to remote resource.
+					<li>{@link org.apache.http.HttpEntity} - Bypass Juneau serialization and pass HttpEntity directly to HttpClient.
+					<li>{@link org.apache.juneau.rest.client.NameValuePairs} - Converted to a URL-encoded FORM post.
+				</ul>
+		</ul>
+		<p>
+			The return type of the Java method can be any of the following:
+		</p>
+		<ul class='spaced-list'>
+			<li><jk>void</jk> - Don't parse any response.  
+				<br>Note that the method will still throw a runtime exception if an error HTTP status is returned.
+			<li>Any parsable POJO - The body of the response will be converted to the POJO using the parser defined on the <code>RestClient</code>.
+			<li><code>HttpResponse</code> - Returns the raw <code>HttpResponse</code> returned by the inner <code>HttpClient</code>.
+			<li>{@link java.io.Reader} - Returns access to the raw reader of the response.
+				<br>Note that if you don't want your response parsed as a POJO, you'll want to get the response reader directly.
+			<li>{@link java.io.InputStream} - Returns access to the raw input stream of the response.
+		</ul>
+
+		<h6 class='topic'>Additional Information</h6>
+		<ul class='javahierarchy'>
+			<li class='p'><a class='doclink' href='org/apache/juneau/remoteable/package-summary.html#TOC'>org.apache.juneau.remoteable</a> - Juneau Remoteable API Javadocs.
+		</ul>
+	</div>
 </div>
 	
 <!-- ======================================================================================================== -->
@@ -4345,8 +4477,6 @@
 			As good practice, you'll want to use interfaces to prevent all public methods from being exposed.
 		</p>
 		<p>
-			The {@link org.apache.juneau.rest.client.RestClientBuilder#remoteableServletUri(String)} method is used to specify the location
-				of the remoteable services servlet running on the server.
 			Proxy interfaces are then retrieved using the {@link org.apache.juneau.rest.client.RestClient#getRemoteableProxy(Class)} method.
 		</p>
 		<p>
@@ -4355,7 +4485,7 @@
 		<p class='bcode'>
 	<jc>// Create a RestClient using JSON for serialization, and point to the server-side remoteable servlet.</jc>
 	RestClient client = <jk>new</jk> RestClientBuilder()
-		.remoteableServletUri(<js>"http://localhost:10000/remoteable"</js>)
+		.rootUrl(<js>"http://localhost:10000/remoteable"</js>)
 		.build();
 	
 	<jc>// Create a proxy interface.</jc>
@@ -4373,8 +4503,8 @@
 			<li class='a'>{@link org.apache.juneau.rest.remoteable.RemoteableServlet}
 			<li class='c'>{@link org.apache.juneau.rest.client.RestClient}
 			<ul>
-				<li class='m'>{@link org.apache.juneau.rest.client.RestClientBuilder#remoteableServletUri(String) remoteableServletUri(String)}
 				<li class='m'>{@link org.apache.juneau.rest.client.RestClient#getRemoteableProxy(Class) getRemoteableProxy(Class)}
+				<li class='m'>{@link org.apache.juneau.rest.client.RestClient#getRemoteableProxy(Class,Object) getRemoteableProxy(Class,Object)}
 			</ul>
 		</ul>
 	</div>	
@@ -5757,6 +5887,17 @@
 					<li>{@link org.apache.juneau.dto.html5.HtmlElementMixed#getChild(int...)}
 				</ul>
 			<li>New common serializer setting: {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_abridged}.
+			<li>Support for defining interface proxies against 3rd-party REST interfaces.
+				<br>New package {@link org.apache.juneau.remoteable} for all remoteable proxy interface annotations.
+				<br><ja>@Remoteable</ja> annotation has been moved to this package.
+			<li>Updated doc: <a class='doclink' href='#Remoteable'>6 - Remoteable Services</a>
+			<li>New doc: <a class='doclink' href='#Remoteable.3rdParty'>6.1 -  Interface proxies against 3rd-party REST interfaces</a>
+			<li>New URL-encoding serializer setting: {@link org.apache.juneau.urlencoding.UrlEncodingSerializerContext#URLENC_paramFormat}
+			<li>New methods on {@link org.apache.juneau.urlencoding.UrlEncodingSerializerBuilder}:
+			<ul>
+				<li>{@link org.apache.juneau.urlencoding.UrlEncodingSerializerBuilder#paramFormat(String) paramFormat(String)}	
+				<li>{@link org.apache.juneau.urlencoding.UrlEncodingSerializerBuilder#plainTextParams() plainTextParams()}	
+			</ul> 		
 		</ul>
 		
 		<h6 class='topic'>org.apache.juneau.rest</h6>
@@ -5858,7 +5999,6 @@
 	IAddressBook ab = client.getRemoteableProxy(IAddressBook.<jk>class</jk>, <js>"/addressBook/myproxy"</js>);
 			</p>
 				See {@link org.apache.juneau.rest.annotation.RestMethod#name()} for more information.
-			<li>Updated doc: <a class='doclink' href='#Remoteable'>6 - Remoteable Services</a>
 			<li>{@link org.apache.juneau.rest.RestRequest#toString()} can be called at any time to view the headers and content of the request
 				without affecting functionality.  Very useful for debugging.
 			<li>You can now use numeric values in path annotations.  
@@ -5876,47 +6016,76 @@
 		<h6 class='topic'>org.apache.juneau.rest.client</h6>
 		<ul class='spaced-list'>
 			<li>Revamped the client API to use builders.
-			<li>New methods added to {@link org.apache.juneau.rest.client.RestCall}:
-			<ul>
-				<li>{@link org.apache.juneau.rest.client.RestCall#serializer(Serializer)} - Override the serializer defined on the client for a single call.
-				<li>{@link org.apache.juneau.rest.client.RestCall#parser(Parser)} - Override the parser defined on the client for a single call.
-			</ul>
-			<li>New methods added to {@link org.apache.juneau.rest.client.RestClient}:
+			<li>New doc: <a class='doclink' href='org/apache/juneau/rest/client/package-summary.html#Debugging'>1.5 - Debugging</a>
+			<li>The <code>RestClient</code> class <code>doX(Object url)</code> methods now handle HttpClient <code>URIBuilder</code> instances.
+			<li>New methods added/updated to {@link org.apache.juneau.rest.client.RestClient}:
 			<ul>
-				<li>{@link org.apache.juneau.rest.client.RestClient#getRemoteableProxy(Class,Object)} - For interface proxies defined using <code><ja>@RestMethod</ja>(name=<js>"PROXY"</js>)</code>.
-				<li>{@link org.apache.juneau.rest.client.RestClient#getRemoteableProxy(Class,Object,Serializer,Parser)} - Same as above, but overrides the serializer and parser defined on the client.
+				<li>{@link org.apache.juneau.rest.client.RestClient#getRemoteableProxy(Class,Object) getRemoteableProxy(Class,Object)} - For interface proxies defined using <code><ja>@RestMethod</ja>(name=<js>"PROXY"</js>)</code>.
+				<li>{@link org.apache.juneau.rest.client.RestClient#getRemoteableProxy(Class,Object,Serializer,Parser) getRemoteableProxy(Class,Object,Serializer,Parser)} - Same as above, but overrides the serializer and parser defined on the client.
+				<li>{@link org.apache.juneau.rest.client.RestClient#doPost(Object) doPost(Object)} 
+				<li>{@link org.apache.juneau.rest.client.RestClient#doCall(HttpMethod,Object,Object) doCall(HttpMethod,Object,Object)} - Can now pass in instances of {@link org.apache.juneau.rest.client.NameValuePairs} for easy form posts.
+					<br>This extends to all methods that take in the input.
 			</ul>
+			<li>New methods on {@link org.apache.juneau.rest.client.RestCall}:
+				<ul>
+					<li>{@link org.apache.juneau.rest.client.RestCall#uri(Object) uri(Object)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#query(String,Object,boolean) query(String,Object,boolean)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#query(String,Object) query(String,Object)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#queryIfNE(String,Object) queryIfNE(String,Object)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#query(Map) query(Map)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#queryIfNE(Map) queryIfNE(Map)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#query(String) query(String)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#formData(String,Object,boolean) formData(String,Object,boolean)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#formData(String,Object) formData(String,Object)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#formDataIfNE(String,Object) formDataIfNE(String,Object)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#formData(Map) formData(Map)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#formDataIfNE(Map) formDataIfNE(Map)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#header(String,Object,boolean) header(String,Object,boolean)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#header(String,Object) header(String,Object)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#headerIfNE(String,Object) headerIfNE(String,Object)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#headers(Map) headers(Map)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#headersIfNE(Map) headersIfNE(Map)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#host(String) host(String)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#port(int) port(int)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#userInfo(String,String) userInfo(String,String)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#userInfo(String) userInfo(String)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#scheme(String) scheme(String)}
+				</ul>
 			<li>New methods added to {@link org.apache.juneau.rest.client.RestClientBuilder}:
-			<ul>
-				<li>{@link org.apache.juneau.rest.client.RestClientBuilder#noTrace()} - Adds a <code>No-Trace: true</code> header on all requests to prevent
-					the servlet from logging errors.
-					Useful for testing scenarios when you don't want the console to end up showing errors done on purpose.
-				<li>{@link org.apache.juneau.rest.client.RestClientBuilder#debug(boolean)} now adds a <code>Debug: true</code> header on all requests.
-			</ul>
-			<li>New doc: <a class='doclink' href='org/apache/juneau/rest/client/package-summary.html#Debugging'>1.5 - Debugging</a>
-			<li>The <code>RestClient</code> class <code>doX(Object url)</code> methods now handle HttpClient <code>URIBuilder</code> instances.
-			<li>New methods added to {@link org.apache.juneau.rest.client.RestCall} that allow you to manipulate URLs after you've already created the <code>RestCall</code> object:
 				<ul>
-					<li>{@link org.apache.juneau.rest.client.RestCall#uri(Object)}
-					<li>{@link org.apache.juneau.rest.client.RestCall#param(String,Object)}
-					<li>{@link org.apache.juneau.rest.client.RestCall#paramIfNE(String,Object)}
-					<li>{@link org.apache.juneau.rest.client.RestCall#paramIfNN(String,Object)}
-					<li>{@link org.apache.juneau.rest.client.RestCall#params(Map)}
-					<li>{@link org.apache.juneau.rest.client.RestCall#query(String)}
-					<li>{@link org.apache.juneau.rest.client.RestCall#host(String)}
-					<li>{@link org.apache.juneau.rest.client.RestCall#port(int)}
-					<li>{@link org.apache.juneau.rest.client.RestCall#userInfo(String,String)}
-					<li>{@link org.apache.juneau.rest.client.RestCall#userInfo(String)}
-					<li>{@link org.apache.juneau.rest.client.RestCall#scheme(String)}
+					<li>{@link org.apache.juneau.rest.client.RestClientBuilder#executorService(ExecutorService,boolean) executorService(ExecutorService,boolean)}
+					<li>{@link org.apache.juneau.rest.client.RestClientBuilder#paramFormat(String) paramFormat(ExecutorService,boolean)}
+					<li>{@link org.apache.juneau.rest.client.RestClientBuilder#plainTextParams() plainTextParams()}
+					<li>{@link org.apache.juneau.rest.client.RestClientBuilder#noTrace() noTrace()} - Adds a <code>No-Trace: true</code> header on all requests to prevent
+						the servlet from logging errors.
+						<br>Useful for testing scenarios when you don't want the console to end up showing errors done on purpose.
+					<li>{@link org.apache.juneau.rest.client.RestClientBuilder#debug(boolean) debug(boolean)} now adds a <code>Debug: true</code> header on all requests.
 				</ul>
-			<li>New methods added to allow for asynchronous HTTP calls:
+			<li>New methods added/updated to {@link org.apache.juneau.rest.client.RestCall}:
+				<ul>
+					<li>{@link org.apache.juneau.rest.client.RestCall#runFuture() runFuture()}
+					<li>{@link org.apache.juneau.rest.client.RestCall#getResponseFuture(Class) getResponseFuture(Class)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#getResponseFuture(Type,Type...) getResponseFuture(Type,Type...)}
+					<li>{@link org.apache.juneau.rest.client.RestCall#getResponseAsStringFuture() getResponseAsStringFuture()}
+					<li>{@link org.apache.juneau.rest.client.RestCall#serializer(Serializer) serializer(Serializer)} - Override the serializer defined on the client for a single call.
+					<li>{@link org.apache.juneau.rest.client.RestCall#parser(Parser) parser(Parser)} - Override the parser defined on the client for a single call.
+					<li>{@link org.apache.juneau.rest.client.RestCall#input(Object) input(Object)} - Now accepts instances of {@link org.apache.juneau.rest.client.NameValuePairs}.
+					<li>{@link org.apache.juneau.rest.client.RestCall#getResponse(Class) getResponse(Class)} - Can now pass in any of the following:
+						<ul>
+							<li>{@link org.apache.http.HttpResponse} - Returns the raw <code>HttpResponse</code> returned by the inner <code>HttpClient</code>.
+							<li>{@link java.io.Reader} - Returns access to the raw reader of the response.
+							<li>{@link java.io.InputStream} - Returns access to the raw input stream of the response.
+						</ul>
+				</ul>
+			<li>New methods added to {@link org.apache.juneau.rest.client.NameValuePairs}:
 				<ul>
-					<li>{@link org.apache.juneau.rest.client.RestClientBuilder#executorService(ExecutorService,boolean)}
-					<li>{@link org.apache.juneau.rest.client.RestCall#runFuture()}
-					<li>{@link org.apache.juneau.rest.client.RestCall#getResponseFuture(Class)}
-					<li>{@link org.apache.juneau.rest.client.RestCall#getResponseFuture(Type,Type...)}
-					<li>{@link org.apache.juneau.rest.client.RestCall#getResponseAsStringFuture()}
+					<li>{@link org.apache.juneau.rest.client.NameValuePairs#append(String,Object) append(String,Object)}
+					<li>{@link org.apache.juneau.rest.client.NameValuePairs#append(String,Object,UrlEncodingSerializer) append(String,Object,UrlEncodingSerializer)}
 				</ul>
+			<li>{@link org.apache.juneau.rest.client.RetryOn} is now an abstract class with an additional method:
+				<ul>
+					<li>{@link org.apache.juneau.rest.client.RetryOn#onResponse(HttpResponse) onResponse(HttpResponse)}
+				</ul>			
 		</ul>
 		
 		<h6 class='topic'>org.apache.juneau.microservice</h6>
@@ -5932,7 +6101,6 @@
 		</ul>		
 	</div>
 	
-	
 	<!-- ======================================================================================================== -->
 	<a id="6.1.0"></a>
 	<h3 class='topic' onclick='toggle(this)'>6.1.0 (Feb 25, 2017)</h3>
@@ -6141,26 +6309,27 @@
 			<li>New {@link org.apache.juneau.rest.RestRequest#getTimeZone()} method.
 			<li>Standardized the following methods in {@link org.apache.juneau.rest.RestRequest} to remove dependency on <code>ClassMeta</code>
 				objects and eliminate the need for casts:
-			<ul>
-				<li>{@link org.apache.juneau.rest.RestRequest#getHeader(String,Class)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getHeader(String,Object,Class)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getHeader(String,Type,Type...)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getQueryParameter(String,Class)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getQueryParameter(String,Object,Class)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getQueryParameter(String,Type,Type...)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getQueryParameter(String,Object,Type,Type...)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getQueryParameters(String,Class)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getQueryParameters(String,Type,Type...)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getFormDataParameter(String,Class)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getFormDataParameter(String,Object,Class)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getFormDataParameters(String,Class)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getFormDataParameter(String,Type,Type...)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getFormDataParameters(String,Type,Type...)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getPathParameter(String,Class)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getPathParameter(String,Type,Type...)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getBody(Class)}
-				<li>{@link org.apache.juneau.rest.RestRequest#getBody(Type,Type...)}
-			</ul>
+				<ul>
+					<li>{@link org.apache.juneau.rest.RestRequest#getHeader(String,Class) getHeader(String,Class)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getHeader(String,Object,Class) getHeader(String)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getHeader(String,Type,Type...)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getQueryParameter(String,Class)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getQueryParameter(String,Object,Class)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getQueryParameter(String,Type,Type...)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getQueryParameter(String,Object,Type,Type...)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getQueryParameters(String,Class)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getQueryParameters(String,Type,Type...)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getFormDataParameter(String,Class)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getFormDataParameter(String,Object,Class)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getFormDataParameters(String,Class)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getFormDataParameter(String,Type,Type...)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getFormDataParameters(String,Type,Type...)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getPathParameter(String,Class)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getPathParameter(String,Type,Type...)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getBody(Class)}
+					<li>{@link org.apache.juneau.rest.RestRequest#getBody(Type,Type...)}
+				</ul>
+			<li>New methods on {@link org.apache.juneau.rest.client.NameValuePairs}
 			<li>Fixed issue where whitespace was not added to UON/URL-Encoding output when <code>&amp;plainText=true</code> specified.
 		</ul>
 	</div>
@@ -7284,7 +7453,7 @@
 				Adds <js>"* {white-space:nowrap}"</js> to the style header to prevent word wrapping.
 			<li>Fixed bug in {@link org.apache.juneau.uon.UonParser} where passing in a blank value on an array or collection type in a form post would cause a <code>ClassCastException</code>.  
 				New behavior creates an empty array or <code>Collection</code>.
-			<li>Improved implementation of {@link org.apache.juneau.urlencoding.UrlEncodingSerializer#serializeUrlPart(Object)} method.
+			<li>Improved implementation of <del><code>UrlEncodingSerializer.serializeUrlPart(Object)</code></del> method.
 		</ul>
 
 		<h6 class='topic'>Server</h6>		
@@ -7609,7 +7778,7 @@
 			<li>New {@link org.apache.juneau.rest.Redirect} class that simplifies performing redirections in REST methods.
 			<li>New pluggable {@link org.apache.juneau.rest.ResponseHandler} class and {@link org.apache.juneau.rest.annotation.RestResource#responseHandlers()} annotation
 				for defining customer response handlers for special kinds of POJOs.
-			<li>New method {@link org.apache.juneau.urlencoding.UrlEncodingSerializer#serializeUrlPart(Object)} method.
+			<li>New method <del><code>UrlEncodingSerializer.serializeUrlPart(Object)</code></del> method.
 			<li>New method {@link org.apache.juneau.rest.RestRequest#getServletURIBuilder()} for construcing servlet-based URLs more efficiently.
 			<li>New method {@link org.apache.juneau.rest.RestResponse#getNegotiatedOutputStream()} that uses encoders if a match is found, 
 				and {@link org.apache.juneau.rest.RestResponse#getOutputStream()} that just return the underlying output stream without any modifications.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-examples-rest/src/main/java/org/apache/juneau/examples/addressbook/IAddressBook.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/addressbook/IAddressBook.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/addressbook/IAddressBook.java
index 1c7431a..e120a67 100755
--- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/addressbook/IAddressBook.java
+++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/addressbook/IAddressBook.java
@@ -14,10 +14,13 @@ package org.apache.juneau.examples.addressbook;
 
 import java.util.*;
 
+import org.apache.juneau.remoteable.*;
+
 /**
  * Interface used to help illustrate proxy interfaces.
  * See {@link SampleRemoteableServlet}.
  */
+@Remoteable
 public interface IAddressBook {
 	
 	/** Initialize this address book with preset entries */

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java
index 1eca174..cbdce58 100644
--- a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java
+++ b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java
@@ -15,8 +15,9 @@ package org.apache.juneau.examples.rest;
 import static org.apache.juneau.xml.XmlSerializerContext.*;
 import static org.junit.Assert.*;
 
+import java.text.*;
+
 import org.apache.juneau.examples.addressbook.*;
-import org.apache.juneau.json.*;
 import org.apache.juneau.rest.client.*;
 import org.apache.juneau.transforms.*;
 import org.apache.juneau.uon.*;
@@ -26,22 +27,21 @@ import org.junit.*;
 public class SampleRemoteableServicesResourceTest extends RestTestcase {
 
 	static RestClient[] clients;
+	
+	private static String path = SamplesMicroservice.getURI().getPath() + "/addressBook/proxy";
 
 	@BeforeClass
 	public static void beforeClass() throws Exception {
 		clients = new RestClient[] {
 			SamplesMicroservice.client()
 				.pojoSwaps(CalendarSwap.DateMedium.class)
-				.remoteableServletUri("/remoteable")
 				.build(),
 			SamplesMicroservice.client(XmlSerializer.class, XmlParser.class)
 				.pojoSwaps(CalendarSwap.DateMedium.class)
-				.remoteableServletUri("/remoteable")
 				.property(XML_autoDetectNamespaces, true)
 				.build(),
 			SamplesMicroservice.client(UonSerializer.class, UonParser.class)
 				.pojoSwaps(CalendarSwap.DateMedium.class)
-				.remoteableServletUri("/remoteable")
 				.build(),
 		};
 	}
@@ -59,16 +59,19 @@ public class SampleRemoteableServicesResourceTest extends RestTestcase {
 	@Test
 	public void testBasic() throws Exception {
 		for (RestClient client : clients) {
-			IAddressBook ab = client.getRemoteableProxy(IAddressBook.class);
+			IAddressBook ab = client.getRemoteableProxy(IAddressBook.class, path);
 			Person p = ab.createPerson(
 				new CreatePerson("Test Person",
 					AddressBook.toCalendar("Aug 1, 1999"),
 					new CreateAddress("Test street", "Test city", "Test state", 12345, true))
 			);
-			assertEquals(
-				"{_type:'person',id:x,name:'Test Person',birthDate:'Aug 1, 1999',addresses:[{id:x,street:'Test street',city:'Test city',state:'Test state',zip:12345,isCurrent:true}],age:x}",
-				JsonSerializer.DEFAULT_LAX.toString(p).replaceAll("id:\\d+", "id:x").replaceAll("age:\\d+", "age:x"));
+			assertEquals("Test Person", p.name);
+			assertEquals("Aug 1, 1999", DateFormat.getDateInstance(DateFormat.MEDIUM).format(p.birthDate.getTime()));
+			assertEquals("Test street", p.addresses.get(0).street);
+			assertEquals("Test city", p.addresses.get(0).city);
+			assertEquals("Test state", p.addresses.get(0).state);
+			assertEquals(12345, p.addresses.get(0).zip);
+			assertEquals(true, p.addresses.get(0).isCurrent);
 		}
 	}
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-microservice/src/main/java/org/apache/juneau/microservice/package.html
----------------------------------------------------------------------
diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/package.html b/juneau-microservice/src/main/java/org/apache/juneau/microservice/package.html
index dcdf2c5..614e64a 100755
--- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/package.html
+++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/package.html
@@ -670,7 +670,7 @@
 			 			<li><l>$R{trimmedRequestURI}</l> - Value returned by {@link org.apache.juneau.rest.RestRequest#getTrimmedRequestURI()}.
 					</ul>
 					<li><l>$SA{key,mediaType}</l> - Object returned by {@link org.apache.juneau.rest.RestRequest#getAttribute(String)} converted to a string using the serializer registered to handle the specified media type.
-					<li><l>$UE{...}</l> - URL-Encode the specified value by calling {@link org.apache.juneau.rest.RestUtils#encode(String)}.
+					<li><l>$UE{...}</l> - URL-Encode the specified value.
 				</ul>
 				<h6 class='figure'>Example usage:</h6>
 				<p class='bcode'>

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7139635d/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/NameValuePairs.java
----------------------------------------------------------------------
diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/NameValuePairs.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/NameValuePairs.java
index ee97ac1..845f520 100644
--- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/NameValuePairs.java
+++ b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/NameValuePairs.java
@@ -16,17 +16,23 @@ import java.util.*;
 
 import org.apache.http.*;
 import org.apache.http.client.entity.*;
+import org.apache.http.message.*;
+import org.apache.juneau.internal.*;
+import org.apache.juneau.urlencoding.*;
 
 /**
  * Convenience class for constructing instances of <code>List&lt;NameValuePair&gt;</code>
  * 	for the {@link UrlEncodedFormEntity} class.
+ * <p>
+ * Instances of this method can be passed directly to the {@link RestClient#doPost(Object, Object)} method or
+ * {@link RestCall#input(Object)} methods to perform URL-encoded form posts.
  *
  * <h5 class='section'>Example:</h5>
  * <p class='bcode'>
  * 	NameValuePairs params = <jk>new</jk> NameValuePairs()
- * 		.append(<jk>new</jk> BasicNameValuePair(<js>"j_username"</js>, user))
- * 		.append(<jk>new</jk> BasicNameValuePair(<js>"j_password"</js>, pw));
- * 	request.setEntity(<jk>new</jk> UrlEncodedFormEntity(params));
+ * 		.append(<js>"j_username"</js>, user)
+ * 		.append(<js>"j_password"</js>, pw);
+ * 	restClient.doPost(url, params).run();
  * </p>
  */
 public final class NameValuePairs extends LinkedList<NameValuePair> {
@@ -43,4 +49,34 @@ public final class NameValuePairs extends LinkedList<NameValuePair> {
 		super.add(pair);
 		return this;
 	}
+
+	/**
+	 * Appends the specified name/value pair to the end of this list.
+	 * <p>
+	 * The value is simply converted to a string using <code>toString()</code>, or <js>"null"</js> if <jk>null</jk>.
+	 *
+	 * @param name The pair name.
+	 * @param value The pair value.
+	 * @return This object (for method chaining).
+	 */
+	public NameValuePairs append(String name, Object value) {
+		super.add(new BasicNameValuePair(name, StringUtils.toString(value)));
+		return this;
+	}
+
+	/**
+	 * Appends the specified name/value pair to the end of this list.
+	 * <p>
+	 * The value is converted to UON notation using the {@link UrlEncodingSerializer#serializePart(Object, Boolean, Boolean)} method
+	 * of the specified serializer.
+	 *
+	 * @param name The pair name.
+	 * @param value The pair value.
+	 * @param serializer The serializer to use to convert the value to a string.
+	 * @return This object (for method chaining).
+	 */
+	public NameValuePairs append(String name, Object value, UrlEncodingSerializer serializer) {
+		super.add(new SerializedNameValuePair(name, value, serializer));
+		return this;
+	}
 }