juneau-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamesbog...@apache.org
Subject [34/44] incubator-juneau git commit: Rename CT_* testcases.
Date Tue, 09 Aug 2016 17:15:55 GMT
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/df0f8689/org.apache.juneau.server.test/src/test/java/org/apache/juneau/server/TestTransformsTest.java
----------------------------------------------------------------------
diff --git a/org.apache.juneau.server.test/src/test/java/org/apache/juneau/server/TestTransformsTest.java b/org.apache.juneau.server.test/src/test/java/org/apache/juneau/server/TestTransformsTest.java
new file mode 100755
index 0000000..85be1e2
--- /dev/null
+++ b/org.apache.juneau.server.test/src/test/java/org/apache/juneau/server/TestTransformsTest.java
@@ -0,0 +1,68 @@
+/***************************************************************************************************************************
+ * 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.server;
+
+import static org.junit.Assert.*;
+
+import org.apache.juneau.client.*;
+import org.apache.juneau.json.*;
+import org.junit.*;
+
+public class TestTransformsTest {
+
+	private static String URL = "/testTransforms";
+
+	//====================================================================================================
+	// test1 - Test class transform overrides parent class transform
+	// Should return "A2-1".
+	//====================================================================================================
+	@Test
+	public void testClassTransformOverridesParentClassTransform() throws Exception {
+		RestClient client = new TestRestClient(JsonSerializer.DEFAULT, JsonParser.DEFAULT);
+		String r;
+		String url = URL + "/testClassTransformOverridesParentClassTransform";
+
+		r = client.doGet(url).getResponse(String.class);
+		assertEquals("A2-0", r);
+
+		r = client.doPut(url, "A2-1").getResponse(String.class);
+		assertEquals("A2-1", r);
+
+		r = client.doPut(url + "/A2-2", "").getResponse(String.class);
+		assertEquals("A2-2", r);
+
+		client.closeQuietly();
+	}
+
+	//====================================================================================================
+	// Test method transform overrides class transform
+	// Should return "A3-1".
+	//====================================================================================================
+	@Test
+	public void testMethodTransformOverridesClassTransform() throws Exception {
+		RestClient client = new TestRestClient(JsonSerializer.DEFAULT, JsonParser.DEFAULT);
+		String r;
+		String url = URL + "/testMethodTransformOverridesClassTransform";
+
+		r = client.doGet(url).getResponse(String.class);
+		assertEquals("A3-0", r);
+
+		r = client.doPut(url, "A3-1").getResponse(String.class);
+		assertEquals("A3-1", r);
+
+		r = client.doPut(url + "/A3-2", "").getResponse(String.class);
+		assertEquals("A3-2", r);
+
+		client.closeQuietly();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/df0f8689/org.apache.juneau.server.test/src/test/java/org/apache/juneau/server/TestUrisTest.java
----------------------------------------------------------------------
diff --git a/org.apache.juneau.server.test/src/test/java/org/apache/juneau/server/TestUrisTest.java b/org.apache.juneau.server.test/src/test/java/org/apache/juneau/server/TestUrisTest.java
new file mode 100755
index 0000000..4cf147e
--- /dev/null
+++ b/org.apache.juneau.server.test/src/test/java/org/apache/juneau/server/TestUrisTest.java
@@ -0,0 +1,918 @@
+/***************************************************************************************************************************
+ * 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.server;
+
+import static org.junit.Assert.*;
+
+import java.util.regex.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.client.*;
+import org.apache.juneau.json.*;
+import org.junit.*;
+
+/**
+ * Verifies that all the RestRequest.getXXX() methods involving URIs work correctly.
+ */
+public class TestUrisTest {
+
+	private static String URL2 = Constants.getServerTestUrl() + "/testuris";           // /jazz/juneau/sample/testuris
+	private static int port = getPort(Constants.getServerTestUrl());                  // 9443
+	private static String path = Constants.getServerTestUri().getPath();              // /jazz/juneau/sample
+
+	//====================================================================================================
+	// testRoot - http://localhost:8080/sample/testuris
+	//====================================================================================================
+	@Test
+	public void testRoot() throws Exception {
+		RestClient client = new TestRestClient(JsonSerializer.DEFAULT, JsonParser.DEFAULT);
+		ObjectMap r;
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris").getResponse(ObjectMap.class);
+		assertEquals("root.test1", r.getString("testMethod"));
+		assertNull(r.getString("pathInfo"));
+		assertNull(r.getString("pathRemainder"));
+		assertEquals(path + "/testuris", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris"));
+		// Same for servlet
+		assertEquals(path + "/testuris", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2, r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/foo
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/foo").getResponse(ObjectMap.class);
+		assertEquals("root.test1", r.getString("testMethod"));
+		assertEquals("/foo", r.getString("pathInfo"));
+		assertEquals("foo", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/foo", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/foo"));
+		// Same for servlet
+		assertEquals(path + "/testuris", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2, r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/foo/bar
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/foo/bar").getResponse(ObjectMap.class);
+		assertEquals("root.test1", r.getString("testMethod"));
+		assertEquals("/foo/bar", r.getString("pathInfo"));
+		assertEquals("foo/bar", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/foo/bar", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/foo/bar"));
+		// Same for servlet
+		assertEquals(path + "/testuris", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2, r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/foo/bar%2Fbaz
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/foo/bar%2Fbaz").getResponse(ObjectMap.class);
+		assertEquals("root.test1", r.getString("testMethod"));
+		assertEquals("/foo/bar/baz", r.getString("pathInfo"));
+		assertEquals("foo/bar/baz", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/foo/bar%2Fbaz", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/foo/bar%2Fbaz"));
+		// Same for servlet
+		assertEquals(path + "/testuris", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2, r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/test2
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/test2").getResponse(ObjectMap.class);
+		assertEquals("root.test2", r.getString("testMethod"));
+		assertEquals("/test2", r.getString("pathInfo"));
+		assertNull(r.getString("pathRemainder"));
+		assertEquals(path + "/testuris", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/test2", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/test2"));
+		// Same for servlet
+		assertEquals(path + "/testuris", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2, r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/test2/foo
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/test2/foo").getResponse(ObjectMap.class);
+		assertEquals("root.test2", r.getString("testMethod"));
+		assertEquals("/test2/foo", r.getString("pathInfo"));
+		assertEquals("foo", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/test2", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/test2/foo", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/test2/foo"));
+		// Same for servlet
+		assertEquals(path + "/testuris", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2, r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/test2/foo/bar
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/test2/foo/bar").getResponse(ObjectMap.class);
+		assertEquals("root.test2", r.getString("testMethod"));
+		assertEquals("/test2/foo/bar", r.getString("pathInfo"));
+		assertEquals("foo/bar", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/test2/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/test2/foo/bar", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/test2/foo/bar"));
+		// Same for servlet
+		assertEquals(path + "/testuris", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2, r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/test3%2Ftest3
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/test3%2Ftest3").getResponse(ObjectMap.class);
+		assertEquals("root.test3", r.getString("testMethod"));
+		assertEquals("/test3/test3", r.getString("pathInfo"));
+		assertNull(r.getString("pathRemainder"));
+		assertEquals(path + "/testuris", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/test3%2Ftest3", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/test3%2Ftest3"));
+		// Same for servlet
+		assertEquals(path + "/testuris", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2, r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/test3%2Ftest3/foo
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/test3%2Ftest3/foo").getResponse(ObjectMap.class);
+		assertEquals("root.test3", r.getString("testMethod"));
+		assertEquals("/test3/test3/foo", r.getString("pathInfo"));
+		assertEquals("foo", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/test3%2Ftest3", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/test3%2Ftest3/foo", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/test3%2Ftest3/foo"));
+		// Same for servlet
+		assertEquals(path + "/testuris", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2, r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/test3%2Ftest3/foo/bar
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/test3%2Ftest3/foo/bar").getResponse(ObjectMap.class);
+		assertEquals("root.test3", r.getString("testMethod"));
+		assertEquals("/test3/test3/foo/bar", r.getString("pathInfo"));
+		assertEquals("foo/bar", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/test3%2Ftest3/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/test3%2Ftest3/foo/bar", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/test3%2Ftest3/foo/bar"));
+		// Same for servlet
+		assertEquals(path + "/testuris", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2, r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/test3%2Ftest3/foo/bar%2Fbaz
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/test3%2Ftest3/foo/bar%2Fbaz").getResponse(ObjectMap.class);
+		assertEquals("root.test3", r.getString("testMethod"));
+		assertEquals("/test3/test3/foo/bar/baz", r.getString("pathInfo"));
+		assertEquals("foo/bar/baz", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/test3%2Ftest3/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/test3%2Ftest3/foo/bar%2Fbaz", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/test3%2Ftest3/foo/bar%2Fbaz"));
+		// Same for servlet
+		assertEquals(path + "/testuris", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2, r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/test4/test4
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/test4/test4").getResponse(ObjectMap.class);
+		assertEquals("root.test4", r.getString("testMethod"));
+		assertEquals("/test4/test4", r.getString("pathInfo"));
+		assertNull(r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/test4", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/test4/test4", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/test4/test4"));
+		// Same for servlet
+		assertEquals(path + "/testuris", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2, r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/test4/test4/foo
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/test4/test4/foo").getResponse(ObjectMap.class);
+		assertEquals("root.test4", r.getString("testMethod"));
+		assertEquals("/test4/test4/foo", r.getString("pathInfo"));
+		assertEquals("foo", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/test4/test4", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/test4/test4/foo", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/test4/test4/foo"));
+		// Same for servlet
+		assertEquals(path + "/testuris", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2, r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/test4/test4/foo/bar
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/test4/test4/foo/bar").getResponse(ObjectMap.class);
+		assertEquals("root.test4", r.getString("testMethod"));
+		assertEquals("/test4/test4/foo/bar", r.getString("pathInfo"));
+		assertEquals("foo/bar", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/test4/test4/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/test4/test4/foo/bar", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/test4/test4/foo/bar"));
+		// Same for servlet
+		assertEquals(path + "/testuris", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2, r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/test4/test4/foo/bar%2Fbaz
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/test4/test4/foo/bar%2Fbaz").getResponse(ObjectMap.class);
+		assertEquals("root.test4", r.getString("testMethod"));
+		assertEquals("/test4/test4/foo/bar/baz", r.getString("pathInfo"));
+		assertEquals("foo/bar/baz", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/test4/test4/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/test4/test4/foo/bar%2Fbaz", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/test4/test4/foo/bar%2Fbaz"));
+		// Same for servlet
+		assertEquals(path + "/testuris", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2, r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		client.closeQuietly();
+	}
+
+	//====================================================================================================
+	// testChild - http://localhost:8080/sample/testuris/child
+	//====================================================================================================
+	@Test
+	public void testChild() throws Exception {
+		RestClient client = new TestRestClient(JsonSerializer.DEFAULT, JsonParser.DEFAULT);
+		ObjectMap r;
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child").getResponse(ObjectMap.class);
+		assertEquals("child.test1", r.getString("testMethod"));
+		assertNull(r.getString("pathInfo"));
+		assertNull(r.getString("pathRemainder"));
+		assertEquals(path + "/testuris", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/foo
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/foo").getResponse(ObjectMap.class);
+		assertEquals("child.test1", r.getString("testMethod"));
+		assertEquals("/foo", r.getString("pathInfo"));
+		assertEquals("foo", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/foo", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/foo"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/foo/bar
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/foo/bar").getResponse(ObjectMap.class);
+		assertEquals("child.test1", r.getString("testMethod"));
+		assertEquals("/foo/bar", r.getString("pathInfo"));
+		assertEquals("foo/bar", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/foo/bar", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/foo/bar"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/foo/bar%2Fbaz
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/foo/bar%2Fbaz").getResponse(ObjectMap.class);
+		assertEquals("child.test1", r.getString("testMethod"));
+		assertEquals("/foo/bar/baz", r.getString("pathInfo"));
+		assertEquals("foo/bar/baz", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/foo/bar%2Fbaz", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/foo/bar%2Fbaz"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test2
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/test2").getResponse(ObjectMap.class);
+		assertEquals("child.test2", r.getString("testMethod"));
+		assertEquals("/test2", r.getString("pathInfo"));
+		assertNull(r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/test2", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/test2"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test2/foo
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/test2/foo").getResponse(ObjectMap.class);
+		assertEquals("child.test2", r.getString("testMethod"));
+		assertEquals("/test2/foo", r.getString("pathInfo"));
+		assertEquals("foo", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/test2", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/test2/foo", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/test2/foo"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test2/foo/bar
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/test2/foo/bar").getResponse(ObjectMap.class);
+		assertEquals("child.test2", r.getString("testMethod"));
+		assertEquals("/test2/foo/bar", r.getString("pathInfo"));
+		assertEquals("foo/bar", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/test2/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/test2/foo/bar", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/test2/foo/bar"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test2/foo/bar%2Fbaz
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/test2/foo/bar%2Fbaz").getResponse(ObjectMap.class);
+		assertEquals("child.test2", r.getString("testMethod"));
+		assertEquals("/test2/foo/bar/baz", r.getString("pathInfo"));
+		assertEquals("foo/bar/baz", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/test2/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/test2/foo/bar%2Fbaz", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/test2/foo/bar%2Fbaz"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test3%2Ftest3
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/test3%2Ftest3").getResponse(ObjectMap.class);
+		assertEquals("child.test3", r.getString("testMethod"));
+		assertEquals("/test3/test3", r.getString("pathInfo"));
+		assertNull(r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/test3%2Ftest3", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/test3%2Ftest3"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test3%2Ftest3/foo
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/test3%2Ftest3/foo").getResponse(ObjectMap.class);
+		assertEquals("child.test3", r.getString("testMethod"));
+		assertEquals("/test3/test3/foo", r.getString("pathInfo"));
+		assertEquals("foo", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/test3%2Ftest3", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/test3%2Ftest3/foo", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/test3%2Ftest3/foo"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test3%2Ftest3/foo/bar
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/test3%2Ftest3/foo/bar").getResponse(ObjectMap.class);
+		assertEquals("child.test3", r.getString("testMethod"));
+		assertEquals("/test3/test3/foo/bar", r.getString("pathInfo"));
+		assertEquals("foo/bar", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/test3%2Ftest3/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/test3%2Ftest3/foo/bar", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/test3%2Ftest3/foo/bar"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test3%2Ftest3/foo/bar%2Fbaz
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/test3%2Ftest3/foo/bar%2Fbaz").getResponse(ObjectMap.class);
+		assertEquals("child.test3", r.getString("testMethod"));
+		assertEquals("/test3/test3/foo/bar/baz", r.getString("pathInfo"));
+		assertEquals("foo/bar/baz", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/test3%2Ftest3/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/test3%2Ftest3/foo/bar%2Fbaz", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/test3%2Ftest3/foo/bar%2Fbaz"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test4/test4
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/test4/test4").getResponse(ObjectMap.class);
+		assertEquals("child.test4", r.getString("testMethod"));
+		assertEquals("/test4/test4", r.getString("pathInfo"));
+		assertNull(r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/test4", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/test4/test4", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/test4/test4"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test4/test4/foo
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/test4/test4/foo").getResponse(ObjectMap.class);
+		assertEquals("child.test4", r.getString("testMethod"));
+		assertEquals("/test4/test4/foo", r.getString("pathInfo"));
+		assertEquals("foo", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/test4/test4", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/test4/test4/foo", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/test4/test4/foo"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test4/test4/foo/bar
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/test4/test4/foo/bar").getResponse(ObjectMap.class);
+		assertEquals("child.test4", r.getString("testMethod"));
+		assertEquals("/test4/test4/foo/bar", r.getString("pathInfo"));
+		assertEquals("foo/bar", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/test4/test4/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/test4/test4/foo/bar", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/test4/test4/foo/bar"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test4/test4/foo/bar%2Fbaz
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/test4/test4/foo/bar%2Fbaz").getResponse(ObjectMap.class);
+		assertEquals("child.test4", r.getString("testMethod"));
+		assertEquals("/test4/test4/foo/bar/baz", r.getString("pathInfo"));
+		assertEquals("foo/bar/baz", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/test4/test4/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/test4/test4/foo/bar%2Fbaz", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/test4/test4/foo/bar%2Fbaz"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		client.closeQuietly();
+	}
+
+	//====================================================================================================
+	// testGrandChild - http://localhost:8080/sample/testuris/child/grandchild
+	//====================================================================================================
+	@Test
+	public void testGrandChild() throws Exception {
+		RestClient client = new TestRestClient(JsonSerializer.DEFAULT, JsonParser.DEFAULT);
+		ObjectMap r;
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/grandchild").getResponse(ObjectMap.class);
+		assertEquals("grandchild.test1", r.getString("testMethod"));
+		assertNull(r.getString("pathInfo"));
+		assertNull(r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/grandchild", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/grandchild"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child/grandchild", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child/grandchild", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/grandchild/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/foo
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/grandchild/foo").getResponse(ObjectMap.class);
+		assertEquals("grandchild.test1", r.getString("testMethod"));
+		assertEquals("/foo", r.getString("pathInfo"));
+		assertEquals("foo", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/grandchild", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/grandchild/foo", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/grandchild/foo"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child/grandchild", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child/grandchild", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/grandchild/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/foo/bar
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/grandchild/foo/bar").getResponse(ObjectMap.class);
+		assertEquals("grandchild.test1", r.getString("testMethod"));
+		assertEquals("/foo/bar", r.getString("pathInfo"));
+		assertEquals("foo/bar", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/grandchild/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/grandchild/foo/bar", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/grandchild/foo/bar"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child/grandchild", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child/grandchild", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/grandchild/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/foo/bar%2Fbaz
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/grandchild/foo/bar%2Fbaz").getResponse(ObjectMap.class);
+		assertEquals("grandchild.test1", r.getString("testMethod"));
+		assertEquals("/foo/bar/baz", r.getString("pathInfo"));
+		assertEquals("foo/bar/baz", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/grandchild/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/grandchild/foo/bar%2Fbaz", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/grandchild/foo/bar%2Fbaz"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child/grandchild", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child/grandchild", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/grandchild/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test2
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/grandchild/test2").getResponse(ObjectMap.class);
+		assertEquals("grandchild.test2", r.getString("testMethod"));
+		assertEquals("/test2", r.getString("pathInfo"));
+		assertNull(r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/grandchild", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/grandchild/test2", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/grandchild/test2"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child/grandchild", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child/grandchild", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/grandchild/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test2/foo
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/grandchild/test2/foo").getResponse(ObjectMap.class);
+		assertEquals("grandchild.test2", r.getString("testMethod"));
+		assertEquals("/test2/foo", r.getString("pathInfo"));
+		assertEquals("foo", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/grandchild/test2", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/grandchild/test2/foo", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/grandchild/test2/foo"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child/grandchild", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child/grandchild", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/grandchild/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test2/foo/bar
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/grandchild/test2/foo/bar").getResponse(ObjectMap.class);
+		assertEquals("grandchild.test2", r.getString("testMethod"));
+		assertEquals("/test2/foo/bar", r.getString("pathInfo"));
+		assertEquals("foo/bar", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/grandchild/test2/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/grandchild/test2/foo/bar", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/grandchild/test2/foo/bar"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child/grandchild", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child/grandchild", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/grandchild/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test2/foo/bar%2Fbaz
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/grandchild/test2/foo/bar%2Fbaz").getResponse(ObjectMap.class);
+		assertEquals("grandchild.test2", r.getString("testMethod"));
+		assertEquals("/test2/foo/bar/baz", r.getString("pathInfo"));
+		assertEquals("foo/bar/baz", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/grandchild/test2/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/grandchild/test2/foo/bar%2Fbaz", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/grandchild/test2/foo/bar%2Fbaz"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child/grandchild", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child/grandchild", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/grandchild/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test3%2Ftest3
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/grandchild/test3%2Ftest3").getResponse(ObjectMap.class);
+		assertEquals("grandchild.test3", r.getString("testMethod"));
+		assertEquals("/test3/test3", r.getString("pathInfo"));
+		assertNull(r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/grandchild", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/grandchild/test3%2Ftest3", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/grandchild/test3%2Ftest3"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child/grandchild", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child/grandchild", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/grandchild/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test3%2Ftest3/foo
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/grandchild/test3%2Ftest3/foo").getResponse(ObjectMap.class);
+		assertEquals("grandchild.test3", r.getString("testMethod"));
+		assertEquals("/test3/test3/foo", r.getString("pathInfo"));
+		assertEquals("foo", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/grandchild/test3%2Ftest3", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/grandchild/test3%2Ftest3/foo", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/grandchild/test3%2Ftest3/foo"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child/grandchild", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child/grandchild", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/grandchild/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test3%2Ftest3/foo/bar
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/grandchild/test3%2Ftest3/foo/bar").getResponse(ObjectMap.class);
+		assertEquals("grandchild.test3", r.getString("testMethod"));
+		assertEquals("/test3/test3/foo/bar", r.getString("pathInfo"));
+		assertEquals("foo/bar", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/grandchild/test3%2Ftest3/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/grandchild/test3%2Ftest3/foo/bar", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/grandchild/test3%2Ftest3/foo/bar"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child/grandchild", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child/grandchild", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/grandchild/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test3%2Ftest3/foo/bar%2Fbaz
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/grandchild/test3%2Ftest3/foo/bar%2Fbaz").getResponse(ObjectMap.class);
+		assertEquals("grandchild.test3", r.getString("testMethod"));
+		assertEquals("/test3/test3/foo/bar/baz", r.getString("pathInfo"));
+		assertEquals("foo/bar/baz", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/grandchild/test3%2Ftest3/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/grandchild/test3%2Ftest3/foo/bar%2Fbaz", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/grandchild/test3%2Ftest3/foo/bar%2Fbaz"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child/grandchild", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child/grandchild", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/grandchild/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test4/test4
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/grandchild/test4/test4").getResponse(ObjectMap.class);
+		assertEquals("grandchild.test4", r.getString("testMethod"));
+		assertEquals("/test4/test4", r.getString("pathInfo"));
+		assertNull(r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/grandchild/test4", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/grandchild/test4/test4", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/grandchild/test4/test4"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child/grandchild", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child/grandchild", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/grandchild/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test4/test4/foo
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/grandchild/test4/test4/foo").getResponse(ObjectMap.class);
+		assertEquals("grandchild.test4", r.getString("testMethod"));
+		assertEquals("/test4/test4/foo", r.getString("pathInfo"));
+		assertEquals("foo", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/grandchild/test4/test4", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/grandchild/test4/test4/foo", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/grandchild/test4/test4/foo"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child/grandchild", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child/grandchild", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/grandchild/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test4/test4/foo/bar
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/grandchild/test4/test4/foo/bar").getResponse(ObjectMap.class);
+		assertEquals("grandchild.test4", r.getString("testMethod"));
+		assertEquals("/test4/test4/foo/bar", r.getString("pathInfo"));
+		assertEquals("foo/bar", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/grandchild/test4/test4/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/grandchild/test4/test4/foo/bar", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/grandchild/test4/test4/foo/bar"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child/grandchild", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child/grandchild", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/grandchild/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		//--------------------------------------------------------------------------------
+		// http://localhost:8080/sample/testuris/child/test4/test4/foo/bar%2Fbaz
+		//--------------------------------------------------------------------------------
+		r = client.doGet("/testuris/child/grandchild/test4/test4/foo/bar%2Fbaz").getResponse(ObjectMap.class);
+		assertEquals("grandchild.test4", r.getString("testMethod"));
+		assertEquals("/test4/test4/foo/bar/baz", r.getString("pathInfo"));
+		assertEquals("foo/bar/baz", r.getString("pathRemainder"));
+		assertEquals(path + "/testuris/child/grandchild/test4/test4/foo", r.getString("requestParentURI"));
+		assertEquals(path + "/testuris/child/grandchild/test4/test4/foo/bar%2Fbaz", r.getString("requestURI"));
+		assertTrue(r.getString("requestURL").endsWith(port + path + "/testuris/child/grandchild/test4/test4/foo/bar%2Fbaz"));
+		// Same for servlet
+		assertEquals(path + "/testuris/child/grandchild", r.getString("contextPath") + r.getString("servletPath"));  // App may not have context path, but combination should always equal path.
+		assertEquals(URL2 + "/child/grandchild", r.getString("servletURI"));
+		assertTrue(r.getString("testURL1").endsWith(port + path + "/testuris/child/grandchild/testURL"));
+		// Always the same
+		assertTrue(r.getString("testURL2").endsWith(port + "/testURL"));
+		assertEquals("http://testURL", r.getString("testURL3"));
+
+		client.closeQuietly();
+	}
+
+	private static int getPort(String url) {
+		Pattern p = Pattern.compile("\\:(\\d{2,5})");
+		Matcher m = p.matcher(url);
+		if (m.find())
+			return Integer.parseInt(m.group(1));
+		return -1;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/df0f8689/org.apache.juneau.server.test/src/test/java/org/apache/juneau/server/TestUrlContentTest.java
----------------------------------------------------------------------
diff --git a/org.apache.juneau.server.test/src/test/java/org/apache/juneau/server/TestUrlContentTest.java b/org.apache.juneau.server.test/src/test/java/org/apache/juneau/server/TestUrlContentTest.java
new file mode 100755
index 0000000..fab63a6
--- /dev/null
+++ b/org.apache.juneau.server.test/src/test/java/org/apache/juneau/server/TestUrlContentTest.java
@@ -0,0 +1,74 @@
+/***************************************************************************************************************************
+ * 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.server;
+
+import static org.junit.Assert.*;
+
+import org.apache.juneau.client.*;
+import org.junit.*;
+
+public class TestUrlContentTest {
+
+	private static String URL = "/testUrlContent";
+	private static RestClient client;
+
+	@BeforeClass
+	public static void beforeClass() {
+		client = new TestRestClient().setHeader("Accept", "text/plain");
+	}
+
+	@AfterClass
+	public static void afterClass() {
+		client.closeQuietly();
+	}
+
+	//====================================================================================================
+	// Test URL &Content parameter containing a String
+	//====================================================================================================
+	@Test
+	public void testString() throws Exception {
+		String r;
+		r = client.doGet(URL + "/testString?content=\'xxx\'&Content-Type=text/json").getResponseAsString();
+		assertEquals("class=java.lang.String, value=xxx", r);
+	}
+
+	//====================================================================================================
+	// Test URL &Content parameter containing an Enum
+	//====================================================================================================
+	@Test
+	public void testEnum() throws Exception {
+		String r;
+		r = client.doGet(URL + "/testEnum?content='X1'&Content-Type=text/json").getResponseAsString();
+		assertEquals("class=org.apache.juneau.server.TestUrlContent$TestEnum, value=X1", r);
+	}
+
+	//====================================================================================================
+	// Test URL &Content parameter containing a Bean
+	//====================================================================================================
+	@Test
+	public void testBean() throws Exception {
+		String r;
+		r = client.doGet(URL + "/testBean?content=%7Bf1:1,f2:'foobar'%7D&Content-Type=text/json").getResponseAsString();
+		assertEquals("class=org.apache.juneau.server.TestUrlContent$TestBean, value={f1:1,f2:'foobar'}", r);
+	}
+
+	//====================================================================================================
+	// Test URL &Content parameter containing an int
+	//====================================================================================================
+	@Test
+	public void testInt() throws Exception {
+		String r;
+		r = client.doGet(URL + "/testInt?content=123&Content-Type=text/json").getResponseAsString();
+		assertEquals("class=java.lang.Integer, value=123", r);
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/df0f8689/org.apache.juneau.server.test/src/test/java/org/apache/juneau/server/UrlPathPatternTest.java
----------------------------------------------------------------------
diff --git a/org.apache.juneau.server.test/src/test/java/org/apache/juneau/server/UrlPathPatternTest.java b/org.apache.juneau.server.test/src/test/java/org/apache/juneau/server/UrlPathPatternTest.java
new file mode 100755
index 0000000..09b782d
--- /dev/null
+++ b/org.apache.juneau.server.test/src/test/java/org/apache/juneau/server/UrlPathPatternTest.java
@@ -0,0 +1,39 @@
+/***************************************************************************************************************************
+ * 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.server;
+
+import static org.junit.Assert.*;
+
+import java.util.*;
+
+import org.apache.juneau.json.*;
+import org.junit.*;
+
+public class UrlPathPatternTest {
+	@Test
+	public void testComparison() throws Exception {
+		List<UrlPathPattern> l = new LinkedList<UrlPathPattern>();
+
+		l.add(new UrlPathPattern("/foo"));
+		l.add(new UrlPathPattern("/foo/*"));
+		l.add(new UrlPathPattern("/foo/bar"));
+		l.add(new UrlPathPattern("/foo/bar/*"));
+		l.add(new UrlPathPattern("/foo/{id}"));
+		l.add(new UrlPathPattern("/foo/{id}/*"));
+		l.add(new UrlPathPattern("/foo/{id}/bar"));
+		l.add(new UrlPathPattern("/foo/{id}/bar/*"));
+
+		Collections.sort(l);
+		assertEquals("['/foo/bar','/foo/bar/*','/foo/{id}/bar','/foo/{id}/bar/*','/foo/{id}','/foo/{id}/*','/foo','/foo/*']", JsonSerializer.DEFAULT_LAX.serialize(l));
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/df0f8689/org.apache.juneau/src/test/java/org/apache/juneau/AnnotationsTest.java
----------------------------------------------------------------------
diff --git a/org.apache.juneau/src/test/java/org/apache/juneau/AnnotationsTest.java b/org.apache.juneau/src/test/java/org/apache/juneau/AnnotationsTest.java
new file mode 100755
index 0000000..016b4c1
--- /dev/null
+++ b/org.apache.juneau/src/test/java/org/apache/juneau/AnnotationsTest.java
@@ -0,0 +1,82 @@
+/***************************************************************************************************************************
+ * 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;
+
+import static org.apache.juneau.TestUtils.*;
+import static org.junit.Assert.*;
+
+import org.apache.juneau.annotation.*;
+import org.junit.*;
+
+
+@SuppressWarnings({"rawtypes"})
+public class AnnotationsTest {
+
+	//====================================================================================================
+	// Bean with explicitly specified properties.
+	//====================================================================================================
+	@Test
+	public void testBeanWithExplicitProperties() throws Exception {
+		BeanContext bc = BeanContext.DEFAULT;
+		BeanMap bm = null;
+
+		// Basic test
+		bm = bc.newBeanMap(Person1.class).load("{age:21,name:'foobar'}");
+		assertNotNull(bm);
+		assertNotNull(bm.getBean());
+		assertEquals(bm.get("age"), 21);
+		assertEquals(bm.get("name"), "foobar");
+
+		bm.put("age", 65);
+		bm.put("name", "futbol");
+		assertEquals(bm.get("age"), 65);
+		assertEquals(bm.get("name"), "futbol");
+	}
+
+	/** Class with explicitly specified properties */
+	@Bean(properties = { "age", "name" })
+	public static class Person1 {
+		public int age;
+		private String name;
+		public String getName() {
+			return name;
+		}
+		public void setName(String name) {
+			this.name = name;
+		}
+	}
+
+	//====================================================================================================
+	// Private/protected/default fields should be ignored.
+	//====================================================================================================
+	@Test
+	public void testForOnlyPublicFields() throws Exception {
+		BeanContext bc = BeanContext.DEFAULT;
+		BeanMap bm = null;
+
+		// Make sure only public fields are detected
+		bm = bc.newBeanMap(A.class).load("{publicField:123}");
+		assertNotNull("F1", bm);
+		assertNotNull("F2", bm.getBean());
+		assertObjectEquals("{publicField:123}", bm.getBean());
+
+	}
+
+	public static class A {
+		public int publicField;
+		protected int protectedField;
+		@SuppressWarnings("unused")
+		private int privateField;
+		int defaultField;
+	}
+}
\ No newline at end of file


Mime
View raw message