You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2017/09/02 14:11:30 UTC
[14/51] [partial] incubator-juneau git commit: Add project
hierarchies, part 2.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java
deleted file mode 100644
index b191358..0000000
--- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java
+++ /dev/null
@@ -1,236 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.examples.rest;
-
-import static org.apache.juneau.dto.html5.HtmlBuilder.*;
-import static org.apache.juneau.html.HtmlDocSerializerContext.*;
-
-import java.util.*;
-import java.util.Map;
-
-import org.apache.juneau.dto.html5.*;
-import org.apache.juneau.encoders.*;
-import org.apache.juneau.microservice.*;
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-import org.apache.juneau.rest.annotation.Body;
-import org.apache.juneau.rest.widget.*;
-
-@RestResource(
- path="/systemProperties",
-
- // Title and description that show up on HTML rendition page.
- // Also used in Swagger doc.
- title="System properties resource",
- description="REST interface for performing CRUD operations on system properties.",
-
- htmldoc=@HtmlDoc(
-
- // Widget used for content-type and styles pull-down menus.
- widgets={
- ContentTypeMenuItem.class,
- StyleMenuItem.class
- },
-
- // Links on the HTML rendition page.
- // "request:/..." URIs are relative to the request URI.
- // "servlet:/..." URIs are relative to the servlet URI.
- // "$C{...}" variables are pulled from the config file.
- links={
- "up: request:/..",
- "options: servlet:/?method=OPTIONS",
- "form: servlet:/formPage",
- "$W{ContentTypeMenuItem}",
- "$W{StyleMenuItem}",
- "source: $C{Source/gitHub}/org/apache/juneau/examples/rest/$R{servletClassSimple}.java"
- },
-
- // Custom page text in aside section.
- aside={
- "<div style='max-width:800px' class='text'>",
- " <p>Shows standard GET/PUT/POST/DELETE operations and use of Swagger annotations.</p>",
- "</div>"
- },
-
- // Custom CSS styles applied to HTML view.
- style={
- "aside {display:table-caption} ",
- "aside p {margin: 0px 20px;}"
- }
- ),
-
- // Properties that get applied to all serializers and parsers.
- properties={
- // Use single quotes.
- @Property(name=SERIALIZER_quoteChar, value="'")
- },
-
- // Support GZIP encoding on Accept-Encoding header.
- encoders=GzipEncoder.class,
-
- swagger=@ResourceSwagger(
- contact="{name:'John Smith',email:'john@smith.com'}",
- license="{name:'Apache 2.0',url:'http://www.apache.org/licenses/LICENSE-2.0.html'}",
- version="2.0",
- termsOfService="You're on your own.",
- tags="[{name:'Java',description:'Java utility',externalDocs:{description:'Home page',url:'http://juneau.apache.org'}}]",
- externalDocs="{description:'Home page',url:'http://juneau.apache.org'}"
- )
-)
-public class SystemPropertiesResource extends Resource {
- private static final long serialVersionUID = 1L;
-
- @RestMethod(
- name="GET", path="/",
- summary="Show all system properties",
- description="Returns all system properties defined in the JVM.",
- swagger=@MethodSwagger(
- parameters={
- @Parameter(in="query", name="sort", description="Sort results alphabetically.", _default="false")
- },
- responses={
- @Response(value=200, description="Returns a map of key/value pairs.")
- }
- )
- )
- @SuppressWarnings({"rawtypes", "unchecked"})
- public Map getSystemProperties(@Query("sort") boolean sort) throws Throwable {
- if (sort)
- return new TreeMap(System.getProperties());
- return System.getProperties();
- }
-
- @RestMethod(
- name="GET", path="/{propertyName}",
- summary="Get system property",
- description="Returns the value of the specified system property.",
- swagger=@MethodSwagger(
- parameters={
- @Parameter(in="path", name="propertyName", description="The system property name.")
- },
- responses={
- @Response(value=200, description="The system property value, or null if not found.")
- }
- )
- )
- public String getSystemProperty(@Path String propertyName) throws Throwable {
- return System.getProperty(propertyName);
- }
-
- @RestMethod(
- name="PUT", path="/{propertyName}",
- summary="Replace system property",
- description="Sets a new value for the specified system property.",
- guards=AdminGuard.class,
- swagger=@MethodSwagger(
- parameters={
- @Parameter(in="path", name="propertyName", description="The system property name."),
- @Parameter(in="body", description="The new system property value."),
- },
- responses={
- @Response(value=302,
- headers={
- @Parameter(name="Location", description="The root URL of this resource.")
- }
- ),
- @Response(value=403, description="User is not an admin.")
- }
- )
- )
- public Redirect setSystemProperty(@Path String propertyName, @Body String value) {
- System.setProperty(propertyName, value);
- return new Redirect("servlet:/");
- }
-
- @RestMethod(
- name="POST", path="/",
- summary="Add an entire set of system properties",
- description="Takes in a map of key/value pairs and creates a set of new system properties.",
- guards=AdminGuard.class,
- swagger=@MethodSwagger(
- parameters={
- @Parameter(in="path", name="propertyName", description="The system property key."),
- @Parameter(in="body", description="The new system property values.", schema="{example:{key1:'val1',key2:123}}"),
- },
- responses={
- @Response(value=302,
- headers={
- @Parameter(name="Location", description="The root URL of this resource.")
- }
- ),
- @Response(value=403, description="Unauthorized: User is not an admin.")
- }
- )
- )
- public Redirect setSystemProperties(@Body java.util.Properties newProperties) {
- System.setProperties(newProperties);
- return new Redirect("servlet:/");
- }
-
- @RestMethod(
- name="DELETE", path="/{propertyName}",
- summary="Delete system property",
- description="Deletes the specified system property.",
- guards=AdminGuard.class,
- swagger=@MethodSwagger(
- parameters={
- @Parameter(in="path", name="propertyName", description="The system property name."),
- },
- responses={
- @Response(value=302,
- headers={
- @Parameter(name="Location", description="The root URL of this resource.")
- }
- ),
- @Response(value=403, description="Unauthorized: User is not an admin")
- }
- )
- )
- public Redirect deleteSystemProperty(@Path String propertyName) {
- System.clearProperty(propertyName);
- return new Redirect("servlet:/");
- }
-
- @RestMethod(
- name="GET", path="/formPage",
- summary="Form entry page",
- description="A form post page for setting a single system property value",
- guards=AdminGuard.class,
- htmldoc=@HtmlDoc(
- aside={
- "<div style='max-width:400px' class='text'>",
- " <p>Shows how HTML5 beans can be used to quickly create arbitrary HTML.</p>",
- "</div>"
- },
- style="aside {display:table-cell;}"
- )
- )
- public Form getFormPage() {
- return form().method("POST").action("servlet:/formPagePost").children(
- h4("Set system property"),
- "Name: ", input("text").name("name"), br(),
- "Value: ", input("text").name("value"), br(), br(),
- button("submit","Click me!").style("float:right")
- );
- }
-
- @RestMethod(
- name="POST", path="/formPagePost",
- description="Accepts a simple form post of a system property name/value pair.",
- guards=AdminGuard.class
- )
- public Redirect formPagePost(@FormData("name") String name, @FormData("value") String value) {
- System.setProperty(name, value);
- return new Redirect("servlet:/");
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java
deleted file mode 100644
index 6d164d6..0000000
--- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java
+++ /dev/null
@@ -1,104 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.examples.rest;
-
-import static org.apache.juneau.dto.html5.HtmlBuilder.*;
-
-import java.io.*;
-
-import org.apache.commons.fileupload.*;
-import org.apache.commons.fileupload.servlet.*;
-import org.apache.juneau.dto.html5.*;
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-import org.apache.juneau.rest.widget.*;
-import org.apache.juneau.utils.*;
-
-/**
- * Sample resource that extends {@link DirectoryResource} to open up the temp directory as a REST resource.
- */
-@RestResource(
- path="/tempDir",
- title="Temp Directory View Service",
- description="View and download files in the '$S{java.io.tmpdir}' directory.",
- htmldoc=@HtmlDoc(
- widgets={
- ContentTypeMenuItem.class,
- StyleMenuItem.class
- },
- links={
- "up: request:/..",
- "options: servlet:/?method=OPTIONS",
- "upload: servlet:/upload",
- "$W{ContentTypeMenuItem}",
- "$W{StyleMenuItem}",
- "source: $C{Source/gitHub}/org/apache/juneau/examples/rest/$R{servletClassSimple}.java"
- },
- aside={
- "<div style='max-width:400px' class='text'>",
- " <p>Shows how to use the predefined DirectoryResource class.</p>",
- " <p>Also shows how to use HTML5 beans to create a form entry page.</p>",
- "</div>"
- }
- ),
- properties={
- @Property(name="rootDir", value="$S{java.io.tmpdir}"),
- @Property(name="allowViews", value="true"),
- @Property(name="allowDeletes", value="true"),
- @Property(name="allowPuts", value="false")
- }
-)
-public class TempDirResource extends DirectoryResource {
- private static final long serialVersionUID = 1L;
-
- /**
- * [GET /upload] - Display the form entry page for uploading a file to the temp directory.
- */
- @RestMethod(name="GET", path="/upload")
- public Form getUploadForm() {
- return
- form().id("form").action("servlet:/upload").method("POST").enctype("multipart/form-data")
- .children(
- input().name("contents").type("file"),
- button("submit", "Submit")
- )
- ;
- }
-
- /**
- * [POST /upload] - Upload a file as a multipart form post.
- * Shows how to use the Apache Commons ServletFileUpload class for handling multi-part form posts.
- */
- @RestMethod(name="POST", path="/upload", matchers=TempDirResource.MultipartFormDataMatcher.class)
- public Redirect uploadFile(RestRequest req) throws Exception {
- ServletFileUpload upload = new ServletFileUpload();
- FileItemIterator iter = upload.getItemIterator(req);
- while (iter.hasNext()) {
- FileItemStream item = iter.next();
- if (item.getFieldName().equals("contents")) {
- File f = new File(getRootDir(), item.getName());
- IOPipe.create(item.openStream(), new FileOutputStream(f)).closeOut().run();
- }
- }
- return new Redirect(); // Redirect to the servlet root.
- }
-
- /** Causes a 404 if POST isn't multipart/form-data */
- public static class MultipartFormDataMatcher extends RestMatcher {
- @Override /* RestMatcher */
- public boolean matches(RestRequest req) {
- String contentType = req.getContentType();
- return contentType != null && contentType.startsWith("multipart/form-data");
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java
deleted file mode 100644
index 1fbdca0..0000000
--- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java
+++ /dev/null
@@ -1,94 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.examples.rest;
-
-import org.apache.juneau.*;
-import org.apache.juneau.dto.Link;
-import org.apache.juneau.dto.html5.*;
-import org.apache.juneau.microservice.*;
-import org.apache.juneau.rest.annotation.*;
-import org.apache.juneau.rest.client.*;
-
-@RestResource(
- path="/tumblrParser",
- messages="nls/TumblrParserResource",
- title="Tumblr parser service",
- description="Specify a URL to a Tumblr blog and parse the results.",
- htmldoc=@HtmlDoc(
- links={
- "up: request:/..",
- "options: servlet:/?method=OPTIONS",
- "source: $C{Source/gitHub}/org/apache/juneau/examples/rest/$R{servletClassSimple}.java"
- },
- aside={
- "<div style='min-width:200px' class='text'>",
- " <p>An example of a REST interface that retrieves data from another REST interface.</p>",
- " <p><a class='link' href='$U{servlet:/ibmblr}'>try me</a></p>",
- "</div>"
- }
- )
-)
-public class TumblrParserResource extends Resource {
- private static final long serialVersionUID = 1L;
-
- private static final int MAX_POSTS = 100;
-
- @RestMethod(name="GET", path="/", summary="Get the instructions page")
- public String getInstructions() throws Exception {
- return "Append the Tumblr blog name to the URL above (e.g. /tumblrParser/mytumblrblog)";
- }
-
- @RestMethod(name="GET", path="/{blogName}", summary="Parse the specified blog")
- public ObjectList parseBlog(@Path String blogName) throws Exception {
- ObjectList l = new ObjectList();
- RestClient rc = new RestClientBuilder().build();
- try {
- String site = "http://" + blogName + ".tumblr.com/api/read/json";
- ObjectMap m = rc.doGet(site).getResponse(ObjectMap.class);
- int postsTotal = Math.min(m.getInt("posts-total"), MAX_POSTS);
- for (int i = 0; i < postsTotal; i += 20) {
- m = rc.doGet(site + "?start=" + i + "&num=20&filter=text").getResponse(ObjectMap.class);
- ObjectList ol = m.getObjectList("posts");
- for (int j = 0; j < ol.size(); j++) {
- ObjectMap om = ol.getObjectMap(j);
- String type = om.getString("type");
- Entry e = new Entry();
- e.date = om.getString("date");
- if (type.equals("link"))
- e.entry = new Link(om.getString("link-text"), om.getString("link-url"));
- else if (type.equals("audio"))
- e.entry = new ObjectMap().append("type","audio").append("audio-caption", om.getString("audio-caption"));
- else if (type.equals("video"))
- e.entry = new ObjectMap().append("type","video").append("video-caption", om.getString("video-caption"));
- else if (type.equals("quote"))
- e.entry = new ObjectMap().append("type","quote").append("quote-source", om.getString("quote-source")).append("quote-text", om.getString("quote-text"));
- else if (type.equals("regular"))
- e.entry = om.getString("regular-body");
- else if (type.equals("photo"))
- e.entry = new Img().src(om.getString("photo-url-250"));
- else
- e.entry = new ObjectMap().append("type", type);
- l.add(e);
- }
- }
- } finally {
- rc.closeQuietly();
- }
- return l;
- }
-
- public static class Entry {
- public String date;
- public Object entry;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UrlEncodedFormResource.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UrlEncodedFormResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UrlEncodedFormResource.java
deleted file mode 100644
index a6d98fe..0000000
--- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UrlEncodedFormResource.java
+++ /dev/null
@@ -1,112 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.examples.rest;
-
-import static org.apache.juneau.dto.html5.HtmlBuilder.*;
-
-import java.util.*;
-
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.dto.html5.*;
-import org.apache.juneau.microservice.*;
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-import org.apache.juneau.rest.annotation.Body;
-import org.apache.juneau.rest.widget.*;
-import org.apache.juneau.transforms.*;
-
-/**
- * Sample REST resource for loading URL-Encoded form posts into POJOs.
- */
-@RestResource(
- path="/urlEncodedForm",
- messages="nls/UrlEncodedFormResource",
- title="URL-Encoded form example",
- htmldoc=@HtmlDoc(
- widgets={
- StyleMenuItem.class
- },
- links={
- "up: request:/..",
- "$W{StyleMenuItem}",
- "source: $C{Source/gitHub}/org/apache/juneau/examples/rest/$R{servletClassSimple}.java"
- },
- aside={
- "<div style='min-width:200px' class='text'>",
- " <p>Shows how to process a FORM POST body into a bean using the <code>@Body</code> annotation.</p>",
- " <p>Submitting the form post will simply echo the bean back on the response.</p>",
- "</div>"
- }
- )
-)
-public class UrlEncodedFormResource extends Resource {
- private static final long serialVersionUID = 1L;
-
- /** GET request handler */
- @RestMethod(
- name="GET",
- path="/",
- htmldoc=@HtmlDoc(
- script={
- "// Load results from IFrame into this document.",
- "function loadResults(buff) {",
- " var doc = buff.contentDocument || buff.contentWindow.document;",
- " var buffBody = doc.getElementById('data');",
- " document.getElementById('results').innerHTML = buffBody.innerHTML;",
- "}"
- }
- )
- )
- public Div doGet(RestRequest req) {
- return div(
- form().id("form").action("servlet:/").method("POST").target("buff").children(
- table(
- tr(
- th(req.getMessage("aString")),
- td(input().name("aString").type("text"))
- ),
- tr(
- th(req.getMessage("aNumber")),
- td(input().name("aNumber").type("number"))
- ),
- tr(
- th(req.getMessage("aDate")),
- td(input().name("aDate").type("datetime"), " (ISO8601, e.g. ", code("2001-07-04T15:30:45Z"), " )")
- ),
- tr(
- td().colspan(2).style("text-align:right").children(
- button("submit", req.getMessage("submit"))
- )
- )
- )
- ),
- br(),
- div().id("results"),
- iframe().name("buff").style("display:none").onload("parent.loadResults(this)")
- );
- }
-
- /** POST request handler */
- @RestMethod(name="POST", path="/")
- public Object doPost(@Body FormInputBean input) throws Exception {
- // Just mirror back the request
- return input;
- }
-
- public static class FormInputBean {
- public String aString;
- public int aNumber;
- @BeanProperty(swap=CalendarSwap.ISO8601DT.class)
- public Calendar aDate;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java
deleted file mode 100644
index 5569388..0000000
--- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java
+++ /dev/null
@@ -1,368 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.examples.rest.addressbook;
-
-import static javax.servlet.http.HttpServletResponse.*;
-import static org.apache.juneau.html.HtmlDocSerializerContext.*;
-import static org.apache.juneau.jena.RdfCommonContext.*;
-import static org.apache.juneau.jena.RdfSerializerContext.*;
-import static org.apache.juneau.rest.RestContext.*;
-
-import java.util.*;
-
-import org.apache.juneau.*;
-import org.apache.juneau.dto.*;
-import org.apache.juneau.dto.cognos.*;
-import org.apache.juneau.encoders.*;
-import org.apache.juneau.examples.addressbook.*;
-import org.apache.juneau.examples.rest.*;
-import org.apache.juneau.microservice.*;
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-import org.apache.juneau.rest.converters.*;
-import org.apache.juneau.rest.widget.*;
-import org.apache.juneau.transform.*;
-import org.apache.juneau.utils.*;
-
-/**
- * Proof-of-concept resource that shows off the capabilities of working with POJO resources.
- * <p>
- * Consists of an in-memory address book repository wrapped in a REST API.
- */
-@RestResource(
- path="/addressBook",
- messages="nls/AddressBookResource",
-
- htmldoc=@HtmlDoc(
-
- // Widgets for $W variables.
- widgets={
- PoweredByJuneau.class,
- ContentTypeMenuItem.class,
- QueryMenuItem.class,
- StyleMenuItem.class
- },
-
- // Links on the HTML rendition page.
- // "request:/..." URIs are relative to the request URI.
- // "servlet:/..." URIs are relative to the servlet URI.
- // "$C{...}" variables are pulled from the config file.
- links={
- "up: request:/..",
- "options: servlet:/?method=OPTIONS",
- "$W{ContentTypeMenuItem}",
- "$W{StyleMenuItem}",
- "source: $C{Source/gitHub}/org/apache/juneau/examples/rest/addressbook/$R{servletClassSimple}.java"
- },
-
- // Arbitrary HTML message on the left side of the page.
- aside={
- "<div style='max-width:400px;min-width:200px'>",
- " <p>Proof-of-concept resource that shows off the capabilities of working with POJO resources.</p>",
- " <p>Provides examples of: </p>",
- " <ul>",
- " <li>XML and RDF namespaces",
- " <li>Swagger documentation",
- " <li>Widgets",
- " </ul>",
- "</div>"
- },
-
- // Juneau icon added to footer.
- footer="$W{PoweredByJuneau}"
- ),
-
- // Properties that get applied to all serializers and parsers.
- properties={
-
- // Allow INIT as a method parameter.
- @Property(name=REST_allowMethodParam, value="*"),
-
- // Use single quotes.
- @Property(name=SERIALIZER_quoteChar, value="'"),
-
- // Make RDF/XML readable.
- @Property(name=RDF_rdfxml_tab, value="5"),
-
- // Make RDF parsable by adding a root node.
- @Property(name=RDF_addRootProperty, value="true"),
-
- // Make URIs absolute so that we can easily reference them on the client side.
- @Property(name=SERIALIZER_uriResolution, value="ABSOLUTE"),
-
- // Make the anchor text on URLs be just the path relative to the servlet.
- @Property(name=HTML_uriAnchorText, value="SERVLET_RELATIVE")
- },
-
- // Support GZIP encoding on Accept-Encoding header.
- encoders=GzipEncoder.class,
-
- // Swagger info.
- swagger=@ResourceSwagger(
- contact="{name:'John Smith',email:'john@smith.com'}",
- license="{name:'Apache 2.0',url:'http://www.apache.org/licenses/LICENSE-2.0.html'}",
- version="2.0",
- termsOfService="You're on your own.",
- tags="[{name:'Java',description:'Java utility',externalDocs:{description:'Home page',url:'http://juneau.apache.org'}}]",
- externalDocs="{description:'Home page',url:'http://juneau.apache.org'}"
- )
-)
-public class AddressBookResource extends ResourceJena {
- private static final long serialVersionUID = 1L;
-
- // The in-memory address book
- private AddressBook addressBook;
-
- @Override /* Servlet */
- public void init() {
-
- try {
- // Create the address book
- addressBook = new AddressBook(java.net.URI.create("servlet:/"));
-
- // Initialize it with some contents.
- addressBook.init();
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * [GET /]
- * Get root page.
- */
- @RestMethod(name="GET", path="/")
- public Link[] getRoot() throws Exception {
- return new Link[] {
- new Link("people", "people"),
- new Link("addresses", "addresses")
- };
- }
-
- /**
- * [GET /people/*]
- * Get all people in the address book.
- * Traversable filtering enabled to allow nodes in returned POJO tree to be addressed.
- * Introspectable filtering enabled to allow public methods on the returned object to be invoked.
- */
- @RestMethod(name="GET", path="/people/*",
- converters={Traversable.class,Queryable.class,Introspectable.class},
- htmldoc=@HtmlDoc(
- links={
- "INHERIT", // Inherit links from class.
- "[2]:$W{QueryMenuItem}" // Insert QUERY link in position 2.
- }
- )
- )
- public AddressBook getAllPeople() throws Exception {
- return addressBook;
- }
-
- /**
- * [GET /people/{id}/*]
- * Get a single person by ID.
- * Traversable filtering enabled to allow nodes in returned POJO tree to be addressed.
- * Introspectable filtering enabled to allow public methods on the returned object to be invoked.
- */
- @RestMethod(name="GET", path="/people/{id}/*",
- converters={Traversable.class,Introspectable.class}
- )
- public Person getPerson(@Path int id) throws Exception {
- return findPerson(id);
- }
-
- /**
- * [GET /addresses/*]
- * Get all addresses in the address book.
- */
- @RestMethod(name="GET", path="/addresses/*",
- converters={Traversable.class,Queryable.class},
- htmldoc=@HtmlDoc(
- links={
- "INHERIT", // Inherit links from class.
- "[2]:$W{QueryMenuItem}" // Insert QUERY link in position 2.
- }
- )
- )
- public List<Address> getAllAddresses() throws Exception {
- return addressBook.getAddresses();
- }
-
- /**
- * [GET /addresses/{id}/*]
- * Get a single address by ID.
- */
- @RestMethod(name="GET", path="/addresses/{id}/*",
- converters={Traversable.class}
- )
- public Address getAddress(@Path int id) throws Exception {
- return findAddress(id);
- }
-
- /**
- * [POST /people]
- * Create a new Person bean.
- */
- @RestMethod(name="POST", path="/people",
- guards=AdminGuard.class
- )
- public Redirect createPerson(@Body CreatePerson cp) throws Exception {
- Person p = addressBook.createPerson(cp);
- return new Redirect("people/{0}", p.id);
- }
-
- /**
- * [POST /people/{id}/addresses]
- * Create a new Address bean.
- */
- @RestMethod(name="POST", path="/people/{id}/addresses",
- guards=AdminGuard.class
- )
- public Redirect createAddress(@Path int id, @Body CreateAddress ca) throws Exception {
- Person p = findPerson(id);
- Address a = p.createAddress(ca);
- return new Redirect("addresses/{0}", a.id);
- }
-
- /**
- * [DELETE /people/{id}]
- * Delete a Person bean.
- */
- @RestMethod(name="DELETE", path="/people/{id}",
- guards=AdminGuard.class
- )
- public String deletePerson(@Path int id) throws Exception {
- addressBook.removePerson(id);
- return "DELETE successful";
- }
-
- /**
- * [DELETE /addresses/{id}]
- * Delete an Address bean.
- */
- @RestMethod(name="DELETE", path="/addresses/{id}",
- guards=AdminGuard.class
- )
- public String deleteAddress(@Path int addressId) throws Exception {
- Person p = addressBook.findPersonWithAddress(addressId);
- if (p == null)
- throw new RestException(SC_NOT_FOUND, "Person not found");
- Address a = findAddress(addressId);
- p.addresses.remove(a);
- return "DELETE successful";
- }
-
- /**
- * [PUT /people/{id}/*]
- * Change property on Person bean.
- */
- @RestMethod(name="PUT", path="/people/{id}/*",
- guards=AdminGuard.class
- )
- public String updatePerson(RequestBody body, @Path int id, @PathRemainder String remainder) throws Exception {
- try {
- Person p = findPerson(id);
- PojoRest r = new PojoRest(p);
- ClassMeta<?> cm = r.getClassMeta(remainder);
- Object in = body.asType(cm);
- r.put(remainder, in);
- return "PUT successful";
- } catch (Exception e) {
- throw new RestException(SC_BAD_REQUEST, "PUT unsuccessful").initCause(e);
- }
- }
-
- /**
- * [PUT /addresses/{id}/*]
- * Change property on Address bean.
- */
- @RestMethod(name="PUT", path="/addresses/{id}/*",
- guards=AdminGuard.class
- )
- public String updateAddress(RestRequest req, @Path int id, @PathRemainder String remainder) throws Exception {
- try {
- Address a = findAddress(id);
- PojoRest r = new PojoRest(a);
- ClassMeta<?> cm = r.getClassMeta(remainder);
- Object in = req.getBody().asType(cm);
- r.put(remainder, in);
- return "PUT successful";
- } catch (Exception e) {
- throw new RestException(SC_BAD_REQUEST, "PUT unsuccessful").initCause(e);
- }
- }
-
- /**
- * [INIT /]
- * Reinitialize this resource.
- */
- @RestMethod(name="INIT", path="/",
- guards=AdminGuard.class
- )
- public String doInit() throws Exception {
- init();
- return "OK";
- }
-
- /**
- * [GET /cognos]
- * Get data in Cognos/XML format
- */
- @RestMethod(name="GET", path="/cognos")
- public DataSet getCognosData() throws Exception {
-
- // The Cognos metadata
- Column[] items = {
- new Column("name", "xs:String", 255),
- new Column("age", "xs:int"),
- new Column("numAddresses", "xs:int")
- .addPojoSwap(
- new PojoSwap<Person,Integer>() {
- @Override /* PojoSwap */
- public Integer swap(BeanSession session, Person p) {
- return p.addresses.size();
- }
- }
- )
- };
-
- return new DataSet(items, addressBook, this.getContext().getBeanContext().createSession());
- }
-
- /**
- * [PROXY /*]
- * Return a proxy interface to IAddressBook.
- */
- @RestMethod(name="PROXY", path="/proxy/*")
- public IAddressBook getProxy() {
- return addressBook;
- }
-
- /** Convenience method - Find a person by ID */
- private Person findPerson(int id) throws RestException {
- Person p = addressBook.findPerson(id);
- if (p == null)
- throw new RestException(SC_NOT_FOUND, "Person not found");
- return p;
- }
-
- /** Convenience method - Find an address by ID */
- private Address findAddress(int id) throws RestException {
- Address a = addressBook.findAddress(id);
- if (a == null)
- throw new RestException(SC_NOT_FOUND, "Address not found");
- return a;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/ClientTest.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/ClientTest.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/ClientTest.java
deleted file mode 100644
index 4470f1d..0000000
--- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/ClientTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.examples.rest.addressbook;
-
-import java.text.*;
-import java.util.*;
-
-import org.apache.juneau.examples.addressbook.*;
-import org.apache.juneau.rest.client.*;
-import org.apache.juneau.xml.*;
-
-/**
- * Sample client code for interacting with AddressBookResource
- */
-public class ClientTest {
-
- public static void main(String[] args) {
-
- try {
- System.out.println("Running client test...");
-
- // Create a client to handle XML requests and responses.
- RestClient client = new RestClientBuilder().build();
- RestClient xmlClient = new RestClientBuilder(XmlSerializer.DEFAULT_NS, XmlParser.DEFAULT).build();
- try {
- String root = "http://localhost:10000/addressBook";
-
- // Get the current contents of the address book
- AddressBook ab = client.doGet(root + "/people").getResponse(AddressBook.class);
- System.out.println("Number of entries = " + ab.getPeople().size());
-
- // Same, but use XML as the protocol both ways
- ab = xmlClient.doGet(root + "/people").getResponse(AddressBook.class);
- System.out.println("Number of entries = " + ab.getPeople().size());
-
-
- // Delete the existing entries
- for (Person p : ab.getPeople()) {
- String r = client.doDelete(p.uri).getResponse(String.class);
- System.out.println("Deleted person " + p.name + ", response = " + r);
- }
-
- // Make sure they're gone
- ab = client.doGet(root + "/people").getResponse(AddressBook.class);
- System.out.println("Number of entries = " + ab.getPeople().size());
-
- // Add 1st person again
- CreatePerson cp = new CreatePerson(
- "Barack Obama",
- toCalendar("Aug 4, 1961"),
- new CreateAddress("1600 Pennsylvania Ave", "Washington", "DC", 20500, true),
- new CreateAddress("5046 S Greenwood Ave", "Chicago", "IL", 60615, false)
- );
- Person p = client.doPost(root + "/people", cp).getResponse(Person.class);
- System.out.println("Created person " + p.name + ", uri = " + p.uri);
-
- // Add 2nd person again, but add addresses separately
- cp = new CreatePerson(
- "George Walker Bush",
- toCalendar("Jul 6, 1946")
- );
- p = client.doPost(root + "/people", cp).getResponse(Person.class);
- System.out.println("Created person " + p.name + ", uri = " + p.uri);
-
- // Add addresses to 2nd person
- CreateAddress ca = new CreateAddress("43 Prairie Chapel Rd", "Crawford", "TX", 76638, true);
- Address a = client.doPost(p.uri + "/addresses", ca).getResponse(Address.class);
- System.out.println("Created address " + a.uri);
-
- ca = new CreateAddress("1600 Pennsylvania Ave", "Washington", "DC", 20500, false);
- a = client.doPost(p.uri + "/addresses", ca).getResponse(Address.class);
- System.out.println("Created address " + a.uri);
-
- // Find 1st person, and change name
- Person[] pp = client.doGet(root + "/people?q=(name='Barack+Obama')").getResponse(Person[].class);
- String r = client.doPut(pp[0].uri + "/name", "Barack Hussein Obama").getResponse(String.class);
- System.out.println("Changed name, response = " + r);
- p = client.doGet(pp[0].uri).getResponse(Person.class);
- System.out.println("New name = " + p.name);
- } finally {
- client.closeQuietly();
- xmlClient.closeQuietly();
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- // Utility method
- public static Calendar toCalendar(String birthDate) throws Exception {
- Calendar c = new GregorianCalendar();
- c.setTime(DateFormat.getDateInstance(DateFormat.MEDIUM).parse(birthDate));
- return c;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/resources/examples.cfg
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/resources/examples.cfg b/juneau-examples-rest/src/main/resources/examples.cfg
deleted file mode 100755
index 5c429a7..0000000
--- a/juneau-examples-rest/src/main/resources/examples.cfg
+++ /dev/null
@@ -1,147 +0,0 @@
-# ***************************************************************************************************************************
-# * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-# * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-# * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-# * with the License. You may obtain a copy of the License at *
-# * *
-# * http://www.apache.org/licenses/LICENSE-2.0 *
-# * *
-# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-# * specific language governing permissions and limitations under the License. *
-# ***************************************************************************************************************************
-
-#================================================================================
-# Basic configuration file for SaaS microservices
-# Subprojects can use this as a starting point.
-#================================================================================
-
-#================================================================================
-# REST settings
-#================================================================================
-[REST]
-
-port = 10000
-
-# Authentication: NONE, BASIC.
-authType = NONE
-
-# The BASIC auth username, password, and realm
-loginUser =
-loginPassword =
-authRealm =
-
-# Stylesheet to use for HTML views.
-# The default options are:
-# - styles/juneau.css
-# - styles/devops.css
-# Other stylesheets can be referenced relative to the servlet package or working
-# directory.
-stylesheet = styles/devops.css
-
-# What to do when the config file is saved.
-# Possible values:
-# NOTHING - Don't do anything.
-# RESTART_SERVER - Restart the Jetty server.
-# RESTART_SERVICE - Shutdown and exit with code '3'.
-saveConfigAction = RESTART_SERVER
-
-# Enable SSL support.
-useSsl = false
-
-#================================================================================
-# Bean properties on the org.eclipse.jetty.util.ssl.SslSocketFactory class
-#--------------------------------------------------------------------------------
-# Ignored if REST/useSsl is false.
-# Specify any of the following fields:
-# allowRenegotiate (boolean)
-# certAlias (String)
-# crlPath (String)
-# enableCRLDP (boolean)
-# enableOCSP (boolean)
-# excludeCipherSuites (String[])
-# excludeProtocols (String[])
-# includeCipherSuites (String[])
-# includeProtocols (String...)
-# keyManagerPassword (String)
-# keyStore (String)
-# keyStorePassword (String)
-# keyStorePath (String)
-# keyStoreProvider (String)
-# keyStoreType (String)
-# maxCertPathLength (int)
-# needClientAuth (boolean)
-# ocspResponderURL (String)
-# protocol (String)
-# provider (String)
-# secureRandomAlgorithm (String)
-# sessionCachingEnabled (boolean)
-# sslKeyManagerFactoryAlgorithm (String)
-# sslSessionCacheSize (int)
-# sslSessionTimeout (int)
-# trustAll (boolean)
-# trustManagerFactoryAlgorithm (String)
-# trustStore (String)
-# trustStorePassword (String)
-# trustStoreProvider (String)
-# trustStoreType (String)
-# validateCerts (boolean)
-# validatePeerCerts (boolean)
-# wantClientAuth (boolean)
-#================================================================================
-[REST-SslContextFactory]
-keyStorePath = client_keystore.jks
-keyStorePassword* = {HRAaRQoT}
-excludeCipherSuites = TLS_DHE.*, TLS_EDH.*
-excludeProtocols = SSLv3
-allowRenegotiate = false
-
-#================================================================================
-# Logger settings
-# See FileHandler Java class for details.
-#================================================================================
-[Logging]
-logDir = logs
-logFile = sample.%g.log
-dateFormat = yyyy.MM.dd hh:mm:ss
-format = [{date} {level}] {msg}%n
-append = false
-limit = 10M
-count = 5
-levels = { org.apache.juneau:'INFO' }
-useStackTraceHashes = true
-consoleLevel = WARNING
-
-#================================================================================
-# System properties
-#--------------------------------------------------------------------------------
-# These are arbitrary system properties that can be set during startup.
-#================================================================================
-[SystemProperties]
-
-# Configure Jetty for StdErrLog Logging
-org.eclipse.jetty.util.log.class = org.eclipse.jetty.util.log.StrErrLog
-
-# Jetty logging level
-org.eclipse.jetty.LEVEL = WARN
-
-#================================================================================
-# DockerRegistryResource properties
-#================================================================================
-[DockerRegistry]
-url = http://docker.apache.org:5000/v1
-
-#================================================================================
-# SqlQueryResource properties
-#================================================================================
-[SqlQueryResource]
-driver = org.apache.derby.jdbc.EmbeddedDriver
-connectionUrl = jdbc:derby:C:/testDB;create=true
-allowTempUpdates = true
-includeRowNums = true
-
-#================================================================================
-# Source code location
-#================================================================================
-[Source]
-gitHub = https://github.com/apache/incubator-juneau/blob/master/juneau-examples-rest/src/main/java
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/PetStore.json
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/PetStore.json b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/PetStore.json
deleted file mode 100644
index 4e523f3..0000000
--- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/PetStore.json
+++ /dev/null
@@ -1,21 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-{
- 101: {kind:'CAT',name:'Mr. Frisky',price:39.99,breed:'Persian',getsAlongWith:['CAT','FISH','RABBIT'],birthDate:'2012-07-04'},
- 102: {kind:'DOG',name:'Kibbles',price:99.99,breed:'Husky',getsAlongWith:['DOG','BIRD','FISH','MOUSE','RABBIT'],birthDate:'2014-09-01'},
- 103: {kind:'RABBIT',name:'Hoppy',price:49.99,breed:'Angora',getsAlongWith:['DOG','BIRD','FISH','MOUSE'],birthDate:'2017-04-16'},
- 104: {kind:'RABBIT',name:'Hoppy 2',price:49.99,breed:'Angora',getsAlongWith:['DOG','BIRD','FISH','MOUSE'],birthDate:'2017-04-17'},
- 105: {kind:'FISH',name:'Gorton',price:1.99,breed:'Gold',getsAlongWith:['FISH'],birthDate:'2017-06-20'},
- 106: {kind:'MOUSE',name:'Hackwrench',price:4.99,breed:'Gadget',getsAlongWith:['FISH','MOUSE'],birthDate:'2017-06-20'},
- 107: {kind:'SNAKE',name:'Just Snake',price:9.99,breed:'Human',getsAlongWith:['SNAKE'],birthDate:'2017-06-21'}
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/addressbook/nls/AddressBookResource.properties
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/addressbook/nls/AddressBookResource.properties b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/addressbook/nls/AddressBookResource.properties
deleted file mode 100644
index 61aec3e..0000000
--- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/addressbook/nls/AddressBookResource.properties
+++ /dev/null
@@ -1,89 +0,0 @@
-# ***************************************************************************************************************************
-# * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-# * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-# * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-# * with the License. You may obtain a copy of the License at *
-# * *
-# * http://www.apache.org/licenses/LICENSE-2.0 *
-# * *
-# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-# * specific language governing permissions and limitations under the License. *
-# ***************************************************************************************************************************
-
-title = AddressBook sample resource
-description = Proof-of-concept resource that shows off the capabilities of working with POJO resources
-
-getRoot.summary = Get root page
-getRoot.description = Jumping off page for top-level Person and Address beans.
-
-doInit.summary = Reinitialize this resource
-doInit.description = Resets the address book to the original contents.
-doInit.res.200.description = Returns the string "OK"
-
-getAllPeople.summary = Get all people in the address book
-getAllPeople.res.200.description = Returns a serialized List<Person>
-getAllPeople.res.200.examples = {'text/json':"[\n\t{\n\t\turi:'http://hostname/addressBook/person/1',\n\t\taddressBookUri:'http://localhost/addressBook',\n\t\tid:1,\n\t\tname:'John Smith',\n\t\tbirthDate:'Jan 1, 2000',\n\t\taddresses:[\n\t\t\t{\n\t\t\t\turi:'http://localhost/addressBook/addresses/1',\n\t\t\t\tpersonUri:'http://localhost/addressBook/people/1',\n\t\t\t\tid:1,\n\t\t\t\tstreet:'101 Main St',\n\t\t\t\tcity:'Anywhere',\n\t\t\t\tstate:'NY',\n\t\t\t\tzip:12345,\n\t\t\t\tisCurrent:true\n\t\t\t}\n\t\t]\n\t}\n]"}
-
-getPerson.summary = Get a single person by ID
-getPerson.req.path.id.description = Person ID
-getPerson.req.path.id.type = integer
-getPerson.res.200.description = Returns a serialized Person bean
-getPerson.res.200.examples = {'text/json':"{\n\turi:'http://hostname/addressBook/person/1',\n\taddressBookUri:'http://localhost/addressBook',\n\tid:1,\n\tname:'John Smith',\n\tbirthDate:'Jan 1, 2000',\n\taddresses:[\n\t\t{\n\t\t\turi:'http://localhost/addressBook/addresses/1',\n\t\t\tpersonUri:'http://localhost/addressBook/people/1',\n\t\t\tid:1,\n\t\t\tstreet:'101 Main St',\n\t\t\tcity:'Anywhere',\n\t\t\tstate:'NY',\n\t\t\tzip:12345,\n\t\t\tisCurrent:true\n\t\t}\n\t]\n\}"}
-getPerson.res.404.description = Person ID not found
-
-getAllAddresses.summary = Get all addresses in the address book
-getAllAddresses.res.200.description = Returns a serialized List<Address>
-getAllAddresses.res.200.examples = {'text/json':"[\n\t{\n\t\turi:'http://localhost/addressBook/addresses/1',\n\t\tpersonUri:'http://localhost/addressBook/people/1',\n\t\tid:1,\n\t\tstreet:'101 Main St',\n\t\tcity:'Anywhere',\n\t\tstate:'NY',\n\t\tzip:12345,\n\t\tisCurrent:true\n\t}\n]"}
-
-getAddress.summary = Get a single address by ID
-getAddress.req.path.id.description = Address ID
-getAddress.req.path.id.type = integer
-getAddress.res.200.description = Returns a serialized Address bean
-getAddress.res.200.examples = {'text/json':"{\n\turi:'http://localhost/addressBook/addresses/1',\n\tpersonUri:'http://localhost/addressBook/people/1',\n\tid:1,\n\tstreet:'101 Main St',\n\tcity:'Anywhere',\n\tstate:'NY',\n\tzip:12345,\n\tisCurrent:true\n}"}
-getAddress.res.404.description = Address ID not found
-
-createPerson.summary = Create a new Person bean
-createPerson.req.body.description = Serialized CreatePerson bean
-createPerson.req.body.schema = {example:"{\n\tname:'John Smith',\n\tbirthDate:'Jan 1, 2000',\n\taddresses:[\n\t\t{\n\t\t\tstreet:'101 Main St',\n\t\t\tcity:'Anywhere',\n\t\t\tstate:'NY',\n\t\t\tzip:12345,\n\t\t\tisCurrent:true\n\t\t}\n\t]\n\}"}
-createPerson.res.307.header.Location.description = URL of new person
-
-createAddress.summary = Create a new Address bean
-createAddress.req.path.id.description = Person ID
-createAddress.req.path.id.type = integer
-createAddress.req.body.schema = {example:"{\n\tstreet:'101 Main St',\n\tcity:'Anywhere',\n\tstate:'NY',\n\tzip:12345,\n\tisCurrent:true\n}"}
-createAddress.res.307.header.Location.description = URL of new address
-
-deletePerson.summary = Delete a Person bean
-deletePerson.req.path.id.description = Person ID
-deletePerson.req.path.id.type = integer
-deletePerson.res.200.description = Returns the string "DELETE successful"
-deletePerson.res.404.description = Person ID not found
-
-deleteAddress.summary = Delete an Address bean
-deleteAddress.req.path.id.description = Address ID
-deleteAddress.res.200.description = Returns the string "DELETE successful"
-deleteAddress.res.404.description = Address ID not found
-
-updatePerson.summary = Change property on Person bean
-updatePerson.req.path.id.description = Person ID
-updatePerson.req.path.id.type = integer
-updatePerson.req.body.description = Any object matching the field
-updatePerson.res.200.description = Returns the string "PUT successful"
-updatePerson.res.400.description = Invalid object type used
-updatePerson.res.404.description = Person ID not found
-
-updateAddress.summary = Change property on Address bean
-updateAddress.req.path.id.description = Address ID
-updateAddress.req.path.id.type = integer
-updateAddress.req.body.description = Any object matching the field
-updateAddress.res.200.description = Returns the string "PUT successful"
-updateAddress.res.400.description = Invalid object type used
-updateAddress.res.404.description = Address ID not found
-
-getOptions.summary = View resource options
-
-getCognosData.summary = Get data in Cognos/XML format
-getCognosData.res.200.description = Returns a serialized DataSet
-
-otherNotes = GZip support enabled. Public methods can be invoked by using the &Method URL parameter. 'text/cognos+xml' support available under root resource only
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/averycutecat.jpg
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/averycutecat.jpg b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/averycutecat.jpg
deleted file mode 100644
index 9760674..0000000
Binary files a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/averycutecat.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/bird.png
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/bird.png b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/bird.png
deleted file mode 100644
index 636ecf8..0000000
Binary files a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/bird.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/cat.png
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/cat.png b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/cat.png
deleted file mode 100644
index 917abc6..0000000
Binary files a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/cat.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/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
deleted file mode 100644
index a016a6c..0000000
--- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/code-highlighting.css
+++ /dev/null
@@ -1,136 +0,0 @@
-/***************************************************************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations under the License. *
- ***************************************************************************************************************************/
-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/ab15d45b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/dog.png
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/dog.png b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/dog.png
deleted file mode 100644
index e100eb2..0000000
Binary files a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/dog.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/fish.png
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/fish.png b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/fish.png
deleted file mode 100644
index ca76a46..0000000
Binary files a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/fish.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/mouse.png
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/mouse.png b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/mouse.png
deleted file mode 100644
index 5308006..0000000
Binary files a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/mouse.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/ok.png
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/ok.png b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/ok.png
deleted file mode 100644
index 31d84f7..0000000
Binary files a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/ok.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/rabbit.png
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/rabbit.png b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/rabbit.png
deleted file mode 100644
index f013470..0000000
Binary files a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/rabbit.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/severe.png
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/severe.png b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/severe.png
deleted file mode 100644
index 7b71e14..0000000
Binary files a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/severe.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/snake.png
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/snake.png b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/snake.png
deleted file mode 100644
index 7f17660..0000000
Binary files a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/snake.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/warning.png
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/warning.png b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/warning.png
deleted file mode 100644
index 7a8ab49..0000000
Binary files a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/htdocs/warning.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/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
deleted file mode 100644
index be0bcf1..0000000
--- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/MethodExampleResource.properties
+++ /dev/null
@@ -1,37 +0,0 @@
-# ***************************************************************************************************************************
-# * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-# * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-# * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-# * with the License. You may obtain a copy of the License at *
-# * *
-# * http://www.apache.org/licenses/LICENSE-2.0 *
-# * *
-# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-# * specific language governing permissions and limitations under the License. *
-# ***************************************************************************************************************************
-
-#--------------------------------------------------------------------------------
-# 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/ab15d45b/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
deleted file mode 100644
index 22575ae..0000000
--- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/UrlEncodedFormResource.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-# ***************************************************************************************************************************
-# * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-# * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-# * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-# * with the License. You may obtain a copy of the License at *
-# * *
-# * http://www.apache.org/licenses/LICENSE-2.0 *
-# * *
-# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-# * specific language governing permissions and limitations under the License. *
-# ***************************************************************************************************************************
-
-#--------------------------------------------------------------------------------
-# UrlEncodedFormResource labels
-#--------------------------------------------------------------------------------
-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/ab15d45b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/resources/DockerRegistryResourceAside_en.html
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/resources/DockerRegistryResourceAside_en.html b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/resources/DockerRegistryResourceAside_en.html
deleted file mode 100644
index 395eea2..0000000
--- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/resources/DockerRegistryResourceAside_en.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!--
- ***************************************************************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- *
- ***************************************************************************************************************************
- -->
-<div style='min-width:200px' class='text'>
- <p>REST API for searching Docker registries.</p>
- <p>To use, you must first specify the Docker registry URL in the <code>[Docker]</code> section of the config file.</p>
-</div>