Repository: incubator-juneau Updated Branches: refs/heads/master a8d50ab1f -> d45e1351d
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d45e1351/juneau-server-test/src/test/java/org/apache/juneau/server/test/UrisTest.java ---------------------------------------------------------------------- diff --git a/juneau-server-test/src/test/java/org/apache/juneau/server/test/UrisTest.java b/juneau-server-test/src/test/java/org/apache/juneau/server/test/UrisTest.java new file mode 100755 index 0000000..eb67231 --- /dev/null +++ b/juneau-server-test/src/test/java/org/apache/juneau/server/test/UrisTest.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.test; + +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 UrisTest { + + 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/d45e1351/juneau-server-test/src/test/java/org/apache/juneau/server/test/UrlContentTest.java ---------------------------------------------------------------------- diff --git a/juneau-server-test/src/test/java/org/apache/juneau/server/test/UrlContentTest.java b/juneau-server-test/src/test/java/org/apache/juneau/server/test/UrlContentTest.java new file mode 100755 index 0000000..ca8dd1d --- /dev/null +++ b/juneau-server-test/src/test/java/org/apache/juneau/server/test/UrlContentTest.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.test; + +import static org.junit.Assert.*; + +import org.apache.juneau.client.*; +import org.junit.*; + +public class UrlContentTest { + + 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.test.UrlContentResource$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.test.UrlContentResource$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/d45e1351/juneau-server-test/src/test/java/org/apache/juneau/server/test/UrlPathPatternTest.java ---------------------------------------------------------------------- diff --git a/juneau-server-test/src/test/java/org/apache/juneau/server/test/UrlPathPatternTest.java b/juneau-server-test/src/test/java/org/apache/juneau/server/test/UrlPathPatternTest.java new file mode 100755 index 0000000..42d367c --- /dev/null +++ b/juneau-server-test/src/test/java/org/apache/juneau/server/test/UrlPathPatternTest.java @@ -0,0 +1,40 @@ +// *************************************************************************************************************************** +// * 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.test; + +import static org.junit.Assert.*; + +import java.util.*; + +import org.apache.juneau.json.*; +import org.apache.juneau.server.*; +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/d45e1351/juneau-server/src/main/java/org/apache/juneau/server/RestServletContext.java ---------------------------------------------------------------------- diff --git a/juneau-server/src/main/java/org/apache/juneau/server/RestServletContext.java b/juneau-server/src/main/java/org/apache/juneau/server/RestServletContext.java index 10bf747..8931047 100755 --- a/juneau-server/src/main/java/org/apache/juneau/server/RestServletContext.java +++ b/juneau-server/src/main/java/org/apache/juneau/server/RestServletContext.java @@ -32,12 +32,65 @@ import org.apache.juneau.server.annotation.*; * <p> * See {@link ContextFactory} for more information about context properties. * + * <h6 class='topic' id='ConfigProperties'>Configurable properties on the REST servlet</h6> + * <table class='styled' style='border-collapse: collapse;'> + * <tr><th>Setting name</th><th>Description</th><th>Data type</th><th>Default value</th></tr> + * <tr> + * <td>{@link #REST_allowHeaderParams}</td> + * <td>Enable header URL parameters.</td> + * <td><code>Boolean</code></td> + * <td><jk>true</jk></td> + * </tr> + * <tr> + * <td>{@link #REST_allowMethodParam}</td> + * <td>Enable <js>"method"</js> URL parameter for specific HTTP methods.</td> + * <td><code>String</code></td> + * <td><js>""</js></td> + * </tr> + * <tr> + * <td>{@link #REST_allowContentParam}</td> + * <td>Enable <js>"content"</js> URL parameter.</td> + * <td><code>Boolean</code></td> + * <td><jk>true</jk></td> + * </tr> + * <tr> + * <td>{@link #REST_renderResponseStackTraces}</td> + * <td>Render stack traces in HTTP response bodies when errors occur.</td> + * <td><code>Boolean</code></td> + * <td><jk>false</jk></td> + * </tr> + * <tr> + * <td>{@link #REST_useStackTraceHashes}</td> + * <td>Use stack trace hashes.</td> + * <td><code>Boolean</code></td> + * <td><jk>false</jk></td> + * </tr> + * <tr> + * <td>{@link #REST_defaultCharset}</td> + * <td>Default character encoding.</td> + * <td><code>String</code></td> + * <td><js>"utf-8"</js></td> + * </tr> + * <tr> + * <td>{@link #REST_paramFormat}</td> + * <td>Expected format of request parameters.</td> + * <td><code>String</code></td> + * <td><js>"UON"</js></td> + * </tr> + * </table> + * * @author James Bognar ([email protected]) */ public final class RestServletContext extends Context { /** - * Allow header URL parameters ({@link Boolean}, default=<jk>true</jk>). + * <b>Configuration property:</b> Enable header URL parameters. + * <p> + * <ul> + * <li><b>Name:</b> <js>"RestServlet.allowHeaderParams"</js> + * <li><b>Data type:</b> <code>Boolean</code> + * <li><b>Default:</b> <jk>true</jk> + * </ul> * <p> * When enabled, headers such as <js>"Accept"</js> and <js>"Content-Type"</js> to be passed in as URL query parameters. * For example: <js>"?Accept=text/json&Content-Type=text/json"</js> @@ -51,22 +104,39 @@ public final class RestServletContext extends Context { public static final String REST_allowHeaderParams = "RestServlet.allowHeaderParams"; /** - * Allow <js>"method"</js> URL parameter for specific HTTP methods (String, default=<js>""</js>, example=<js>"HEAD,OPTIONS"</js>). + * <b>Configuration property:</b> Enable <js>"method"</js> URL parameter for specific HTTP methods. + * <p> + * <ul> + * <li><b>Name:</b> <js>"RestServlet.allowMethodParam"</js> + * <li><b>Data type:</b> <code>String</code> + * <li><b>Default:</b> <js>""</js> + * </ul> * <p> * When specified, the HTTP method can be overridden by passing in a <js>"method"</js> URL parameter on a regular GET request. * For example: <js>"?method=OPTIONS"</js> * <p> - * Parameter name is case-insensitive. Use "*" to represent all methods. For backwards compatibility, "true" also means "*". + * Format is a comma-delimited list of HTTP method names that can be passed in as a method parameter. + * Parameter name is case-insensitive. + * Use "*" to represent all methods. + * For backwards compatibility, "true" also means "*". * <p> * Note that per the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html">HTTP specification</a>, special care should * be taken when allowing non-safe (POST, PUT, DELETE) methods to be invoked through GET requests. * <p> * Applicable to servlet class only. + * <p> + * Example: <js>"HEAD,OPTIONS"</js> */ public static final String REST_allowMethodParam = "RestServlet.allowMethodParam"; /** - * Allow <js>"content"</js> URL parameter ({@link Boolean}, default=<jk>true</jk>). + * <b>Configuration property:</b> Enable <js>"content"</js> URL parameter. + * <p> + * <ul> + * <li><b>Name:</b> <js>"RestServlet.allowContentParam"</js> + * <li><b>Data type:</b> <code>Boolean</code> + * <li><b>Default:</b> <jk>true</jk> + * </ul> * <p> * When enabled, the HTTP body content on PUT and POST requests can be passed in as text using the <js>"content"</js> URL parameter. * For example: <js>"?content={name:'John%20Smith',age:45}"</js> @@ -80,7 +150,15 @@ public final class RestServletContext extends Context { public static final String REST_allowContentParam = "RestServlet.allowContentParam"; /** - * Render stack traces in HTTP response bodies when errors occur ({@link Boolean}, default=<jk>false</jk>). + * <b>Configuration property:</b> Render stack traces. + * <p> + * <ul> + * <li><b>Name:</b> <js>"RestServlet.renderResponseStackTraces"</js> + * <li><b>Data type:</b> <code>Boolean</code> + * <li><b>Default:</b> <jk>false</jk> + * </ul> + * <p> + * Render stack traces in HTTP response bodies when errors occur. * <p> * When enabled, Java stack traces will be rendered in the output response. * Useful for debugging, although allowing stack traces to be rendered may cause security concerns. @@ -90,7 +168,13 @@ public final class RestServletContext extends Context { public static final String REST_renderResponseStackTraces = "RestServlet.renderResponseStackTraces"; /** - * Use stack trace hashes ({@link Boolean}, default=<jk>true</jk>). + * <b>Configuration property:</b> Use stack trace hashes. + * <p> + * <ul> + * <li><b>Name:</b> <js>"RestServlet.useStackTraceHashes"</js> + * <li><b>Data type:</b> <code>Boolean</code> + * <li><b>Default:</b> <jk>true</jk> + * </ul> * <p> * When enabled, the number of times an exception has occurred will be determined based on stack trace hashsums, * made available through the {@link RestException#getOccurrence()} method. @@ -100,14 +184,28 @@ public final class RestServletContext extends Context { public static final String REST_useStackTraceHashes = "RestServlet.useStackTraceHashes"; /** - * The default character encoding for the request and response if not specified on the request ({@link String}>, default=<js>"utf-8"</js>). + * <b>Configuration property:</b> Default character encoding. + * <p> + * <ul> + * <li><b>Name:</b> <js>"RestServlet.defaultCharset"</js> + * <li><b>Data type:</b> <code>String</code> + * <li><b>Default:</b> <js>"utf-8"</js> + * </ul> + * <p> + * The default character encoding for the request and response if not specified on the request. * <p> * Applicable to servlet class and methods. */ public static final String REST_defaultCharset = "RestServlet.defaultCharset"; /** - * The expected format of request parameters ({@link String}, default=<js>"UON"</js>). + * <b>Configuration property:</b> Expected format of request parameters. + * <p> + * <ul> + * <li><b>Name:</b> <js>"RestServlet.paramFormat"</js> + * <li><b>Data type:</b> <code>String</code> + * <li><b>Default:</b> <js>"UON"</js> + * </ul> * <p> * Possible values: * <ul class='spaced-list'> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d45e1351/juneau-server/src/main/java/org/apache/juneau/server/vars/package.html ---------------------------------------------------------------------- diff --git a/juneau-server/src/main/java/org/apache/juneau/server/vars/package.html b/juneau-server/src/main/java/org/apache/juneau/server/vars/package.html new file mode 100755 index 0000000..ac4588d --- /dev/null +++ b/juneau-server/src/main/java/org/apache/juneau/server/vars/package.html @@ -0,0 +1,41 @@ +<!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>Predefined SVL variables</p> +</body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d45e1351/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index e2aa388..297bcdb 100644 --- a/pom.xml +++ b/pom.xml @@ -89,7 +89,7 @@ <use>true</use> <additionalparam>-sourcetab 3 -notimestamp -Xdoclint:none</additionalparam> <verbose>false</verbose> - <excludePackageNames>*proto*</excludePackageNames> + <excludePackageNames>*proto*:*samples*:*test*</excludePackageNames> <links> <link>http://docs.oracle.com/javase/7/docs/api/</link> <link>http://docs.oracle.com/javaee/5/api/</link>
