http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/code-highlighting.css
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/code-highlighting.css
 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/code-highlighting.css
new file mode 100644
index 0000000..a016a6c
--- /dev/null
+++ 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/code-highlighting.css
@@ -0,0 +1,136 @@
+/***************************************************************************************************************************
+ * 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.  
                                            *
+ 
***************************************************************************************************************************/
+code, 
+tt, 
+pre,
+dt code {
+       font-size: 9pt;
+}
+
+/*--- Bordered code ---*/
+p.bcode {
+       font-size: 9pt;
+       white-space: pre;
+       border: 1px solid black;
+       margin: 10px 20px;
+       padding: 10px;
+       border-radius: 10px;
+       overflow: hidden;
+       font-family: monospace;
+       background-color: #f8f8f8;
+       border-color: #cccccc;
+       -moz-tab-size: 3;
+       tab-size: 3;
+       -o-tab-size: 3;
+}
+
+.fixedWidth {
+       max-width: 800px;
+}
+
+/* Override padding bottom in javadoc comments. */
+.blockList p.bcode {
+       padding-bottom: 0px !important;
+}
+
+/*--- Unbordered code ---*/
+p.code {
+       font-size: 9pt;
+       white-space: pre;
+       font-family: monospace;
+       padding-bottom: 15px;
+       margin: -15px;
+}
+
+td.code {
+       font-size: 9pt;
+       white-space: pre;
+       font-family: monospace;
+}
+
+table.code {
+       font-size: 9pt;
+       white-space: pre;
+       font-family: monospace;
+}
+
+/*--- Java code effects ---*/
+jc,jd,jt,jk,js,jf,jsf,jsm,ja {
+       font-size: 9pt;
+       white-space: pre;
+       font-family: monospace;
+}
+/* Comment */
+jc {
+       color: green;
+}
+/* Javadoc comment */
+jd {
+       color: #3f5fbf;
+}
+/* Javadoc tag */
+jt {
+       color: #7f9fbf;
+       font-weight: bold;
+}
+/* Primitive */
+jk {
+       color: #7f0055;
+       font-weight: bold;
+}
+/* String */
+js {
+       color: blue;
+}
+/* Field */
+jf {
+       color: blue;
+}
+/* Static field */
+jsf {
+       color: blue;
+       font-style: italic;
+}
+/* Static method */
+jsm {
+       font-style: italic;
+}
+/* Annotation */
+ja {
+       color: grey;
+}
+
+/*--- XML code effects ---*/
+xt,xa,xc,xs {
+       font-size: 9pt;
+       white-space: pre;
+       font-family: monospace;
+}
+
+xt {
+       color: DarkCyan;
+}
+
+xa {
+       color: purple;
+}
+
+xc {
+       color: mediumblue;
+}
+
+xs {
+       color: blue;
+       font-style: italic;
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/AtomFeedResource.properties
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/AtomFeedResource.properties
 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/AtomFeedResource.properties
new file mode 100644
index 0000000..7ff4a44
--- /dev/null
+++ 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/AtomFeedResource.properties
@@ -0,0 +1,21 @@
+# 
***************************************************************************************************************************
+# * 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. 
                                             *
+# 
***************************************************************************************************************************
+
+#--------------------------------------------------------------------------------
+# AtomFeedResource labels
+#--------------------------------------------------------------------------------
+title = Sample ATOM feed resource
+description = Sample resource that shows how to render ATOM feeds
+getFeed = Get the sample ATOM feed
+setFeed = Overwrite the sample ATOM feed
+doOptions = Show resource options

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/CodeFormatterResource.properties
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/CodeFormatterResource.properties
 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/CodeFormatterResource.properties
new file mode 100644
index 0000000..ac2f236
--- /dev/null
+++ 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/CodeFormatterResource.properties
@@ -0,0 +1,18 @@
+# 
***************************************************************************************************************************
+# * 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. 
                                             *
+# 
***************************************************************************************************************************
+
+#--------------------------------------------------------------------------------
+# CodeFormatterResource labels
+#--------------------------------------------------------------------------------
+title = Code Formatter
+description = Utility for generating HTML code-formatted source code

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/HelloWorldResource.properties
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/HelloWorldResource.properties
 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/HelloWorldResource.properties
new file mode 100644
index 0000000..7c8f03d
--- /dev/null
+++ 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/HelloWorldResource.properties
@@ -0,0 +1,19 @@
+# 
***************************************************************************************************************************
+# * 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. 
                                             *
+# 
***************************************************************************************************************************
+
+#--------------------------------------------------------------------------------
+# HelloWorldResource labels
+#--------------------------------------------------------------------------------
+title = Hello World sample resource
+description = Simplest possible resource
+sayHello = Responds with "Hello world!" 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/JsonSchemaResource.properties
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/JsonSchemaResource.properties
 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/JsonSchemaResource.properties
new file mode 100644
index 0000000..1a486a9
--- /dev/null
+++ 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/JsonSchemaResource.properties
@@ -0,0 +1,20 @@
+# 
***************************************************************************************************************************
+# * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+# * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+# * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            * 
+# * with the License.  You may obtain a copy of the License at                 
                                             *
+# *                                                                            
                                             *
+# *  http://www.apache.org/licenses/LICENSE-2.0                                
                                             *
+# *                                                                            
                                             *
+# * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
+# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
+# * specific language governing permissions and limitations under the License. 
                                             *
+# 
***************************************************************************************************************************
+
+#--------------------------------------------------------------------------------
+# JsonSchemaResource labels
+#--------------------------------------------------------------------------------
+title = Sample resource that shows how to generate JSON-Schema documents
+getSchema = Get the JSON-Schema document
+setSchema = Overwrite the JSON-Schema document
+doOptions = Show resource options

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/MethodExampleResource.properties
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/MethodExampleResource.properties
 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/MethodExampleResource.properties
new file mode 100644
index 0000000..be0bcf1
--- /dev/null
+++ 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/MethodExampleResource.properties
@@ -0,0 +1,37 @@
+# 
***************************************************************************************************************************
+# * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+# * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+# * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            * 
+# * with the License.  You may obtain a copy of the License at                 
                                             *
+# *                                                                            
                                             *
+# *  http://www.apache.org/licenses/LICENSE-2.0                                
                                             *
+# *                                                                            
                                             *
+# * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
+# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
+# * specific language governing permissions and limitations under the License. 
                                             *
+# 
***************************************************************************************************************************
+
+#--------------------------------------------------------------------------------
+# MethodExampleResource labels
+#--------------------------------------------------------------------------------
+title = A simple REST method example resource
+doGetExample.summary = Sample GET method
+doGetExample1.summary = Sample GET using annotations
+doGetExample1.req.path.a1.description = Sample variable
+doGetExample1.req.path.a2.description = Sample variable
+doGetExample1.req.path.a3.description = Sample variable
+doGetExample1.req.query.p1.description = Sample parameter
+doGetExample1.req.query.p2.description = Sample parameter
+doGetExample1.req.query.p3.description = Sample parameter
+doGetExample1.req.header.Accept-Language.description = Sample header
+doGetExample1.req.header.DNT.description = Sample header
+doGetExample2.summary = Sample GET using Java APIs
+doGetExample2.req.path.a1.description = Sample variable
+doGetExample2.req.path.a2.description = Sample variable
+doGetExample2.req.path.a3.description = Sample variable
+doGetExample2.req.query.p1.description = Sample parameter
+doGetExample2.req.query.p2.description = Sample parameter
+doGetExample2.req.query.p3.description = Sample parameter
+doGetExample2.req.header.Accept-Language.description = Sample header
+doGetExample2.req.header.DNT.description = Sample header
+getOptions.summary = Get these options

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/PhotosResource.properties
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/PhotosResource.properties
 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/PhotosResource.properties
new file mode 100644
index 0000000..93f7f7d
--- /dev/null
+++ 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/PhotosResource.properties
@@ -0,0 +1,24 @@
+# 
***************************************************************************************************************************
+# * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+# * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+# * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            * 
+# * with the License.  You may obtain a copy of the License at                 
                                             *
+# *                                                                            
                                             *
+# *  http://www.apache.org/licenses/LICENSE-2.0                                
                                             *
+# *                                                                            
                                             *
+# * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
+# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
+# * specific language governing permissions and limitations under the License. 
                                             *
+# 
***************************************************************************************************************************
+
+#--------------------------------------------------------------------------------
+# PhotosResource labels
+#--------------------------------------------------------------------------------
+title = Sample resource that allows images to be uploaded and retrieved.
+getAllPhotos = Show the list of all currently loaded photos
+getPhoto = Get a photo by ID
+addPhoto = Add a photo
+setPhoto = Overwrite a photo by ID
+deletePhoto = Delete a photo by ID
+doOptions = Show resource options
+

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/RequestEchoResource.properties
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/RequestEchoResource.properties
 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/RequestEchoResource.properties
new file mode 100644
index 0000000..db7641c
--- /dev/null
+++ 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/RequestEchoResource.properties
@@ -0,0 +1,19 @@
+# 
***************************************************************************************************************************
+# * 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. 
                                             *
+# 
***************************************************************************************************************************
+
+#--------------------------------------------------------------------------------
+# RequestEchoResource labels
+#--------------------------------------------------------------------------------
+title = Echos the current HttpServletRequest object back to the browser.
+doGet = Serializes the incoming HttpServletRequest object.
+

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/RootResources.properties
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/RootResources.properties
 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/RootResources.properties
new file mode 100644
index 0000000..301057d
--- /dev/null
+++ 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/RootResources.properties
@@ -0,0 +1,18 @@
+# 
***************************************************************************************************************************
+# * 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. 
                                             *
+# 
***************************************************************************************************************************
+
+#--------------------------------------------------------------------------------
+# RootResources labels
+#--------------------------------------------------------------------------------
+title = Root resources
+description = This is an example of a router resource that is used to access 
other resources.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SampleRemoteableServlet.properties
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SampleRemoteableServlet.properties
 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SampleRemoteableServlet.properties
new file mode 100644
index 0000000..48fd5ce
--- /dev/null
+++ 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SampleRemoteableServlet.properties
@@ -0,0 +1,17 @@
+# 
***************************************************************************************************************************
+# * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+# * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+# * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            * 
+# * with the License.  You may obtain a copy of the License at                 
                                             *
+# *                                                                            
                                             *
+# *  http://www.apache.org/licenses/LICENSE-2.0                                
                                             *
+# *                                                                            
                                             *
+# * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
+# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
+# * specific language governing permissions and limitations under the License. 
                                             *
+# 
***************************************************************************************************************************
+
+#--------------------------------------------------------------------------------
+# SampleRemoteableServlet labels
+#--------------------------------------------------------------------------------
+title = Sample resource that demonstrates the remotable API

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SourceResource.properties
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SourceResource.properties
 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SourceResource.properties
new file mode 100644
index 0000000..363f00a
--- /dev/null
+++ 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SourceResource.properties
@@ -0,0 +1,19 @@
+# 
***************************************************************************************************************************
+# * 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. 
                                             *
+# 
***************************************************************************************************************************
+
+#--------------------------------------------------------------------------------
+# SourceResource labels
+#--------------------------------------------------------------------------------
+title = Servlet for viewing source code on classes whose Java files are 
present on the classpath.
+getSource = View source on the specified classes.
+

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SqlQueryResource.properties
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SqlQueryResource.properties
 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SqlQueryResource.properties
new file mode 100644
index 0000000..527ca93
--- /dev/null
+++ 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SqlQueryResource.properties
@@ -0,0 +1,19 @@
+# 
***************************************************************************************************************************
+# * 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. 
                                             *
+# 
***************************************************************************************************************************
+
+#--------------------------------------------------------------------------------
+# SqlQueryResource labels
+#--------------------------------------------------------------------------------
+title = Sample resource that shows how to serialize SQL ResultSets 
+doGet = Display the query entry page
+doPost = Execute one or more queries

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/TempDirResource.properties
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/TempDirResource.properties
 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/TempDirResource.properties
new file mode 100644
index 0000000..94c009e
--- /dev/null
+++ 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/TempDirResource.properties
@@ -0,0 +1,18 @@
+# 
***************************************************************************************************************************
+# * 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. 
                                             *
+# 
***************************************************************************************************************************
+
+#--------------------------------------------------------------------------------
+# TempDirResource labels
+#--------------------------------------------------------------------------------
+title = Temp Directory View Service
+description = View and download files in the '$S{java.io.tmpdir}' directory.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/TumblrParserResource.properties
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/TumblrParserResource.properties
 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/TumblrParserResource.properties
new file mode 100644
index 0000000..28a3e72
--- /dev/null
+++ 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/TumblrParserResource.properties
@@ -0,0 +1,19 @@
+# 
***************************************************************************************************************************
+# * 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. 
                                             *
+# 
***************************************************************************************************************************
+
+#--------------------------------------------------------------------------------
+# SqlQueryResource labels
+#--------------------------------------------------------------------------------
+title = Tumblr blog parser service
+getInstructions = Get the instructions page
+parseBlog = Parse the specified blog

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/UrlEncodedFormResource.properties
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/UrlEncodedFormResource.properties
 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/UrlEncodedFormResource.properties
new file mode 100644
index 0000000..c7015c3
--- /dev/null
+++ 
b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/UrlEncodedFormResource.properties
@@ -0,0 +1,22 @@
+# 
***************************************************************************************************************************
+# * 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. 
                                             *
+# 
***************************************************************************************************************************
+
+#--------------------------------------------------------------------------------
+# UrlEncodedFormResource labels
+#--------------------------------------------------------------------------------
+title = URL-Encoded Form Post Example
+description = Shows how URL-Encoded form input can be loaded into POJOs.  POJO 
is simply echoed back.
+aString = A String:
+aNumber = A Number:
+aDate = A Date:
+submit = submit
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java
 
b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java
new file mode 100644
index 0000000..d504ee6
--- /dev/null
+++ 
b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java
@@ -0,0 +1,231 @@
+// 
***************************************************************************************************************************
+// * 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.examples.rest;
+
+import static org.apache.juneau.examples.rest.TestUtils.*;
+import static org.junit.Assert.*;
+
+import java.util.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.examples.addressbook.*;
+import org.apache.juneau.html.*;
+import org.apache.juneau.internal.*;
+import org.apache.juneau.json.*;
+import org.apache.juneau.rest.client.*;
+import org.apache.juneau.transforms.*;
+import org.apache.juneau.xml.*;
+import org.junit.*;
+
+@SuppressWarnings({"serial"})
+public class AddressBookResourceTest {
+
+       private static boolean debug = false;
+
+       static RestClient[] clients;
+
+       @BeforeClass
+       public static void beforeClass() throws Exception {
+               clients = new RestClient[] {
+                       new SamplesRestClient(JsonSerializer.class, 
JsonParser.class),
+                       new SamplesRestClient(XmlSerializer.class, 
XmlParser.class),
+                       new SamplesRestClient(HtmlSerializer.class, 
HtmlParser.class).setAccept("text/html+stripped"),
+                       new SamplesRestClient(XmlSerializer.class,  
HtmlParser.class).setAccept("text/html+stripped")
+               };
+               for (RestClient c : clients) {
+                       
c.getSerializer().addPojoSwaps(CalendarSwap.DateMedium.class);
+                       
c.getParser().addPojoSwaps(CalendarSwap.DateMedium.class);
+                       
c.getSerializer().setProperty(XmlSerializerContext.XML_autoDetectNamespaces, 
true);
+               }
+       }
+
+       @AfterClass
+       public static void afterClass() {
+               for (RestClient c : clients) {
+                       c.closeQuietly();
+               }
+       }
+
+       
//====================================================================================================
+       // Get AddressBookResource as JSON
+       
//====================================================================================================
+       @Test
+       public void testBasic() throws Exception {
+               String in = 
IOUtils.read(getClass().getResourceAsStream("/org/apache/juneau/server/test/AddressBookResource_test0Test.json"));
+               JsonParser p = new 
JsonParser().addPojoSwaps(CalendarSwap.DateMedium.class);
+               Person person = p.parse(in, Person.class);
+               if (debug) System.err.println(person);
+       }
+
+       // A list of People objects.
+       public static class PersonList extends LinkedList<Person> {}
+
+       
//====================================================================================================
+       // PojoRest tests
+       
//====================================================================================================
+       @Test
+       public void testPojoRest() throws Exception {
+               for (RestClient client : clients) {
+                       int rc;
+                       Person p;
+                       List<Person> people;
+
+                       // Reinitialize the resource
+                       rc = client.doGet("/addressBook?method=init").run();
+                       assertEquals(200, rc);
+
+                       // Simple GETs
+                       people = 
client.doGet("/addressBook/people").getResponse(PersonList.class);
+                       assertEquals("Barack Obama", people.get(0).name);
+                       assertEquals(76638, people.get(1).addresses.get(0).zip);
+
+                       // PUT a simple String field
+                       p = people.get(0);
+                       rc = client.doPut(p.uri+"/name", "foo").run();
+                       assertEquals(200, rc);
+                       String name = 
client.doGet(p.uri+"/name").getResponse(String.class);
+                       assertEquals("foo", name);
+                       p = client.doGet(p.uri).getResponse(Person.class);
+                       assertEquals("foo", p.name);
+
+                       // POST an address as JSON
+                       CreateAddress ca = new 
CreateAddress("a1","b1","c1",1,false);
+                       Address a = client.doPost(p.uri + "/addresses", new 
ObjectMap(BeanContext.DEFAULT.createSession().toBeanMap(ca))).getResponse(Address.class);
+                       assertEquals("a1", a.street);
+                       a = client.doGet(a.uri).getResponse(Address.class);
+                       assertEquals("a1", a.street);
+                       assertEquals(1, a.zip);
+                       assertFalse(a.isCurrent);
+
+                       // POST an address as a bean
+                       ca = new CreateAddress("a2","b2","c2",2,true);
+                       a = client.doPost(p.uri + "/addresses", 
ca).getResponse(Address.class);
+                       assertEquals("a2", a.street);
+                       a = client.doGet(a.uri).getResponse(Address.class);
+                       assertEquals("a2", a.street);
+                       assertEquals(2, a.zip);
+                       assertTrue(a.isCurrent);
+
+                       // POST a person
+                       CreatePerson billClinton = new CreatePerson("Bill 
Clinton", AddressBook.toCalendar("Aug 19, 1946"),
+                               new CreateAddress("a3","b3","c3",3,false)
+                       );
+                       rc = client.doPost("/addressBook/people", 
billClinton).run();
+                       assertEquals(200, rc);
+                       people = 
client.doGet("/addressBook/people").getResponse(PersonList.class);
+                       p = people.get(2);
+                       assertEquals(3, people.size());
+                       assertEquals("Bill Clinton", p.name);
+
+                       // DELETE an address
+                       rc = client.doDelete(p.addresses.get(0).uri).run();
+                       assertEquals(200, rc);
+                       people = 
client.doGet("/addressBook/people").getResponse(PersonList.class);
+                       p = people.get(2);
+                       assertEquals(0, p.addresses.size());
+
+                       // DELETE a person
+                       rc = client.doDelete(p.uri).run();
+                       assertEquals(200, rc);
+                       people = 
client.doGet("/addressBook/people").getResponse(PersonList.class);
+                       assertEquals(2, people.size());
+
+                       // Reinitialize the resource
+                       rc = client.doGet("/addressBook?method=init").run();
+                       assertEquals(200, rc);
+               }
+       }
+
+       
//====================================================================================================
+       // PojoQuery tests
+       
//====================================================================================================
+       @Test
+       public void testPojoQuery() throws Exception {
+
+               for (RestClient client : clients) {
+                       RestCall r;
+                       List<Person> people;
+
+                       // Reinitialize the resource
+                       int rc = client.doGet("/addressBook?method=init").run();
+                       assertEquals(200, rc);
+
+                       r = client.doGet("/addressBook/people?q=(name=B*)");
+                       people = r.getResponse(PersonList.class);
+                       assertEquals(1, people.size());
+                       assertEquals("Barack Obama", people.get(0).name);
+
+                       r = 
client.doGet("/addressBook/people?q=(name='Barack+Obama')");
+                       people = r.getResponse(PersonList.class);
+                       assertEquals(1, people.size());
+                       assertEquals("Barack Obama", people.get(0).name);
+
+                       r = 
client.doGet("/addressBook/people?q=(name='Barack%20Obama')");
+                       people = r.getResponse(PersonList.class);
+                       assertEquals(1, people.size());
+                       assertEquals("Barack Obama", people.get(0).name);
+
+                       r = 
client.doGet("/addressBook/people?v=(name,birthDate)");
+                       people = r.getResponse(PersonList.class);
+                       assertEquals("Barack Obama", people.get(0).name);
+                       assertTrue(people.get(0).getAge() > 10);
+                       assertEquals(0, people.get(0).addresses.size());
+
+                       r = 
client.doGet("/addressBook/people?v=(addresses,birthDate)");
+                       people = r.getResponse(PersonList.class);
+                       assertNull(people.get(0).name);
+                       assertTrue(people.get(0).getAge() > 10);
+                       assertEquals(2, people.get(0).addresses.size());
+
+                       r = client.doGet("/addressBook/people?s=($o(age=d))");
+                       people = r.getResponse(PersonList.class);
+                       assertTrue(people.get(0).getAge() > 10);
+                       r = client.doGet("/addressBook/people?s=(age)");
+                       people = r.getResponse(PersonList.class);
+                       assertTrue(people.get(0).getAge() > 10);
+                       r = client.doGet("/addressBook/people?s=($o(age=a))");
+                       people = r.getResponse(PersonList.class);
+                       assertTrue(people.get(0).getAge() > 10);
+
+                       r = client.doGet("/addressBook/people?p=1&l=1");
+                       people = r.getResponse(PersonList.class);
+                       assertEquals(1, people.size());
+                       assertTrue(people.get(0).getAge() > 10);
+               }
+       }
+
+       
//====================================================================================================
+       // PojoIntrospector tests
+       
//====================================================================================================
+       @Test
+       public void testPojoIntrospector() throws Exception {
+
+               for (RestClient client : clients) {
+
+                       List<Person> people;
+
+                       // Reinitialize the resource
+                       int rc = client.doGet("/addressBook?method=init").run();
+                       assertEquals(200, rc);
+
+                       // Simple GETs
+                       people = 
client.doGet("/addressBook/people").getResponse(PersonList.class);
+                       Person p = people.get(0);
+                       int length = 
client.doGet(p.uri+"/name?invokeMethod=length").getResponse(Integer.class);
+                       assertEquals(12, length);
+
+                       String[] tokens = 
client.doGet(p.uri+"/name?invokeMethod=split(java.lang.String,int)&invokeArgs=['a',3]").getResponse(String[].class);
+                       assertObjectEquals("['B','r','ck Obama']", tokens);
+               }
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/CT_AddressBookResource_test0.json
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/CT_AddressBookResource_test0.json
 
b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/CT_AddressBookResource_test0.json
new file mode 100644
index 0000000..f8cc23f
--- /dev/null
+++ 
b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/CT_AddressBookResource_test0.json
@@ -0,0 +1,26 @@
+// 
***************************************************************************************************************************
+// * 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.                                              *
+// 
***************************************************************************************************************************
+{
+       name: "Bill Clinton", 
+       age: 66, 
+       birthDate: "Aug 19, 1946", 
+       addresses: [
+               {
+                       street: "a3", 
+                       city: "b3", 
+                       state: "c3", 
+                       zip: 3, 
+                       isCurrent: false
+               }
+       ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RootResourcesTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RootResourcesTest.java
 
b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RootResourcesTest.java
new file mode 100644
index 0000000..a0eba19
--- /dev/null
+++ 
b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RootResourcesTest.java
@@ -0,0 +1,147 @@
+// 
***************************************************************************************************************************
+// * 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.examples.rest;
+
+import static org.junit.Assert.*;
+
+import java.net.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.dto.swagger.*;
+import org.apache.juneau.html.*;
+import org.apache.juneau.json.*;
+import org.apache.juneau.rest.client.*;
+import org.apache.juneau.rest.labels.*;
+import org.apache.juneau.xml.*;
+import org.junit.*;
+
+public class RootResourcesTest {
+
+       private static String path = 
URI.create(Constants.getSampleUrl()).getPath();              // 
/jazz/juneau/sample
+       private static boolean debug = false;
+
+       private static RestClient jsonClient;
+
+       @BeforeClass
+       public static void beforeClass() {
+               jsonClient = new SamplesRestClient(JsonSerializer.DEFAULT, 
JsonParser.DEFAULT);
+       }
+
+       @AfterClass
+       public static void afterClass() {
+               jsonClient.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // text/json
+       
//====================================================================================================
+       @Test
+       public void testJson() throws Exception {
+               RestClient client = new 
SamplesRestClient(JsonSerializer.DEFAULT, JsonParser.DEFAULT);
+               RestCall r = client.doGet("");
+               ResourceDescription[] x = 
r.getResponse(ResourceDescription[].class);
+               assertEquals("helloWorld", x[0].getName().getName());
+               assertEquals(path + "/helloWorld", x[0].getName().getHref());
+               assertEquals("Hello World sample resource", 
x[0].getDescription());
+
+               r = jsonClient.doOptions("");
+               ObjectMap x2 = r.getResponse(ObjectMap.class);
+               String s = x2.getObjectMap("info").getString("description");
+               if (debug) System.err.println(s);
+               assertTrue(s, s.startsWith("This is an example"));
+
+               client.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // text/xml
+       
//====================================================================================================
+       @Test
+       public void testXml() throws Exception {
+               RestClient client = new 
SamplesRestClient().setParser(XmlParser.DEFAULT);
+               RestCall r = client.doGet("");
+               ResourceDescription[] x = 
r.getResponse(ResourceDescription[].class);
+               assertEquals("helloWorld", x[0].getName().getName());
+               assertEquals(path + "/helloWorld", x[0].getName().getHref());
+               assertEquals("Hello World sample resource", 
x[0].getDescription());
+
+               r = jsonClient.doOptions("");
+               ObjectMap x2 = r.getResponse(ObjectMap.class);
+               String s = x2.getObjectMap("info").getString("description");
+               if (debug) System.err.println(s);
+               assertTrue(s, s.startsWith("This is an example"));
+
+               client.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // text/html+stripped
+       
//====================================================================================================
+       @Test
+       public void testHtmlStripped() throws Exception {
+               RestClient client = new 
SamplesRestClient().setParser(HtmlParser.DEFAULT).setAccept("text/html+stripped");
+               RestCall r = client.doGet("");
+               ResourceDescription[] x = 
r.getResponse(ResourceDescription[].class);
+               assertEquals("helloWorld", x[0].getName().getName());
+               assertTrue(x[0].getName().getHref().endsWith("/helloWorld"));
+               assertEquals("Hello World sample resource", 
x[0].getDescription());
+
+               r = jsonClient.doOptions("").setHeader("Accept", "text/json");
+               ObjectMap x2 = r.getResponse(ObjectMap.class);
+               String s = x2.getObjectMap("info").getString("description");
+               if (debug) System.err.println(s);
+               assertTrue(s, s.startsWith("This is an example"));
+
+               client.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // /htdoces/styles.css
+       
//====================================================================================================
+       @Test
+       public void testStyleSheet() throws Exception {
+               RestClient client = new 
SamplesRestClient().setAccept("text/css");
+               RestCall r = client.doGet("/style.css");
+               String css = r.getResponseAsString();
+               if (debug) System.err.println(css);
+               assertTrue(css, css.indexOf("table {") != -1);
+
+               client.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // application/json+schema
+       
//====================================================================================================
+       @Test
+       public void testJsonSchema() throws Exception {
+               RestClient client = new 
SamplesRestClient().setParser(JsonParser.DEFAULT).setAccept("text/json+schema");
+               RestCall r = client.doGet("");
+               ObjectMap m = r.getResponse(ObjectMap.class);
+               if (debug) System.err.println(m);
+               
assertEquals("org.apache.juneau.rest.labels.ChildResourceDescriptions<org.apache.juneau.rest.labels.ResourceDescription>",
 m.getString("description"));
+               
assertEquals("org.apache.juneau.rest.labels.ResourceDescription", 
m.getObjectMap("items").getString("description"));
+
+               client.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // OPTIONS page
+       
//====================================================================================================
+       @Test
+       public void testOptionsPage() throws Exception {
+               RestCall r = jsonClient.doOptions("");
+               Swagger o = r.getResponse(Swagger.class);
+               if (debug) System.err.println(o);
+               assertEquals("This is an example of a router resource that is 
used to access other resources.", o.getInfo().getDescription());
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java
 
b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java
new file mode 100644
index 0000000..90e8e7b
--- /dev/null
+++ 
b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java
@@ -0,0 +1,69 @@
+// 
***************************************************************************************************************************
+// * 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.examples.rest;
+
+import static org.junit.Assert.*;
+
+import org.apache.juneau.examples.addressbook.*;
+import org.apache.juneau.json.*;
+import org.apache.juneau.rest.client.*;
+import org.apache.juneau.transforms.*;
+import org.apache.juneau.urlencoding.*;
+import org.apache.juneau.xml.*;
+import org.junit.*;
+
+public class SampleRemoteableServicesResourceTest {
+
+       static RestClient[] clients;
+
+       @BeforeClass
+       public static void beforeClass() throws Exception {
+               clients = new RestClient[] {
+                       new SamplesRestClient(JsonSerializer.class, 
JsonParser.class),
+                       new SamplesRestClient(XmlSerializer.class, 
XmlParser.class),
+//     TODO - broken?          new TestRestClient(HtmlSerializer.class, 
HtmlParser.class).setAccept("text/html+stripped"),
+                       new SamplesRestClient(UonSerializer.class, 
UonParser.class),
+               };
+               for (RestClient c : clients) {
+                       c.addPojoSwaps(CalendarSwap.DateMedium.class);
+                       c.setRemoteableServletUri("/remoteable");
+                       
c.setProperty(XmlSerializerContext.XML_autoDetectNamespaces, true);
+               }
+       }
+
+       @AfterClass
+       public static void afterClass() {
+               for (RestClient c : clients) {
+                       c.closeQuietly();
+               }
+       }
+
+       
//====================================================================================================
+       // Get AddressBookResource as JSON
+       
//====================================================================================================
+       @Test
+       public void testBasic() throws Exception {
+               for (RestClient client : clients) {
+                       IAddressBook ab = 
client.getRemoteableProxy(IAddressBook.class);
+                       Person p = ab.createPerson(
+                               new CreatePerson("Test Person",
+                                       AddressBook.toCalendar("Aug 1, 1999"),
+                                       new CreateAddress("Test street", "Test 
city", "Test state", 12345, true))
+                       );
+                       assertEquals(
+                               "{id:x,name:'Test Person',birthDate:'Aug 1, 
1999',addresses:[{id:x,street:'Test street',city:'Test city',state:'Test 
state',zip:12345,isCurrent:true}],age:x}",
+                               
JsonSerializer.DEFAULT_LAX.toString(p).replaceAll("id:\\d+", 
"id:x").replaceAll("age:\\d+", "age:x"));
+               }
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SamplesRestClient.java
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SamplesRestClient.java
 
b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SamplesRestClient.java
new file mode 100644
index 0000000..13083d7
--- /dev/null
+++ 
b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SamplesRestClient.java
@@ -0,0 +1,69 @@
+// 
***************************************************************************************************************************
+// * 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.examples.rest;
+
+import java.security.*;
+
+import javax.net.ssl.*;
+
+import org.apache.http.conn.ssl.*;
+import org.apache.http.impl.client.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.rest.client.*;
+import org.apache.juneau.serializer.*;
+
+/**
+ * REST client with lenient SSL support and lax redirection strategy.
+ */
+public class SamplesRestClient extends RestClient {
+
+       public SamplesRestClient(Class<? extends Serializer> s, Class<? extends 
Parser> p) throws InstantiationException {
+               super(s,p);
+               setRootUrl(Constants.getSampleUrl());
+       }
+
+       public SamplesRestClient(Serializer s, Parser p) {
+               super(s,p);
+               setRootUrl(Constants.getSampleUrl());
+       }
+
+       public SamplesRestClient() {
+               setRootUrl(Constants.getSampleUrl());
+       }
+
+       public SamplesRestClient(CloseableHttpClient c) {
+               super(c);
+               setRootUrl(Constants.getSampleUrl());
+       }
+
+       public static SSLConnectionSocketFactory getSSLSocketFactory() throws 
Exception {
+               SSLContext sslContext = SSLContext.getInstance("SSL");
+               TrustManager tm = new SimpleX509TrustManager(true);
+               sslContext.init(null, new TrustManager[]{tm}, new 
SecureRandom());
+               return new SSLConnectionSocketFactory(sslContext, new 
NoopHostnameVerifier());
+       }
+
+       @Override /* RestClient */
+       protected CloseableHttpClient createHttpClient() throws Exception {
+               try {
+                       return 
HttpClients.custom().setSSLSocketFactory(getSSLSocketFactory()).setRedirectStrategy(new
 LaxRedirectStrategy()).build();
+               } catch (KeyStoreException e) {
+                       throw new RuntimeException(e);
+               } catch (NoSuchAlgorithmException e) {
+                       throw new RuntimeException(e);
+               } catch (Throwable e) {
+                       e.printStackTrace();
+                       return null;
+               }
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMultiPartFormPostsTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMultiPartFormPostsTest.java
 
b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMultiPartFormPostsTest.java
new file mode 100644
index 0000000..66596ce
--- /dev/null
+++ 
b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMultiPartFormPostsTest.java
@@ -0,0 +1,47 @@
+// 
***************************************************************************************************************************
+// * 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.examples.rest;
+
+import static org.junit.Assert.*;
+
+import java.io.*;
+
+import org.apache.http.*;
+import org.apache.http.entity.mime.*;
+import org.apache.juneau.internal.*;
+import org.apache.juneau.rest.client.*;
+import org.apache.juneau.utils.*;
+import org.junit.*;
+
+public class TestMultiPartFormPostsTest {
+
+       private static String URL = "/tempDir";
+       boolean debug = false;
+
+       
//====================================================================================================
+       // Test that RestClient can handle multi-part form posts.
+       
//====================================================================================================
+       @Test
+       public void testUpload() throws Exception {
+               RestClient client = new SamplesRestClient();
+               File f = FileUtils.createTempFile("testMultiPartFormPosts.txt");
+               IOPipe.create(new StringReader("test!"), new 
FileWriter(f)).closeOut().run();
+               HttpEntity entity = 
MultipartEntityBuilder.create().addBinaryBody(f.getName(), f).build();
+               client.doPost(URL + "/upload", entity);
+
+               String downloaded = client.doGet(URL + '/' + f.getName() + 
"?method=VIEW").getResponseAsString();
+               assertEquals("test!", downloaded);
+
+               client.closeQuietly();
+       }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestUtils.java
----------------------------------------------------------------------
diff --git 
a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestUtils.java
 
b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestUtils.java
new file mode 100644
index 0000000..970cc47
--- /dev/null
+++ 
b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestUtils.java
@@ -0,0 +1,360 @@
+// 
***************************************************************************************************************************
+// * 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.examples.rest;
+
+import static org.apache.juneau.BeanContext.*;
+import static org.apache.juneau.serializer.SerializerContext.*;
+import static org.apache.juneau.xml.XmlSerializerContext.*;
+import static org.junit.Assert.*;
+
+import java.io.*;
+import java.text.*;
+import java.util.*;
+import java.util.regex.*;
+
+import javax.xml.*;
+import javax.xml.parsers.*;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.*;
+import javax.xml.transform.stream.*;
+import javax.xml.validation.*;
+
+import org.apache.juneau.internal.*;
+import org.apache.juneau.json.*;
+import org.apache.juneau.serializer.*;
+import org.apache.juneau.transforms.*;
+import org.apache.juneau.xml.*;
+import org.junit.*;
+import org.w3c.dom.*;
+import org.w3c.dom.bootstrap.*;
+import org.w3c.dom.ls.*;
+import org.xml.sax.*;
+
+public class TestUtils {
+
+       private static JsonSerializer js = new JsonSerializer.Simple()
+               .setProperty(SERIALIZER_trimNullProperties, false);
+
+       private static JsonSerializer jsSorted = new JsonSerializer.Simple()
+               .setProperty(SERIALIZER_sortCollections, true)
+               .setProperty(SERIALIZER_sortMaps, true)
+               .setProperty(SERIALIZER_trimNullProperties, false);
+
+
+       private static JsonSerializer js2 = new JsonSerializer.Simple()
+               .addPojoSwaps(IteratorSwap.class, EnumerationSwap.class);
+
+       private static JsonSerializer js3 = new JsonSerializer.Simple()
+               .addPojoSwaps(IteratorSwap.class, EnumerationSwap.class)
+               .setProperty(BEAN_sortProperties, true);
+
+       /**
+        * Verifies that two objects are equivalent.
+        * Does this by doing a string comparison after converting both to JSON.
+        */
+       public static void assertEqualObjects(Object o1, Object o2) throws 
SerializeException {
+               assertEqualObjects(o1, o2, false);
+       }
+
+       /**
+        * Verifies that two objects are equivalent.
+        * Does this by doing a string comparison after converting both to JSON.
+        * @param sort If <jk>true</jk> sort maps and collections before 
comparison.
+        */
+       public static void assertEqualObjects(Object o1, Object o2, boolean 
sort) throws SerializeException {
+               JsonSerializer s = (sort ? jsSorted : js);
+               String s1 = s.serialize(o1);
+               String s2 = s.serialize(o2);
+               if (s1.equals(s2))
+                       return;
+               throw new ComparisonFailure(null, s1, s2);
+       }
+
+       /**
+        * Validates that the whitespace is correct in the specified XML.
+        */
+       public static void checkXmlWhitespace(String out) throws 
SerializeException {
+               if (out.indexOf('\u0000') != -1) {
+                       for (String s : out.split("\u0000"))
+                               checkXmlWhitespace(s);
+                       return;
+               }
+
+               int indent = -1;
+               Pattern startTag = 
Pattern.compile("^(\\s*)<[^/>]+(\\s+\\S+=['\"]\\S*['\"])*\\s*>$");
+               Pattern endTag = Pattern.compile("^(\\s*)</[^>]+>$");
+               Pattern combinedTag = 
Pattern.compile("^(\\s*)<[^>/]+(\\s+\\S+=['\"]\\S*['\"])*\\s*/>$");
+               Pattern contentOnly = Pattern.compile("^(\\s*)[^\\s\\<]+$");
+               Pattern tagWithContent = 
Pattern.compile("^(\\s*)<[^>]+>.*</[^>]+>$");
+               String[] lines = out.split("\n");
+               try {
+                       for (int i = 0; i < lines.length; i++) {
+                               String line = lines[i];
+                               Matcher m = startTag.matcher(line);
+                               if (m.matches()) {
+                                       indent++;
+                                       if (m.group(1).length() != indent)
+                                               throw new 
SerializeException("Wrong indentation detected on start tag line ''{0}''", i+1);
+                                       continue;
+                               }
+                               m = endTag.matcher(line);
+                               if (m.matches()) {
+                                       if (m.group(1).length() != indent)
+                                               throw new 
SerializeException("Wrong indentation detected on end tag line ''{0}''", i+1);
+                                       indent--;
+                                       continue;
+                               }
+                               m = combinedTag.matcher(line);
+                               if (m.matches()) {
+                                       indent++;
+                                       if (m.group(1).length() != indent)
+                                               throw new 
SerializeException("Wrong indentation detected on combined tag line ''{0}''", 
i+1);
+                                       indent--;
+                                       continue;
+                               }
+                               m = contentOnly.matcher(line);
+                               if (m.matches()) {
+                                       indent++;
+                                       if (m.group(1).length() != indent)
+                                               throw new 
SerializeException("Wrong indentation detected on content-only line ''{0}''", 
i+1);
+                                       indent--;
+                                       continue;
+                               }
+                               m = tagWithContent.matcher(line);
+                               if (m.matches()) {
+                                       indent++;
+                                       if (m.group(1).length() != indent)
+                                               throw new 
SerializeException("Wrong indentation detected on tag-with-content line 
''{0}''", i+1);
+                                       indent--;
+                                       continue;
+                               }
+                               throw new SerializeException("Unmatched 
whitespace line at line number ''{0}''", i+1);
+                       }
+                       if (indent != -1)
+                               throw new SerializeException("Possible 
unmatched tag.  indent=''{0}''", indent);
+               } catch (SerializeException e) {
+                       printLines(lines);
+                       throw e;
+               }
+       }
+
+       private static void printLines(String[] lines) {
+               for (int i = 0; i < lines.length; i++)
+                       System.err.println(String.format("%4s:" + lines[i], 
i+1));
+       }
+
+       /**
+        * Validates that the specified XML conforms to the specified schema.
+        */
+       private static void validateXml(String xml, String xmlSchema) throws 
Exception {
+               // parse an XML document into a DOM tree
+               DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
+               f.setNamespaceAware(true);
+               DocumentBuilder documentBuilder = f.newDocumentBuilder();
+               Document document = documentBuilder.parse(new InputSource(new 
StringReader(xml)));
+
+               // create a SchemaFactory capable of understanding WXS schemas
+               SchemaFactory factory = 
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+               if (xmlSchema.indexOf('\u0000') != -1) {
+
+                       // Break it up into a map of namespaceURI->schema 
document
+                       final Map<String,String> schemas = new 
HashMap<String,String>();
+                       String[] ss = xmlSchema.split("\u0000");
+                       xmlSchema = ss[0];
+                       for (String s : ss) {
+                               Matcher m = pTargetNs.matcher(s);
+                               if (m.find())
+                                       schemas.put(m.group(1), s);
+                       }
+
+                       // Create a custom resolver
+                       factory.setResourceResolver(
+                               new LSResourceResolver() {
+
+                                       @Override /* LSResourceResolver */
+                                       public LSInput resolveResource(String 
type, String namespaceURI, String publicId, String systemId, String baseURI) {
+
+                                               String schema = 
schemas.get(namespaceURI);
+                                               if (schema == null)
+                                                       throw new 
RuntimeException(MessageFormat.format("No schema found for namespaceURI 
''{0}''", namespaceURI));
+
+                                               try {
+                                                       
DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
+                                                       DOMImplementationLS 
domImplementationLS = (DOMImplementationLS)registry.getDOMImplementation("LS 
3.0");
+                                                       LSInput in = 
domImplementationLS.createLSInput();
+                                                       
in.setCharacterStream(new StringReader(schema));
+                                                       
in.setSystemId(systemId);
+                                                       return in;
+
+                                               } catch (Exception e) {
+                                                       throw new 
RuntimeException(e);
+                                               }
+                                       }
+                               }
+                       );
+               }
+
+               Schema schema = factory.newSchema(new StreamSource(new 
StringReader(xmlSchema)));
+
+               // create a Validator instance, which can be used to validate 
an instance document
+               Validator validator = schema.newValidator();
+
+               // validate the DOM tree
+               validator.validate(new DOMSource(document));
+       }
+
+       private static Pattern pTargetNs = 
Pattern.compile("targetNamespace=['\"]([^'\"]+)['\"]");
+
+       public static void validateXml(Object o) throws Exception {
+               validateXml(o, XmlSerializer.DEFAULT_NS_SQ);
+       }
+
+       /**
+        * Test whitespace and generated schema.
+        */
+       public static void validateXml(Object o, XmlSerializer s) throws 
Exception {
+               s = s.clone().setProperty(SERIALIZER_useIndentation, 
true).setProperty(XML_enableNamespaces, 
true).setProperty(XML_addNamespaceUrisToRoot, true);
+               String xml = s.serialize(o);
+
+               String xmlSchema = null;
+               try {
+                       xmlSchema = s.getSchemaSerializer().serialize(o);
+                       TestUtils.checkXmlWhitespace(xml);
+                       TestUtils.checkXmlWhitespace(xmlSchema);
+                       TestUtils.validateXml(xml, xmlSchema);
+               } catch (Exception e) {
+                       System.err.println("---XML---");
+                       System.err.println(xml);
+                       System.err.println("---XMLSchema---");
+                       System.err.println(xmlSchema);
+                       throw e;
+               }
+       }
+
+       public static String readFile(String p) throws Exception {
+               InputStream is = TestUtils.class.getResourceAsStream(p);
+               if (is == null) {
+                       is = new FileInputStream(p);
+               }
+               String e = IOUtils.read(is);
+               e = e.replaceAll("\r", "");
+               return e;
+       }
+
+       final protected static char[] hexArray = 
"0123456789ABCDEF".toCharArray();
+       public static String toHex(byte b) {
+           char[] c = new char[2];
+           int v = b & 0xFF;
+           c[0] = hexArray[v >>> 4];
+           c[1] = hexArray[v & 0x0F];
+           return new String(c);
+       }
+
+       public static void debugOut(Object o) {
+               try {
+                       
System.err.println(StringUtils.decodeHex(JsonSerializer.DEFAULT_LAX.serialize(o)));
+               } catch (SerializeException e) {
+                       e.printStackTrace();
+               }
+       }
+
+       /**
+        * Sort an XML document by element and attribute names.
+        * This method is primarily meant for debugging purposes.
+        */
+       private static final String sortXml(String xml) throws Exception {
+
+               xml = xml.replaceAll("\\w+\\:", "");  // Strip out all 
namespaces.
+
+               DocumentBuilderFactory dbf = 
DocumentBuilderFactory.newInstance();
+               dbf.setIgnoringElementContentWhitespace(true);
+               dbf.setNamespaceAware(false);
+               DocumentBuilder db = dbf.newDocumentBuilder();
+               Document doc = db.parse(new InputSource(new StringReader(xml)));
+
+               DOMSource s = new DOMSource(doc);
+
+               StringWriter sw = new StringWriter();
+               StreamResult sr = new StreamResult(sw);
+               XML_SORT_TRANSFORMER.transform(s, sr);
+               return sw.toString().replace('"', '\'').replace("\r", "");
+       }
+
+       /**
+        * Compares two XML documents for equality.
+        * Namespaces are stripped from each and elements/attributes are 
ordered in alphabetical order,
+        *      then a simple string comparison is performed.
+        */
+       public static final void assertXmlEquals(String expected, String 
actual) throws Exception {
+               assertEquals(sortXml(expected), sortXml(actual));
+       }
+
+       private static Transformer XML_SORT_TRANSFORMER;
+       static {
+               try {
+                       String xsl = ""
+                               + "     <xsl:stylesheet version='1.0'"
+                               + "      
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>"
+                               + "      <xsl:output omit-xml-declaration='yes' 
indent='yes'/>"
+                               + "      <xsl:strip-space elements='*'/>"
+                               + "      <xsl:template match='node()|@*'>"
+                               + "       <xsl:copy>"
+                               + "        <xsl:apply-templates select='@*'>"
+                               + "         <xsl:sort select='name()'/>"
+                               + "        </xsl:apply-templates>"
+                               + "        <xsl:apply-templates 
select='node()'>"
+                               + "         <xsl:sort select='name()'/>"
+                               + "         <xsl:sort select='text()'/>"
+                               + "        </xsl:apply-templates>"
+                               + "       </xsl:copy>"
+                               + "      </xsl:template>"
+                               + "     </xsl:stylesheet>";
+                       TransformerFactory tf = 
TransformerFactory.newInstance();
+                       StreamSource ss = new StreamSource(new 
StringReader(xsl));
+                       XML_SORT_TRANSFORMER = tf.newTransformer(ss);
+               } catch (Exception e) {
+                       throw new RuntimeException(e);
+               }
+       }
+
+       /**
+        * Assert that the object equals the specified string after running it 
through JsonSerializer.DEFAULT_LAX.toString().
+        */
+       public static void assertObjectEquals(String s, Object o) {
+               assertObjectEquals(s, o, js2);
+       }
+
+       /**
+        * Assert that the object equals the specified string after running it 
through JsonSerializer.DEFAULT_LAX.toString()
+        * with BEAN_sortProperties set to true.
+        */
+       public static void assertSortedObjectEquals(String s, Object o) {
+               assertObjectEquals(s, o, js3);
+       }
+
+       /**
+        * Assert that the object equals the specified string after running it 
through ws.toString().
+        */
+       public static void assertObjectEquals(String s, Object o, 
WriterSerializer ws) {
+               Assert.assertEquals(s, ws.toString(o));
+       }
+
+       /**
+        * Replaces all newlines with pipes, then compares the strings.
+        */
+       public static void assertTextEquals(String s, Object o) {
+               String s2 = o.toString().replaceAll("\\r?\\n", "|");
+               Assert.assertEquals(s, s2);
+       }
+}

Reply via email to