This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 86f47d4 Update Javadocs.
86f47d4 is described below
commit 86f47d474e87aae04d505596a9b6a9f3b352e5dc
Author: JamesBognar <[email protected]>
AuthorDate: Sun Mar 4 17:22:48 2018 -0500
Update Javadocs.
---
...amples.AddressBookResource.Introspectable.1.png | Bin 21714 -> 0 bytes
.../Samples.AddressBookResource.Options.png | Bin 1029216 -> 0 bytes
.../Samples.AddressBookResource.Queryable.1.png | Bin 43970 -> 0 bytes
.../Samples.AddressBookResource.Queryable.2.png | Bin 35177 -> 0 bytes
.../Samples.AddressBookResource.Queryable.3.png | Bin 35137 -> 0 bytes
.../Samples.AddressBookResource.Traversable.1.png | Bin 28868 -> 0 bytes
.../Samples.AddressBookResource.Traversable.2.png | Bin 20464 -> 0 bytes
.../doc-files/Samples.AtomFeedResource.1.png | Bin 45184 -> 0 bytes
.../doc-files/Samples.AtomFeedResource.2.png | Bin 78940 -> 0 bytes
.../doc-files/Samples.AtomFeedResource.3.png | Bin 28698 -> 0 bytes
.../javadoc/doc-files/Samples.ConfigResource.1.png | Bin 38071 -> 0 bytes
.../javadoc/doc-files/Samples.ConfigResource.3.png | Bin 41856 -> 0 bytes
.../doc-files/Samples.DockerRegistryResource.1.png | Bin 16230 -> 0 bytes
.../doc-files/Samples.DockerRegistryResource.2.png | Bin 23808 -> 0 bytes
.../doc-files/Samples.JsonSchemaResource.1.png | Bin 36315 -> 0 bytes
.../doc-files/Samples.JsonSchemaResource.2.png | Bin 28837 -> 0 bytes
.../javadoc/doc-files/Samples.LogsResource.1.png | Bin 37594 -> 0 bytes
.../javadoc/doc-files/Samples.LogsResource.2.png | Bin 42497 -> 0 bytes
.../javadoc/doc-files/Samples.LogsResource.3.png | Bin 56603 -> 0 bytes
.../javadoc/doc-files/Samples.PhotosResource.1.png | Bin 16442 -> 0 bytes
.../javadoc/doc-files/Samples.PhotosResource.2.png | Bin 71952 -> 0 bytes
.../Samples.RequestEchoResource.1.htmlschema.png | Bin 35501 -> 0 bytes
.../Samples.RequestEchoResource.1.json.png | Bin 30092 -> 0 bytes
.../Samples.RequestEchoResource.1.jsonschema.png | Bin 31731 -> 0 bytes
.../Samples.RequestEchoResource.1.jsonsimple.png | Bin 29302 -> 0 bytes
.../Samples.RequestEchoResource.1.uon.png | Bin 64778 -> 0 bytes
.../Samples.RequestEchoResource.1.urlencoding.png | Bin 71054 -> 0 bytes
.../Samples.RequestEchoResource.1.xml.png | Bin 43989 -> 0 bytes
.../Samples.RequestEchoResource.1.xmlschema.png | Bin 47951 -> 0 bytes
.../doc-files/Samples.RequestEchoResource.2.png | Bin 30872 -> 0 bytes
.../doc-files/Samples.RequestEchoResource.3.png | Bin 27501 -> 0 bytes
.../doc-files/Samples.RequestEchoResource.4.png | Bin 22149 -> 0 bytes
.../Samples.SampleRemoteableServlet.1.png | Bin 23969 -> 0 bytes
.../Samples.SampleRemoteableServlet.2.png | Bin 29986 -> 0 bytes
.../Samples.SampleRemoteableServlet.3.png | Bin 45596 -> 0 bytes
.../doc-files/Samples.SqlQueryResource.1.png | Bin 16113 -> 0 bytes
.../doc-files/Samples.SqlQueryResource.2.png | Bin 40356 -> 0 bytes
.../doc-files/Samples.TempDirResource.1.png | Bin 32843 -> 0 bytes
.../doc-files/Samples.TempDirResource.2.png | Bin 20359 -> 0 bytes
.../doc-files/Samples.TumblrParserResource.1.png | Bin 168439 -> 0 bytes
...s-rest.AddressBookResource.Introspectable.1.png | Bin 0 -> 101415 bytes
...amples-rest.AddressBookResource.Queryable.1.png | Bin 0 -> 239791 bytes
...amples-rest.AddressBookResource.Queryable.2.png | Bin 0 -> 139301 bytes
...amples-rest.AddressBookResource.Queryable.3.png | Bin 0 -> 137284 bytes
...ples-rest.AddressBookResource.Traversable.1.png | Bin 0 -> 138594 bytes
...ples-rest.AddressBookResource.Traversable.2.png | Bin 0 -> 105450 bytes
.../juneau-examples-rest.AtomFeedResource.1.png | Bin 0 -> 176439 bytes
.../juneau-examples-rest.AtomFeedResource.2.png | Bin 0 -> 266611 bytes
.../juneau-examples-rest.AtomFeedResource.3.png | Bin 0 -> 147615 bytes
...neau-examples-rest.DockerRegistryResource.1.png | Bin 0 -> 90236 bytes
.../juneau-examples-rest.JsonSchemaResource.1.png | Bin 0 -> 172354 bytes
.../juneau-examples-rest.JsonSchemaResource.2.png | Bin 0 -> 110715 bytes
.../juneau-examples-rest.LogsResource.1.png | Bin 0 -> 206285 bytes
.../juneau-examples-rest.PhotosResource.1.png | Bin 0 -> 108693 bytes
.../juneau-examples-rest.PhotosResource.2.png | Bin 0 -> 3006830 bytes
.../juneau-examples-rest.SqlQueryResource.1.png | Bin 0 -> 99530 bytes
.../juneau-examples-rest.SqlQueryResource.2.png | Bin 0 -> 246365 bytes
.../juneau-examples-rest.TempDirResource.1.png | Bin 0 -> 163742 bytes
.../juneau-examples-rest.TempDirResource.2.png | Bin 0 -> 92437 bytes
.../juneau-examples-rest.TempDirResource.3.png | Bin 0 -> 193078 bytes
...juneau-examples-rest.TumblrParserResource.1.png | Bin 0 -> 201475 bytes
juneau-doc/src/main/javadoc/overview.html | 883 +++++++++++----------
juneau-examples/juneau-examples-rest/examples.cfg | 7 +
.../juneau/examples/rest/AtomFeedResource.java | 1 -
.../examples/rest/SampleRemoteableServlet.java | 12 +-
.../juneau/examples/rest/SqlQueryResource.java | 2 +-
.../juneau/examples/rest/TempDirResource.java | 21 +-
.../examples/rest/TestMultiPartFormPostsTest.java | 4 +-
.../juneau/rest/response/DefaultHandler.java | 7 +-
69 files changed, 507 insertions(+), 430 deletions(-)
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Introspectable.1.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Introspectable.1.png
deleted file mode 100644
index b6a7ca6..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Introspectable.1.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Options.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Options.png
deleted file mode 100644
index 8b87cb3..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Options.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Queryable.1.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Queryable.1.png
deleted file mode 100644
index 8072bb0..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Queryable.1.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Queryable.2.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Queryable.2.png
deleted file mode 100644
index 5dfe9ac..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Queryable.2.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Queryable.3.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Queryable.3.png
deleted file mode 100644
index f6ec90a..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Queryable.3.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Traversable.1.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Traversable.1.png
deleted file mode 100644
index 324bc9e..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Traversable.1.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Traversable.2.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Traversable.2.png
deleted file mode 100644
index cb36527..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.AddressBookResource.Traversable.2.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.AtomFeedResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.AtomFeedResource.1.png
deleted file mode 100644
index b4918ad..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.AtomFeedResource.1.png and
/dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.AtomFeedResource.2.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.AtomFeedResource.2.png
deleted file mode 100644
index 9f7007b..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.AtomFeedResource.2.png and
/dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.AtomFeedResource.3.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.AtomFeedResource.3.png
deleted file mode 100644
index 9e9226e..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.AtomFeedResource.3.png and
/dev/null differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/Samples.ConfigResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.ConfigResource.1.png
deleted file mode 100644
index cdcbbe7..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.ConfigResource.1.png and
/dev/null differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/Samples.ConfigResource.3.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.ConfigResource.3.png
deleted file mode 100644
index 8e9a3d9..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.ConfigResource.3.png and
/dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.DockerRegistryResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.DockerRegistryResource.1.png
deleted file mode 100644
index 2db968b..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.DockerRegistryResource.1.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.DockerRegistryResource.2.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.DockerRegistryResource.2.png
deleted file mode 100644
index f40f603..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.DockerRegistryResource.2.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.JsonSchemaResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.JsonSchemaResource.1.png
deleted file mode 100644
index 23d69da..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.JsonSchemaResource.1.png and
/dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.JsonSchemaResource.2.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.JsonSchemaResource.2.png
deleted file mode 100644
index 02c15c6..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.JsonSchemaResource.2.png and
/dev/null differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/Samples.LogsResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.LogsResource.1.png
deleted file mode 100644
index 6cc890a..0000000
Binary files a/juneau-doc/src/main/javadoc/doc-files/Samples.LogsResource.1.png
and /dev/null differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/Samples.LogsResource.2.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.LogsResource.2.png
deleted file mode 100644
index 49c74a0..0000000
Binary files a/juneau-doc/src/main/javadoc/doc-files/Samples.LogsResource.2.png
and /dev/null differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/Samples.LogsResource.3.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.LogsResource.3.png
deleted file mode 100644
index 51594d8..0000000
Binary files a/juneau-doc/src/main/javadoc/doc-files/Samples.LogsResource.3.png
and /dev/null differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/Samples.PhotosResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.PhotosResource.1.png
deleted file mode 100644
index a050101..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.PhotosResource.1.png and
/dev/null differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/Samples.PhotosResource.2.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.PhotosResource.2.png
deleted file mode 100644
index fe472a8..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.PhotosResource.2.png and
/dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.htmlschema.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.htmlschema.png
deleted file mode 100644
index 0e822c0..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.htmlschema.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.json.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.json.png
deleted file mode 100644
index 67bc6b8..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.json.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.jsonschema.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.jsonschema.png
deleted file mode 100644
index dbd6db3..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.jsonschema.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.jsonsimple.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.jsonsimple.png
deleted file mode 100644
index da569c0..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.jsonsimple.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.uon.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.uon.png
deleted file mode 100644
index 4329dc4..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.uon.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.urlencoding.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.urlencoding.png
deleted file mode 100644
index 4982033..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.urlencoding.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.xml.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.xml.png
deleted file mode 100644
index d563523..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.xml.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.xmlschema.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.xmlschema.png
deleted file mode 100644
index 25b3de7..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.1.xmlschema.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.2.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.2.png
deleted file mode 100644
index ffb5b24..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.2.png and
/dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.3.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.3.png
deleted file mode 100644
index 606dad7..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.3.png and
/dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.4.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.4.png
deleted file mode 100644
index 78df80a..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.RequestEchoResource.4.png and
/dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.SampleRemoteableServlet.1.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.SampleRemoteableServlet.1.png
deleted file mode 100644
index 11e8220..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.SampleRemoteableServlet.1.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.SampleRemoteableServlet.2.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.SampleRemoteableServlet.2.png
deleted file mode 100644
index ed6b88c..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.SampleRemoteableServlet.2.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.SampleRemoteableServlet.3.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.SampleRemoteableServlet.3.png
deleted file mode 100644
index 5674912..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.SampleRemoteableServlet.3.png
and /dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.SqlQueryResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.SqlQueryResource.1.png
deleted file mode 100644
index 21e32a6..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.SqlQueryResource.1.png and
/dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.SqlQueryResource.2.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.SqlQueryResource.2.png
deleted file mode 100644
index 206013f..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.SqlQueryResource.2.png and
/dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.TempDirResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.TempDirResource.1.png
deleted file mode 100644
index bd6c854..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.TempDirResource.1.png and
/dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.TempDirResource.2.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.TempDirResource.2.png
deleted file mode 100644
index 0c78b77..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.TempDirResource.2.png and
/dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/Samples.TumblrParserResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/Samples.TumblrParserResource.1.png
deleted file mode 100644
index 9fac852..0000000
Binary files
a/juneau-doc/src/main/javadoc/doc-files/Samples.TumblrParserResource.1.png and
/dev/null differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Introspectable.1.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Introspectable.1.png
new file mode 100644
index 0000000..35c0ca6
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Introspectable.1.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Queryable.1.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Queryable.1.png
new file mode 100644
index 0000000..03598dd
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Queryable.1.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Queryable.2.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Queryable.2.png
new file mode 100644
index 0000000..b35a602
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Queryable.2.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Queryable.3.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Queryable.3.png
new file mode 100644
index 0000000..e2ec795
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Queryable.3.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Traversable.1.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Traversable.1.png
new file mode 100644
index 0000000..cbdde23
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Traversable.1.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Traversable.2.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Traversable.2.png
new file mode 100644
index 0000000..34c930b
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AddressBookResource.Traversable.2.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AtomFeedResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AtomFeedResource.1.png
new file mode 100644
index 0000000..89ad0cb
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AtomFeedResource.1.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AtomFeedResource.2.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AtomFeedResource.2.png
new file mode 100644
index 0000000..3f7ff40
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AtomFeedResource.2.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AtomFeedResource.3.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AtomFeedResource.3.png
new file mode 100644
index 0000000..1c6aebd
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.AtomFeedResource.3.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.DockerRegistryResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.DockerRegistryResource.1.png
new file mode 100644
index 0000000..3937264
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.DockerRegistryResource.1.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.JsonSchemaResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.JsonSchemaResource.1.png
new file mode 100644
index 0000000..e275534
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.JsonSchemaResource.1.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.JsonSchemaResource.2.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.JsonSchemaResource.2.png
new file mode 100644
index 0000000..68c65d3
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.JsonSchemaResource.2.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.LogsResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.LogsResource.1.png
new file mode 100644
index 0000000..f6cea03
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.LogsResource.1.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PhotosResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PhotosResource.1.png
new file mode 100644
index 0000000..e20ac0c
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PhotosResource.1.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PhotosResource.2.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PhotosResource.2.png
new file mode 100644
index 0000000..c6278d5
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PhotosResource.2.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.SqlQueryResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.SqlQueryResource.1.png
new file mode 100644
index 0000000..2e8d95a
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.SqlQueryResource.1.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.SqlQueryResource.2.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.SqlQueryResource.2.png
new file mode 100644
index 0000000..dd1d38b
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.SqlQueryResource.2.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.TempDirResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.TempDirResource.1.png
new file mode 100644
index 0000000..0cdbaca
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.TempDirResource.1.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.TempDirResource.2.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.TempDirResource.2.png
new file mode 100644
index 0000000..42ba0ea
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.TempDirResource.2.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.TempDirResource.3.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.TempDirResource.3.png
new file mode 100644
index 0000000..125edb0
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.TempDirResource.3.png
differ
diff --git
a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.TumblrParserResource.1.png
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.TumblrParserResource.1.png
new file mode 100644
index 0000000..b11b2e4
Binary files /dev/null and
b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.TumblrParserResource.1.png
differ
diff --git a/juneau-doc/src/main/javadoc/overview.html
b/juneau-doc/src/main/javadoc/overview.html
index bc22405..b7a3a71 100644
--- a/juneau-doc/src/main/javadoc/overview.html
+++ b/juneau-doc/src/main/javadoc/overview.html
@@ -14801,9 +14801,15 @@
Because you added the <l>Traversable</l>
converter to the <l>getPerson</l> method, you can also address
child nodes in the POJO model through path
remainders:
</p>
- <img class="bordered"
src="doc-files/Samples.AddressBookResource.Traversable.1.png">
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/addressBook/people/1/addresses/0
+ </p>
+ <img class="bordered"
src="doc-files/juneau-examples-rest.AddressBookResource.Traversable.1.png"
style='width:800px;'>
<br><br>
- <img class="bordered"
src="doc-files/Samples.AddressBookResource.Traversable.2.png">
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/addressBook/people/1/addresses/0/street
+ </p>
+ <img class="bordered"
src="doc-files/juneau-examples-rest.AddressBookResource.Traversable.2.png"
style='width:800px;'>
</div>
<!--
=======================================================================================================
-->
@@ -14816,13 +14822,22 @@
</p>
<h5 class='figure'>Show only the name and addresses
columns</h5>
- <img class="bordered"
src="doc-files/Samples.AddressBookResource.Queryable.1.png">
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/addressBook/people?v=name,addresses
+ </p>
+ <img class="bordered"
src="doc-files/juneau-examples-rest.AddressBookResource.Queryable.1.png"
style='width:800px;'>
<h5 class='figure'>Show only names that start with
'B*'</h5>
- <img class="bordered"
src="doc-files/Samples.AddressBookResource.Queryable.2.png">
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/addressBook/people?s=name=B*
+ </p>
+ <img class="bordered"
src="doc-files/juneau-examples-rest.AddressBookResource.Queryable.2.png"
style='width:800px;'>
<h5 class='figure'>Show only entries with age greater
than 60</h5>
- <img class="bordered"
src="doc-files/Samples.AddressBookResource.Queryable.3.png">
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/addressBook/people?s=age>=60
+ </p>
+ <img class="bordered"
src="doc-files/juneau-examples-rest.AddressBookResource.Queryable.3.png"
style='width:800px;'>
</div>
<!--
=======================================================================================================
-->
@@ -14833,7 +14848,10 @@
The <l>Introspectable</l> converter on the
<l>getPerson</l> method allows us to invoke public methods
on the addressed POJO (in this case, public
methods on the <l>String</l> class):
</p>
- <img class="bordered"
src="doc-files/Samples.AddressBookResource.Introspectable.1.png">
+ <p class='bcode' style='width:800px;'>
+
http://localhost:10000/addressBook/people/1/name?invokeMethod=substring(int,int)&invokeArgs=[1,5]
+ </p>
+ <img class="bordered"
src="doc-files/juneau-examples-rest.AddressBookResource.Introspectable.1.png"
style='width:800px;'>
</div>
<!--
=======================================================================================================
-->
@@ -14914,7 +14932,7 @@
System.<jsf>out</jsf>.println(<js>"Created
address "</js> + a.<jf>uri</jf>);
<jc>// Find 1st person, and change name</jc>
- Person[] pp = client.doGet(root +
<js>"/people?q=(name='Barack+Obama')"</js>).getResponse(Person[].<jk>class</jk>);
+ Person[] pp = client.doGet(root +
<js>"/people?s=name=Barack+Obama"</js>).getResponse(Person[].<jk>class</jk>);
String r = client.doPut(pp[0].uri +
<js>"/name"</js>, <js>"Barack Hussein
Obama"</js>).getResponse(String.<jk>class</jk>);
System.<jsf>out</jsf>.println(<js>"Changed
name, response = "</js> + r);
p =
client.doGet(pp[0].<jf>uri</jf>).getResponse(Person.<jk>class</jk>);
@@ -14942,10 +14960,10 @@
Deleted person Barack Obama, response = DELETE successful
Deleted person George Walker Bush, response = DELETE successful
Number of entries = 0
- Created person Barack Obama, uri =
http://localhost:9081/sample/addressBook/people/3
- Created person George Walker Bush, uri =
http://localhost:9081/sample/addressBook/people/4
- Created address http://localhost:9081/sample/addressBook/addresses/7
- Created address http://localhost:9081/sample/addressBook/addresses/8
+ Created person Barack Obama, uri =
http://localhost:10000/addressBook/people/3
+ Created person George Walker Bush, uri =
http://localhost:10000/addressBook/people/4
+ Created address http://localhost:10000/addressBook/addresses/7
+ Created address http://localhost:10000/addressBook/addresses/8
Changed name, response = PUT successful
New name = Barack Hussein Obama
</p>
@@ -14958,8 +14976,8 @@
<p>
The Juneau architecture is designed to make it
easy to debug REST resources using nothing more than a
browser.
- The same actions done programmatically in the
last section can also be done using URLs.
- By default, you can override the HTTP Method
and Content through GET parameters, as shown below:
+ <br>The same actions done programmatically in
the last section can also be done using URLs.
+ <br>By default, you can override the HTTP
Method and Content through GET parameters, as shown below:
</p>
<p class='bcode'>
<jc>// Delete the existing entries</jc>
@@ -14967,15 +14985,15 @@
http://localhost:10000/addressBook/people/2?method=DELETE
<jc>// Add 1st person again</jc>
-
http://localhost:10000/addressBook/people?method=POST&content={name:'Barack
Obama',birthDate:'Aug 4, 1961',addresses:[{street:'1600 Pennsylvania
Ave',city:'Washington',state:'DC',zip:20500,isCurrent:true},{street:'5046 S
Greenwood Ave',city:'Chicago',state:'IL',zip:60615,isCurrent:false}]}
+
http://localhost:10000/addressBook/people?method=POST&content=(name=Barack+Obama,birthDate='Aug+4,+1961',addresses=@((street=1600+Pennsylvania+Ave,city=Washington,state=DC,zip=20500,isCurrent=true),(street=5046+S+Greenwood+Ave,city=Chicago,state=IL,zip=60615,isCurrent=false)))
<jc>// Add 2nd person again</jc>
-
http://localhost:10000/addressBook/people?method=POST&content={name:'George
Walker Bush',birthDate:'Jul 6, 1946'}
-
http://localhost:10000/addressBook/people/4/addresses?method=POST&content={street:'43
Prairie Chapel Rd',city:'Crawford',state:'TX',zip:76638,isCurrent:true}
-
http://localhost:10000/addressBook/people/4/addresses?method=POST&content={street:'1600
Pennsylvania Ave',city:'Washington',state:'DC',zip:20500,isCurrent:false}
+
http://localhost:10000/addressBook/people?method=POST&content=(name=George+Walker+Bush,birthDate='Jul+6,+1946')
+
http://localhost:10000/addressBook/people/4/addresses?method=POST&content=(street=43+Prairie+Chapel+Rd,city=Crawford,state=TX,zip=76638,isCurrent=true)
+
http://localhost:10000/addressBook/people/4/addresses?method=POST&content=(street=1600+Pennsylvania+Ave,city=Washington,state=DC,zip=20500,isCurrent=false)
<jc>// Change name of 1st person</jc>
-
http://localhost:10000/addressBook/people/3/name?method=PUT&content="'Barack
Hussein Obama'"
+
http://localhost:10000/addressBook/people/3/name?method=PUT&content=Barack+Hussein+Obama
</p>
<p>
The ability to overload methods is enabled
through the
@@ -14998,89 +15016,10 @@
<li>
Using the {@link
org.apache.juneau.rest.client.RestClient} class to create remoteable proxy
interfaces.
</ul>
- <p>
- The <l>RemoteableServlet</l> class has a single
abstract method,
- {@link
org.apache.juneau.rest.remoteable.RemoteableServlet#getServiceMap()}, that
defines interface
- keys and POJO values.
- </p>
- <p>
- The <l>SampleRemoteableServlet</l> exposes the
<l>AddressBook</l> bean from the previous example as a
- service.
- </p>
- <p class='bcode'>
- <ja>@RestResource</ja>(
- path=<js>"/remoteable"</js>,
- messages=<js>"nls/SampleRemoteableServlet"</js>,
- title=<js>"Remoteable Service Proxy API"</js>,
- description=<js>"Sample class showing how to use remoteable
proxies. The list below are exposed services that
- can be retrieved using
RestClient.getProxyInterface(Class)."</js>,
- htmldoc=<ja>@HtmlDoc</ja>(
- navlinks={
- <js>"up: request:/.."</js>,
- <js>"options: servlet:/?method=OPTIONS"</js>
- }
- ),
- <jc>// Allow us to use method=POST from a browser.</jc>
- allowedMethodParams=<js>"*"</js>
- )
- <jk>public class</jk> SampleRemoteableServlet <jk>extends</jk>
RemoteableServlet {
-
- AddressBook <jf>addressBook</jf> = <jk>new</jk> AddressBook();
-
- <ja>@Override</ja> <jc>/* RemoteableServlet */</jc>
- <jk>protected</jk> Map<Class<?>,Object>
getServiceMap() <jk>throws</jk> Exception {
- Map<Class<?>,Object> m = <jk>new</jk>
LinkedHashMap<Class<?>,Object>();
-
- <jc>// In this simplified example, you expose the same
POJO service under two different interfaces.</jc>
- <jc>// One is IAddressBook which only exposes methods
defined on that interface, and</jc>
- <jc>// the other is AddressBook itself which exposes
all methods defined on the class itself.</jc>
- m.put(IAddressBook.<jk>class</jk>,
<jf>addressBook</jf>);
- m.put(AddressBook.<jk>class</jk>,
<jf>addressBook</jf>);
-
- <jk>return</jk> m;
- }
- }
- </p>
- <p>
- Pointing a browser to the resource shows the following:
- </p>
- <img class='bordered'
src='doc-files/Samples.SampleRemoteableServlet.1.png'>
- <p>
- Clicking the hyperlinks on each shows you the list of
methods that can be invoked on that service.
- Note that the <l>IAddressBook</l> link shows that you
can only invoke methods defined on that
- interface, whereas the <l>AddressBook</l> link shows
ALL public methods defined on that class.
- Since <l>AddressBook</l> extends from
<l>LinkedList</l>, you may notice familiar collections
- framework methods listed.
- </p>
- <img class='bordered'
src='doc-files/Samples.SampleRemoteableServlet.2.png'>
- <br><br>
- <img class='bordered'
src='doc-files/Samples.SampleRemoteableServlet.3.png'>
- <ul class='doctree'>
- <li class='info'>
- As good practice, you'll want to use interfaces
to prevent all public methods from being exposed.
+ <h5 class='section'>See Also:</h5>
+ <ul>
+ <li class='link'><a class='doclink'
href='#juneau-rest-server.RemoteableProxiesServerSide'>Remoteable Proxies -
Server Side</a>
</ul>
- <p>
- Proxy interfaces are then retrieved using the {@link
org.apache.juneau.rest.client.RestClient#getRemoteableProxy(Class)} method.
- </p>
- <p>
- The client side code for invoking this method is shown
below:
- </p>
- <p class='bcode'>
- <jc>// Create a RestClient using JSON for serialization, and point to
the server-side remoteable servlet.</jc>
- RestClient client = RestClient.<jsm>create</jsm>()
- .rootUrl(<js>"http://localhost:10000/remoteable"</js>)
- .build();
-
- <jc>// Create a proxy interface.</jc>
- IAddressBook ab =
client.getRemoteableProxy(IAddressBook.<jk>class</jk>);
-
- <jc>// Invoke a method on the server side and get the returned
result.</jc>
- Person p = ab.createPerson(
- <jk>new</jk> CreatePerson(<js>"Test Person"</js>,
- AddressBook.<jsm>toCalendar</jsm>(<js>"Aug 1,
1999"</js>),
- <jk>new</jk> CreateAddress(<js>"Test street"</js>,
<js>"Test city"</js>, <js>"Test state"</js>, 12345, <jk>true</jk>))
- );
- </p>
</div>
<!--
=======================================================================================================
-->
@@ -15103,11 +15042,24 @@
<p>
Pointing a browser to the resource shows the following:
</p>
- <img class='bordered'
src='doc-files/Samples.TempDirResource.1.png'>
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/tempDir
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.TempDirResource.1.png' style='width:800px;'>
<p>
Pointing a browser to the <l>upload</l> link shows a
form entry page:
</p>
- <img class='bordered'
src='doc-files/Samples.TempDirResource.2.png'>
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/tempDir/upload
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.TempDirResource.2.png' style='width:800px;'>
+ <p>
+ Submitting a file redirects to the top-level page:
+ </p>
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/tempDir
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.TempDirResource.3.png' style='width:800px;'>
<h5 class='figure'>TempDirResource.java</h5>
<p class='bcode'>
@@ -15115,40 +15067,76 @@
* Sample resource that extends DirectoryResource to open up the temp
directory as a REST resource.
*/</jd>
<ja>@RestResource</ja>(
- path=<js>"/tempDir"</js>,
- messages=<js>"nls/TempDirResource"</js>,
+ path=<js>"/tempDir"</js>,
+ title=<js>"Temp Directory View Service"</js>,
+ description=<js>"View and download files in the '$R{rootDir}'
directory."</js>,
htmldoc=<ja>@HtmlDoc</ja>(
+ widgets={
+ ContentTypeMenuItem.<jk>class</jk>,
+ StyleMenuItem.<jk>class</jk>
+ },
navlinks={
<js>"up: request:/.."</js>,
<js>"options: servlet:/?method=OPTIONS"</js>,
- <js>"upload: servlet:/upload"</js>
+ <js>"upload: servlet:/upload"</js>,
+ <js>"$W{ContentTypeMenuItem}"</js>,
+ <js>"$W{StyleMenuItem}"</js>,
+ <js>"source:
$C{Source/gitHub}/org/apache/juneau/examples/rest/$R{servletClassSimple}.java"</js>
+ },
+ aside={
+ <js>"<div style='max-width:400px'
class='text'>"</js>,
+ <js>" <p>Shows how to use the
predefined DirectoryResource class.</p>"</js>,
+ <js>" <p>Also shows how to use HTML5
beans to create a form entry page.</p>"</js>,
+ <js>"</div>"</js>
}
),
- properties={
-
<ja>@Property</ja>(name=<js>"DirectoryResource.rootDir"</js>,
value=<js>"$S{java.io.tmpdir}"</js>),
-
<ja>@Property</ja>(name=<js>"DirectoryResource.allowViews"</js>,
value=<js>"true"</js>),
-
<ja>@Property</ja>(name=<js>"DirectoryResource.allowDeletes"</js>,
value=<js>"true"</js>),
-
<ja>@Property</ja>(name=<js>"DirectoryResource.allowPuts"</js>,
value=<js>"false"</js>)
- },
- stylesheet=<js>"styles/devops.css"</js>
+ properties={
+ <ja>@Property</ja>(name=<js>"rootDir"</js>,
value=<js>"$C{TempDirResource/dir,$S{java.io.tmpdir}}"</js>),
+ <ja>@Property</ja>(name=<js>"allowViews"</js>,
value=<js>"true"</js>),
+ <ja>@Property</ja>(name=<js>"allowDeletes"</js>,
value=<js>"true"</js>),
+ <ja>@Property</ja>(name=<js>"allowPuts"</js>,
value=<js>"false"</js>)
+ }
)
<jk>public class</jk> TempDirResource <jk>extends</jk>
DirectoryResource {
- <jk>private static final long</jk> <jsf>serialVersionUID</jsf>
= 1L;
- <jd>/**
- * [GET /upload] - Display the form entry page for uploading a
file to the temp directory.
- */</jd>
- <ja>@RestMethod</ja>(name=<jsf>GET</jsf>,
path=<js>"/upload"</js>)
- <jk>public</jk> ReaderResource getUploadPage(RestRequest req)
<jk>throws</jk> IOException {
- <jk>return</jk>
req.getClasspathReaderResource(<js>"TempDirUploadPage.html"</js>,
<jk>true</jk>);
- }
+ <ja>@Override</ja> <jc>/* DirectoryResource */</jc>
+ <ja>@RestHook</ja>(<jsf>INIT</jsf>)
+ <jk>public void</jk> init(RestContextBuilder b) <jk>throws</jk>
Exception {
+ <jk>super</jk>.<jk>init</jk>(b);
+ File rootDir = getRootDir();
+ <jk>if</jk> (! rootDir.exists()) {
+ rootDir.mkdirs();
+
+ <jc>// Make some dummy files.</jc>
+ FileUtils.<jsm>touch</jsm>(<jk>new</jk>
File(rootDir, <js>"A.txt"</js>));
+ FileUtils.<jsm>touch</jsm>(<jk>new</jk>
File(rootDir, <js>"B.txt"</js>));
+ FileUtils.<jsm>touch</jsm>(<jk>new</jk>
File(rootDir, <js>"C.txt"</js>));
+ }
+ }
+
+ <jd>/**
+ * [GET /upload] - Display the form entry page for uploading a
file to the temp directory.
+ */</jd>
+ <ja>@RestMethod</ja>(name=<jsf>GET</jsf>,
path=<js>"/upload"</js>)
+ <jk>public</jk> Form getUploadForm() {
+ <jk>return</jk>
+
<jsm>form</jsm>().id(<js>"form"</js>).action(<js>"servlet:/upload"</js>).method(<jsf>POST</jsf>).enctype(<js>"multipart/form-data"</js>)
+ .children(
+
<jsm>input</jsm>().name(<js>"contents"</js>).type(<js>"file"</js>),
+ <jsm>button</jsm>(<js>"submit"</js>,
<js>"Submit"</js>)
+ )
+ ;
+ }
<jd>/**
* [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.
*/</jd>
- <ja>@RestMethod</ja>(name=<jsf>POST</jsf>,
path=<js>"/upload"</js>,
-
matchers=TempDirResource.MultipartFormDataMatcher.<jk>class</jk>)
+ <ja>@RestMethod</ja>(
+ name=<jsf>POST</jsf>,
+ path=<js>"/upload"</js>,
+
matchers=TempDirResource.MultipartFormDataMatcher.<jk>class</jk>
+ )
<jk>public</jk> Redirect uploadFile(RestRequest req)
<jk>throws</jk> Exception {
ServletFileUpload upload = <jk>new</jk>
ServletFileUpload();
FileItemIterator iter = upload.getItemIterator(req);
@@ -15172,43 +15160,6 @@
}
}
</p>
-
- <h5 class='figure'>TempDirResource.properties</h5>
- <p class='bcode'>
-
<cc>#--------------------------------------------------------------------------------
- # TempDirResource labels
-
#--------------------------------------------------------------------------------</cc>
- <ck>title</ck> = <cv>Temp Directory View Service</cv>
- <ck>description</ck> = <cv>View and download files in the
'$S{java.io.tmpdir}' directory.</cv>
- </p>
- <p>
- Note how a system property variable can be defined in
the properties file.
- </p>
-
- <h5 class='figure'>TempDirUploadPage.html</h5>
- <b>TODO - Needs update</b>
- <p class='bcode'>
- <xt><html></xt>
- <xt><head></xt>
- <xt><meta</xt> <xa>http-equiv</xa>=<xs>"Content-Type"</xs>
<xa>content</xa>=<xs>"text/html; <xa>charset</xa>=UTF-8"</xs><xt>></xt>
- <xt><style</xt>
<xa>type</xa>=<xs>'text/css'</xs><xt>></xt>
- <xt>@import</xt> <xs>'$R{servletURI}/style.css'</xs>;
- <xt></style></xt>
- <xt></head></xt>
- <xt><body></xt>
- <xt><h1></xt>$R{resourceTitle}<xt></h1></xt>
- <xt><h2></xt>$R{resourceDescription}<xt></h2></xt>
- <xt><div</xt> <xa>class</xa>=<xs>'data'</xs><xt>></xt>
- <xt><form</xt> <xa>id</xa>=<xs>'form'</xs>
<xa>action</xa>=<xs>'$R{servletURI}/upload'</xs>
<xa>method</xa>=<xs>'POST'</xs> <xa>target</xa>=<xs>'buff'</xs>
<xa>enctype</xa>=<xs>"multipart/form-data"</xs><xt>></xt>
- <xt><input</xt>
<xa>name</xa>=<xs>"contents"</xs>
<xa>type</xa>=<xs>"file"</xs><xt>></xt><xt><button</xt>
<xa>type</xa>=<xs>"submit"</xs><xt>></xt>Submit<xt></button></xt>
- <xt></form></xt>
- <xt></div></xt>
- <xt></body></xt>
- <xt></html></xt>
- </p>
- <p>
- Note how the HTML file contains localized variables for
the servlet label and description.
- </p>
</div>
<!--
=======================================================================================================
-->
@@ -15225,15 +15176,24 @@
<p>
Pointing a browser to the resource shows the following:
</p>
- <img class='bordered'
src='doc-files/Samples.AtomFeedResource.1.png'>
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/atom
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.AtomFeedResource.1.png'
style='width:800px;'>
<p>
True ATOM feeds require using an <l>Accept:text/xml</l>
header:
</p>
- <img class='bordered'
src='doc-files/Samples.AtomFeedResource.2.png'>
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/atom?Accept=text/xml&plainText=true
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.AtomFeedResource.2.png'
style='width:800px;'>
<p>
Other languages, such as JSON are also supported:
</p>
- <img class='bordered'
src='doc-files/Samples.AtomFeedResource.3.png'>
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/atom?Accept=text/json&plainText=true
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.AtomFeedResource.3.png'
style='width:800px;'>
<h5 class='figure'>AtomFeedResource.java</h5>
<p class='bcode'>
@@ -15241,12 +15201,20 @@
* Sample resource that shows how to generate ATOM feeds.
*/</jd>
<ja>@RestResource</ja>(
- path=<js>"/atom"</js>,
- messages=<js>"nls/AtomFeedResource"</js>,
+ path=<js>"/atom"</js>,
+ title=<js>"Sample ATOM feed resource"</js>,
+ description=<js>"Sample resource that shows how to render ATOM
feeds"</js>,
htmldoc=<ja>@HtmlDoc</ja>(
+ widgets={
+ ContentTypeMenuItem.<jk>class</jk>,
+ StyleMenuItem.<jk>class</jk>
+ },
navlinks={
<js>"up: request:/.."</js>,
- <js>"options: servlet:/?method=OPTIONS"</js>
+ <js>"options: servlet:/?method=OPTIONS"</js>,
+ <js>"$W{ContentTypeMenuItem}"</js>,
+ <js>"$W{StyleMenuItem}"</js>,
+ <js>"source:
$C{Source/gitHub}/org/apache/juneau/examples/rest/$R{servletClassSimple}.java"</js>
}
),
properties={
@@ -15257,50 +15225,45 @@
encoders=GzipEncoder.<jk>class</jk>
)
<jk>public class</jk> AtomFeedResource <jk>extends</jk>
BasicRestServletJena {
- <jk>private static final long</jk> <jsf>serialVersionUID</jsf>
= 1L;
<jk>private</jk> Feed <jf>feed</jf>; <jc>// The root resource
object</jc>
<ja>@Override</ja> <jc>/* Servlet */</jc>
<jk>public void</jk> init() {
-
- <jk>try</jk> {
- <jf>feed</jf> = <jk>new</jk> Feed()
- .setTitle(<jk>new</jk>
Text(<js>"text"</js>, <js>"Juneau ATOM specification"</js>))
- .setSubTitle(<jk>new</jk>
Text(<js>"html"</js>, <js>"Decribes <em>stuff</em> about
Juneau"</js>))
-
.setUpdated(<jsm>parseDateTime</jsm>(<js>"2016-01-02T03:04:05Z"</js>))
- .setId(<jk>new</jk>
Id(<js>"tag:juneau.apache.org"</js>))
- .addLinks(
- <jk>new</jk>
Link(<js>"alternate"</js>, <js>"text/html"</js>,
<js>"http://juneau.apache.org/"</js>).setHreflang(<js>"en"</js>),
- <jk>new</jk>
Link(<js>"self"</js>, <js>"application/atom+xml"</js>,
<js>"http://juneau.apache.org/feed.atom"</js>)
- )
- .setRights(<jk>new</jk>
Text(<js>"Copyright (c) ..."</js>))
- .setGenerator(<jk>new</jk>
Generator(<js>"Juneau"</js>).setUri(<jk>new</jk>
URI(<js>"http://juneau.apache.org/"</js>)).setVersion(<js>"1.0"</js>))
- .addEntries(
- <jk>new</jk> Entry()
- .setTitle(<jk>new</jk>
Text(<js>"Juneau ATOM specification snapshot"</js>))
- .addLinks(
- <jk>new</jk>
Link(<js>"alternate"</js>, <js>"text/html"</js>,
<js>"http://juneau.apache.org/juneau.atom"</js>),
- <jk>new</jk>
Link(<js>"enclosure"</js>, <js>"audio/mpeg"</js>,
<js>"http://juneau.apache.org/audio/juneau_podcast.mp3"</js>).setLength(12345)
- )
- .setId(<jk>new</jk>
Id(<js>"tag:juneau.apache.org"</js>))
-
.setUpdated(<jsm>parseDateTime</jsm>(<js>"2016-01-02T03:04:05Z"</js>))
-
.setPublished(<jsm>parseDateTime</jsm>(<js>"2016-01-02T03:04:05Z"</js>))
- .addAuthors(<jk>new</jk>
Person(<js>"James Bognar"</js>).setUri(<jk>new</jk>
URI(<js>"http://juneau.apache.org/"</js>)).setEmail(<js>"[email protected]"</js>))
- .addContributors(
- <jk>new</jk> Person(<js>"Barry
M. Caceres"</js>)
- )
- .setContent(
- <jk>new</jk> Content()
- .setLang(<js>"en"</js>)
- .setBase(<jk>new</jk>
URI(<js>"http://www.apache.org/"</js>))
-
.setType(<js>"xhtml"</js>)
- .setText(<js>"<div
xmlns=\"http://www.w3.org/1999/xhtml\"><p><i>[Update: Juneau
supports ATOM.]</i></p></div>"</js>)
- )
- );
- } <jk>catch</jk> (Exception e) {
- <jk>throw new</jk> RuntimeException(e);
- }
+ <jk>try</jk> {
+ <jf>feed</jf> =
+
<jsm>feed</jsm>(<js>"tag:juneau.sample.com,2013:1"</js>, <js>"Juneau ATOM
specification"</js>, <js>"2013-05-08T12:29:29Z"</js>)
+
.subtitle(<jsm>text</jsm>(<js>"html"</js>).text(<js>"A <em>lot</em>
of effort went into making this effortless"</js>))
+ .links(
+
<jsm>link</jsm>(<js>"alternate"</js>, <js>"text/html"</js>,
<js>"http://www.sample.com/"</js>).hreflang(<js>"en"</js>),
+
<jsm>link</jsm>(<js>"self"</js>, <js>"application/atom+xml"</js>,
<js>"http://www.sample.com/feed.atom"</js>)
+ )
+ .generator(
+
<jsm>generator</jsm>(<js>"Juneau"</js>).uri(<js>"http://juneau.apache.org/"</js>).version(<js>"1.0"</js>)
+ )
+ .entries(
+
<jsm>entry</jsm>(<js>"tag:juneau.sample.com,2013:1.2345"</js>, <js>"Juneau ATOM
specification snapshot"</js>, <js>"2013-05-08T12:29:29Z"</js>)
+ .links(
+
<jsm>link</jsm>(<js>"alternate"</js>, <js>"text/html"</js>,
<js>"http://www.sample.com/2012/05/08/juneau.atom"</js>),
+
<jsm>link</jsm>(<js>"enclosure"</js>, <js>"audio/mpeg"</js>,
<js>"http://www.sample.com/audio/juneau_podcast.mp3"</js>).length(1337)
+ )
+
.published(<js>"2013-05-08T12:29:29Z"</js>)
+ .authors(
+
<jsm>person</jsm>(<js>"James Bognar"</js>).uri(<jk>new</jk>
URI(<js>"http://www.sample.com/"</js>)).email(<js>"[email protected]"</js>)
+ )
+ .contributors(
+
<jsm>person</jsm>(<js>"Barry M. Caceres"</js>)
+ )
+ .content(
+
<jsm>content</jsm>(<js>"xhtml"</js>)
+ .lang(<js>"en"</js>)
+
.base(<js>"http://www.apache.org/"</js>)
+
.text(<js>"<div><p>[Update: Juneau supports
ATOM.]</p></div>"</js>)
+ )
+ );
+ } <jk>catch</jk> (Exception e) {
+ <jk>throw new</jk> RuntimeException(e);
+ }
}
<jd>/**
@@ -15316,7 +15279,7 @@
* Replaces the feed with the specified content, and then
mirrors it as the response.
*/</jd>
<ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/"</js>)
- <jk>public</jk> Feed
setFeed(<ja>@org.apache.juneau.rest.annotation.Content</ja> Feed feed)
<jk>throws</jk> Exception {
+ <jk>public</jk> Feed setFeed(<ja>@Body</ja> Feed feed)
<jk>throws</jk> Exception {
<jk>this</jk>.<jf>feed</jf> = feed;
<jk>return</jk> feed;
}
@@ -15344,52 +15307,73 @@
<p>
Pointing a browser to the resource shows the following:
</p>
- <img class='bordered'
src='doc-files/Samples.DockerRegistryResource.1.png'>
- <p>
- Clicking the <l>search</l> link provides you with the
search results against the Docker registry:
- </p>
- <img class='bordered'
src='doc-files/Samples.DockerRegistryResource.2.png'>
-
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/docker
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.DockerRegistryResource.1.png'
style='width:800px;'>
<h5 class='figure'>DockerRegistryResource.java</h5>
<p class='bcode'>
<jd>/**
* Sample resource that shows how to mirror query results from a Docker
registry.
*/</jd>
<ja>@RestResource</ja>(
- path=<js>"/docker"</js>,
- title=<js>"Sample Docker resource"</js>,
+ path=<js>"/docker"</js>,
+ title=<js>"Sample Docker resource"</js>,
+ description=<js>"Docker registry explorer"</js>,
htmldoc=<ja>@HtmlDoc</ja>(
navlinks={
<js>"up: request:/.."</js>,
- <js>"options: servlet:/?method=OPTIONS"</js>
- }
+ <js>"options: servlet:/?method=OPTIONS"</js>,
+ <js>"source:
$C{Source/gitHub}/org/apache/juneau/examples/rest/$R{servletClassSimple}.java"</js>
+ },
+ <jc>// Pull in aside contents from file.</jc>
+
aside=<js>"$F{resources/DockerRegistryResourceAside.html}"</js>
)
)
<jk>public class</jk> DockerRegistryResource <jk>extends</jk>
BasicRestServlet {
- <jk>private static final long</jk> <jsf>serialVersionUID</jsf>
= 1L;
-
<jc>// Get registry URL from examples.cfg file.</jc>
- <jk>private</jk> String <jf>registryUrl</jf> =
getConfig().getString(<js>"DockerRegistry/url"</js>);
- RestClient <jf>rc</jf> =
RestClient.<jsm>create</jsm>().build();
-
- <jd>/** [GET /] - Show child resources. */</jd>
- <ja>@SuppressWarnings</ja>(<js>"nls"</js>)
- <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>)
- <jk>public</jk> ResourceDescription[] getChildren(RestRequest
req) {
- <jk>return new</jk> ResourceDescription[] {
- <jk>new</jk> ResourceDescription(req,
<js>"search"</js>, <js>"Search Registry"</js>)
- };
- }
-
- <jd>/**
- * PUT request handler.
- * Replaces the feed with the specified content, and then
mirrors it as the response.
- */</jd>
- <ja>@RestMethod</ja>(name=<jsf>GET</jsf>,
path=<js>"/search"</js>)
- <jk>public</jk> QueryResults
query(<ja>@Query</ja>(<js>"q"</js>) String q) <jk>throws</jk> Exception {
- String url = <jf>registryUrl</jf> + <js>"/search"</js>
+ (q == <jk>null</jk> ? <js>""</js> : <js>"?q="</js> + q);
- <jk>return</jk>
<jf>rc</jf>.doGet(url).getResponse(QueryResults.<jk>class</jk>);
- }
+ <jk>private</jk> String <jf>registryUrl</jf>;
+
+ <jk>private</jk> RestClient <jf>rc</jf>;
+
+ <jd>/**
+ * Initializes the registry URL and rest client.
+ *
+ * @param builder The resource config.
+ * @throws Exception
+ */</jd>
+ <ja>@RestHook</ja>(<jsf>INIT</jsf>)
+ <jk>public void</jk> initRegistry(RestContextBuilder builder)
<jk>throws</jk> Exception {
+ Config cf = builder.getConfig();
+ <jf>registryUrl</jf> =
cf.getString(<js>"DockerRegistry/url"</js>);
+ <jf>rc</jf> = RestClient.<jsm>create</jsm>().build();
+ }
+
+ <ja>@Override</ja> <jc>/* Servlet */</jc>
+ <jk>public synchronized void</jk> destroy() {
+ <jf>rc</jf>.closeQuietly();
+ <jk>super</jk>.destroy();
+ }
+
+ <jd>/** [GET /] - Show child resources. */</jd>
+ <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>)
+ <jk>public</jk> ResourceDescription[] getChildren(RestRequest
req) {
+ <jk>return new</jk> ResourceDescription[] {
+ <jk>new</jk>
ResourceDescription(<js>"search"</js>, <js>"Search Registry"</js>)
+ };
+ }
+
+ <jd>/**
+ * PUT request handler.
+ * Replaces the feed with the specified content, and then
mirrors it as the response.
+ */</jd>
+ <ja>@RestMethod</ja>(name=<jsf>GET</jsf>,
path=<js>"/search"</js>)
+ <jk>public</jk> QueryResults
query(<ja>@Query</ja>(<js>"q"</js>) String q) <jk>throws</jk> Exception {
+ String url = <jf>registryUrl</jf> + <js>"/search"</js>
+ (q == <jk>null</jk> ? <js>""</js> : <js>"?q="</js> + q);
+ <jk>synchronized</jk>(<jf>rc</jf>) {
+ <jk>return</jk>
rc.doGet(url).getResponse(QueryResults.<jk>class</jk>);
+ }
+ }
<jk>public static class</jk> QueryResults {
<jk>public int</jk> <jf>num_results</jf>;
@@ -15403,6 +15387,17 @@
}
</p>
<p>
+ In this example, we're pulling the aside message from
an external file:
+ </p>
+ <h5
class='figure'>resources/DockerRegistryResourceAside.html</h5>
+ <p class='bcode'>
+ <xt><div</xt> <xa>style</xa>=<xs>'min-width:200px'</xs>
<xa>class</xa>=<xs>'text'</xs><xt>></xt>
+ <xt><p></xt>REST API for searching Docker
registries.<xt></p></xt>
+ <xt><p></xt>To use, you must first specify the Docker
registry URL in the <xt><code></xt>[Docker]<xt></code></xt> section
of the config file.<xt></p></xt>
+ <xt></div> </xt>
+ </p>
+
+ <p>
The Docker registry URL is specified in the
<l>examples.cfg</l> file:
</p>
@@ -15420,6 +15415,9 @@
<a id="juneau-examples-rest.TumblrParserResource"></a>
<h4 class='topic' onclick='toggle(this)'>12.11 -
TumblrParserResource</h4>
<div class='topic'>
+ <p>
+ <b>Note:</b> As of March 2018, this resource is known
to not work against the Tumblr API.
+ </p>
<p>
The <l>TumblrParserResource</l> class shows examples of
the following:
</p>
@@ -15434,19 +15432,29 @@
Pointing a browser at a Tumblr blog name, such as
<l>ibmblr</l> causes a REST call to be make to the Tumblr
blog and the results to be parsed:
</p>
- <img class='bordered'
src='doc-files/Samples.TumblrParserResource.1.png'>
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/tumblrParser/ibmblr
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.TumblrParserResource.1.png'
style='width:800px;'>
<h5 class='figure'>TumblrParserResource.java</h5>
<p class='bcode'>
<ja>@RestResource</ja>(
- path=<js>"/tumblrParser"</js>,
- messages=<js>"nls/TumblrParserResource"</js>,
- title=<js>"Tumblr parser service"</js>,
- description=<js>"Specify a URL to a Tumblr blog and parse the
results."</js>,
+ path=<js>"/tumblrParser"</js>,
+ messages=<js>"nls/TumblrParserResource"</js>,
+ title=<js>"Tumblr parser service"</js>,
+ description=<js>"Specify a URL to a Tumblr blog and parse the
results."</js>,
htmldoc=<ja>@HtmlDoc</ja>(
navlinks={
<js>"up: request:/.."</js>,
- <js>"options: servlet:/?method=OPTIONS"</js>
+ <js>"options: servlet:/?method=OPTIONS"</js>,
+ <js>"source:
$C{Source/gitHub}/org/apache/juneau/examples/rest/$R{servletClassSimple}.java"</js>
+ },
+ aside={
+ <js>"<div style='min-width:200px'
class='text'>"</js>,
+ <js>" <p>An example of a REST interface
that retrieves data from another REST interface.</p>"</js>,
+ <js>" <p><a class='link'
href='$U{servlet:/ibmblr}'>try me</a></p>"</js>,
+ <js>"</div>"</js>
}
)
)
@@ -15516,11 +15524,17 @@
<p>
The resource consists of a simple registry of images
with integer IDs.
</p>
- <img class='bordered'
src='doc-files/Samples.PhotosResource.1.png'>
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/photos
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.PhotosResource.1.png' style='width:800px;'>
<p>
It is initialized with a single entry, which can be
accessed through a GET request.
</p>
- <img class='bordered'
src='doc-files/Samples.PhotosResource.2.png'>
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/photos/cat
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.PhotosResource.2.png' style='width:800px;'>
<h5 class='figure'>PhotosResource.java</h5>
<p class='bcode'>
@@ -15531,25 +15545,35 @@
path=<js>"/photos"</js>,
messages=<js>"nls/PhotosResource"</js>,
title=<js>"Photo REST service"</js>,
- description=<js>"Use a tool like Poster to upload and retrieve
jpeg and png images."</js>,
+ description=<js>"Sample resource that allows images to be
uploaded and retrieved."</js>,
htmldoc=<ja>@HtmlDoc</ja>(
navlinks={
- <js>"options: servlet:/?method=OPTIONS"</js>
+ <js>"up: request:/.."</js>,
+ <js>"options: servlet:/?method=OPTIONS"</js>,
+ <js>"source:
$C{Source/gitHub}/org/apache/juneau/examples/rest/$R{servletClassSimple}.java"</js>
+ },
+ aside={
+ <js>"<div
style='max-width:400px;min-width:200px' class='text'>"</js>,
+ <js>" <p>Shows an example of using
custom serializers and parsers to create REST interfaces over binary
resources.</p>"</js>,
+ <js>" <p>In this case, our resources
are marshalled jpeg and png binary streams and are stored in an in-memory
'database' (also known as a <code>TreeMap</code>).</p>"</js>,
+ <js>"</div>"</js>
}
- )
+ ),
+ properties={
+ <jc>// Make the anchor text on URLs be just the path
relative to the servlet.</jc>
+ <ja>@Property</ja>(name=<jsf>HTML_uriAnchorText</jsf>,
value=<js>"SERVLET_RELATIVE"</js>)
+ }
)
<jk>public class</jk> PhotosResource <jk>extends</jk> BasicRestServlet {
<jc>// Our cache of photos</jc>
- <jk>private</jk> Map<Integer,Photo> photos = <jk>new</jk>
TreeMap<Integer,Photo>();
-
+ <jk>private</jk> Map<String,Photo> <jf>photos</jf> =
<jk>new</jk> TreeMap<>();
+
<ja>@Override</ja> <jc>/* Servlet */</jc>
<jk>public void</jk> init() {
- <jk>try</jk> {
- <jc>// Preload an image.</jc>
- InputStream is =
getClass().getResourceAsStream(<js>"averycutedog.jpg"</js>);
+ <jk>try</jk> (InputStream is =
getClass().getResourceAsStream(<js>"averycutecat.jpg"</js>)) {
BufferedImage image =
ImageIO.<jsm>read</jsm>(is);
- Photo photo = <jk>new</jk> Photo(0, image);
+ Photo photo = <jk>new</jk>
Photo(<js>"cat"</js>, image);
<jf>photos</jf>.put(photo.<jf>id</jf>, photo);
} <jk>catch</jk> (IOException e) {
<jk>throw new</jk> RuntimeException(e);
@@ -15558,91 +15582,104 @@
<jd>/** Bean class for storing photos */</jd>
<jk>public static class</jk> Photo {
- <jk>private int</jk> <jf>id</jf>;
+ <jk>private</jk> String <jf>id</jf>;
BufferedImage <jf>image</jf>;
- Photo(int id, BufferedImage image) {
+ Photo(String id, BufferedImage image) {
<jk>this</jk>.<jf>id</jf> = id;
<jk>this</jk>.<jf>image</jf> = image;
}
<jk>public</jk> URI getURI() <jk>throws</jk>
URISyntaxException {
- <jk>return new</jk>
URI(<js>"photos/"</js>+<jf>id</jf>);
- }
-
- <jk>public int</jk> getID() {
- <jk>return</jk> <jf>id</jf>;
+ <jk>return new</jk> URI(<js>"servlet:/"</js> +
<jf>id</jf>);
}
}
<jd>/** GET request handler for list of all photos */</jd>
- <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>)
- <jk>public</jk> Collection<Photo>
getAllPhotos(RestRequest req, RestResponse res) <jk>throws</jk> Exception {
- res.setPageTitle(<js>"Photo REST service"</js>);
- res.setPageText(<js>"Use a tool like Poster to upload
and retrieve jpeg and png images."</js>);
- <jk>return</jk> photos.values();
+ <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>,
summary=<js>"Show the list of all currently loaded photos"</js>)
+ <jk>public</jk> Collection<Photo> getAllPhotos()
<jk>throws</jk> Exception {
+ <jk>return</jk> <jf>photos</jf>.values();
}
-
+
<jd>/** GET request handler for single photo */</jd>
- <ja>@RestMethod</ja>(name=<jsf>GET</jsf>,
path=<js>"/{id}"</js>, serializers=ImageSerializer.<jk>class</jk>)
- <jk>public</jk> BufferedImage getPhoto(RestRequest req,
<ja>@Path</ja> int id) <jk>throws</jk> Exception {
- Photo p = photos.get(id);
- if (p == <jk>null</jk>)
+ <ja>@RestMethod</ja>(name=<jsf>GET</jsf>,
path=<js>"/{id}"</js>, serializers=ImageSerializer.<jk>class</jk>,
summary=<js>"Get a photo by ID"</js>)
+ <jk>public</jk> BufferedImage getPhoto(<ja>@Path</ja> String
id) <jk>throws</jk> Exception {
+ Photo p = <jf>photos</jf>.get(id);
+ <jk>if</jk> (p == <jk>null</jk>)
<jk>throw new</jk>
RestException(<jsf>SC_NOT_FOUND</jsf>, <js>"Photo not found"</js>);
- <jk>return</jk> p.image;
+ <jk>return</jk> p.<jf>image</jf>;
}
-
+
<jd>/** PUT request handler */</jd>
- <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>,
path=<js>"/{id}"</js>, parsers=ImageParser.<jk>class</jk>)
- <jk>public</jk> String addPhoto(RestRequest req, <ja>@Path</ja>
<jk>int</jk> id, <ja>@Body</ja> BufferedImage image) <jk>throws</jk> Exception {
- photos.put(id, <jk>new</jk> Photo(id, image));
+ <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>,
path=<js>"/{id}"</js>, parsers=ImageParser.<jk>class</jk>, summary=<js>"Add or
overwrite a photo"</js>)
+ <jk>public</jk> String addPhoto(<ja>@Path</ja> String id,
<ja>@Body</ja> BufferedImage image) <jk>throws</jk> Exception {
+ <jf>photos</jf>.put(id, <jk>new</jk> Photo(id, image));
<jk>return</jk> <js>"OK"</js>;
}
-
+
<jd>/** POST request handler */</jd>
- <ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/"</js>,
parsers=ImageParser.<jk>class</jk>)
- <jk>public</jk> Photo setPhoto(RestRequest req, <ja>@Body</ja>
BufferedImage image) <jk>throws</jk> Exception {
- <jk>int</jk> id = photos.size();
- Photo p = <jk>new</jk> Photo(id, image);
- photos.put(id, p);
+ <ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/"</js>,
parsers=ImageParser.<jk>class</jk>, summary=<js>"Add a photo"</js>)
+ <jk>public</jk> Photo setPhoto(<ja>@Body</ja> BufferedImage
image) <jk>throws</jk> Exception {
+ Photo p = <jk>new</jk>
Photo(UUID.<jsm>randomUUID</jsm>().toString(), image);
+ <jf>photos</jf>.put(p.<jf>id</jf>, p);
<jk>return</jk> p;
}
-
+
<jd>/** DELETE request handler */</jd>
- <ja>@RestMethod</ja>(name=<jsf>DELETE</jsf>,
path=<js>"/{id}"</js>)
- <jk>public</jk> String deletePhoto(RestRequest req,
<ja>@Path</ja> <jk>int</jk> id) <jk>throws</jk> Exception {
- Photo p = photos.remove(id);
- if (p == <jk>null</jk>)
+ <ja>@RestMethod</ja>(name=<jsf>DELETE</jsf>,
path=<js>"/{id}"</js>, summary=<js>"Delete a photo by ID"</js>)
+ <jk>public</jk> String deletePhoto(<ja>@Path</ja> String id)
<jk>throws</jk> Exception {
+ Photo p = <jf>photos</jf>.remove(id);
+ <jk>if</jk> (p == <jk>null</jk>)
<jk>throw new</jk>
RestException(<jsf>SC_NOT_FOUND</jsf>, <js>"Photo not found"</js>);
<jk>return</jk> <js>"OK"</js>;
}
- <jd>/** OPTIONS request handler */</jd>
- <ja>@RestMethod</ja>(name=<jsf>OPTIONS</jsf>,
path=<js>"/*"</js>)
- <jk>public</jk> Swagger getOptions(RestRequest req) {
- <jk>return</jk> req.getSwagger();
- }
-
<jd>/** Serializer for converting images to byte streams */</jd>
- <ja>@Produces</ja>(<js>"image/png,image/jpeg"</js>)
<jk>public static class</jk> ImageSerializer <jk>extends</jk>
OutputStreamSerializer {
-
- <ja>@Override</ja> <jc>/* Serializer */</jc>
- <jk>public void</jk> serialize(Object o, OutputStream
out, SerializerSession session) <jk>throws</jk> IOException, SerializeException
{
- RenderedImage image = (RenderedImage)o;
- String mediaType = ctx.getMediaType();
- ImageIO.<jsm>write</jsm>(image,
mediaType.substring(mediaType.indexOf(<js>'/'</js>)+1), out);
- }
+
+ <jd>/**
+ * Constructor.
+ * <ja>@param</ja> ps The property store containing all
the settings for this object.
+ */</jd>
+ <jk>public</jk> ImageSerializer(PropertyStore ps) {
+ <jk>super</jk>(ps, <jk>null</jk>,
<js>"image/png"</js>, <js>"image/jpeg"</js>);
+ }
+
+ <ja>@Override</ja> <jc>/* Serializer */</jc>
+ <jk>public</jk> OutputStreamSerializerSession
createSession(SerializerSessionArgs args) {
+ <jk>return new</jk>
OutputStreamSerializerSession(args) {
+
+ <ja>@Override</ja> <jc>/*
SerializerSession */</jc>
+ <jk>protected void</jk>
doSerialize(SerializerPipe out, Object o) <jk>throws</jk> Exception {
+ RenderedImage image =
(RenderedImage)o;
+ String mediaType =
getProperty(<js>"mediaType"</js>, String.<jk>class</jk>, (String)<jk>null</jk>);
+ ImageIO.<jsm>write</jsm>(image,
mediaType.substring(mediaType.indexOf(<js>'/'</js>)+1), out.getOutputStream());
+ }
+ };
+ }
}
-
+
<jd>/** Parser for converting byte streams to images */</jd>
- <ja>@Consumes</ja>(<js>"image/png,image/jpeg"</js>)
<jk>public static class</jk> ImageParser <jk>extends</jk>
InputStreamParser {
-
+
+ <jd>/**
+ * Constructor.
+ * <ja>@param</ja> ps The property store containing all
the settings for this object.
+ */</jd>
+ <jk>public</jk> ImageParser(PropertyStore ps) {
+ <jk>super</jk>(ps, <js>"image/png"</js>,
<js>"image/jpeg"</js>);
+ }
+
<ja>@Override</ja> <jc>/* Parser */</jc>
- <jk>public</jk> <T> T parse(InputStream in,
ClassMeta<T> type, ParserSession session) <jk>throws</jk> ParseException,
IOException {
- BufferedImage image =
ImageIO.<jsm>read</jsm>(in);
- <jk>return</jk> (T)image;
+ <jk>public</jk> InputStreamParserSession
createSession(<jk>final</jk> ParserSessionArgs args) {
+ <jk>return new</jk>
InputStreamParserSession(args) {
+
+ <ja>@Override</ja> <jc>/* ParserSession
*/</jc>
+
<ja>@SuppressWarnings</ja>(<js>"unchecked"</js>)
+ <jk>protected</jk> <T> T
doParse(ParserPipe pipe, ClassMeta<T> type) <jk>throws</jk> Exception {
+ <jk>return</jk>
(T)ImageIO.<jsm>read</jsm>(pipe.getInputStream());
+ }
+ };
}
}
}
@@ -15665,11 +15702,17 @@
The resource consists of a pre-initialized {@link
org.apache.juneau.dto.jsonschema.Schema} object.
Pointing a browser to the resource shows the following:
</p>
- <img class='bordered'
src='doc-files/Samples.JsonSchemaResource.1.png'>
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/jsonSchema
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.JsonSchemaResource.1.png'
style='width:800px;'>
<p>
For true JSON-Schema, you need to specify the header
<l>Accept: text/json</l>:
</p>
- <img class='bordered'
src='doc-files/Samples.JsonSchemaResource.2.png'>
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/jsonSchema?Accept=text/json&plainText=true
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.JsonSchemaResource.2.png'
style='width:800px;'>
<h5 class='figure'>JsonSchemaResource.java</h5>
<p class='bcode'>
@@ -15677,13 +15720,26 @@
* Sample resource that shows how to serialize JSON-Schema documents.
*/</jd>
<ja>@RestResource</ja>(
- path=<js>"/jsonSchema"</js>,
- messages=<js>"nls/JsonSchemaResource"</js>,
- title=<js>"Sample JSON-Schema document"</js>,
+ path=<js>"/jsonSchema"</js>,
+ messages=<js>"nls/JsonSchemaResource"</js>,
+ title=<js>"Sample JSON-Schema document"</js>,
+ description=<js>"Sample resource that shows how to generate
JSON-Schema documents"</js>,
htmldoc=<ja>@HtmlDoc</ja>(
+ widgets={
+ ContentTypeMenuItem.<jk>class</jk>,
+ StyleMenuItem.<jk>class</jk>
+ },
navlinks={
<js>"up: request:/.."</js>,
- <js>"options: servlet:/?method=OPTIONS"</js>
+ <js>"options: servlet:/?method=OPTIONS"</js>,
+ <js>"$W{ContentTypeMenuItem}"</js>,
+ <js>"$W{StyleMenuItem}"</js>,
+ <js>"source:
$C{Source/gitHub}/org/apache/juneau/examples/rest/$R{servletClassSimple}.java"</js>
+ },
+ aside={
+ <js>"<div style='min-width:200px'
class='text'>"</js>,
+ <js>" <p>Shows how to produce
JSON-Schema documents in a variety of languages using the JSON-Schema
DTOs.</p>"</js>,
+ <js>"</div>"</js>
}
)
)
@@ -15755,11 +15811,18 @@
<p>
Pointing a browser to the resource shows the following:
</p>
- <img class='bordered'
src='doc-files/Samples.SqlQueryResource.1.png'>
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/sqlQuery
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.SqlQueryResource.1.png'
style='width:800px;'>
<p>
Running a query results in the following output:
</p>
- <img class='bordered'
src='doc-files/Samples.SqlQueryResource.2.png'>
+ <p class='bcode' style='width:800px;'>
+ select count(*) from SYS.SYSTABLES;
+ select TABLEID,TABLENAME,TABLETYPE from SYS.SYSTABLES;
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.SqlQueryResource.2.png'
style='width:800px;'>
<h5 class='figure'>SqlQueryResource.java</h5>
<p class='bcode'>
@@ -15767,43 +15830,99 @@
* Sample resource that shows how Juneau can serialize ResultSets.
*/</jd>
<ja>@RestResource</ja>(
- path=<js>"/sqlQuery"</js>,
- messages=<js>"nls/SqlQueryResource"</js>,
- title=<js>"SQL query service"</js>,
- description=<js>"Executes queries against the local derby
'$C{SqlQueryResource/connectionUrl}' database"</js>,
+ path=<js>"/sqlQuery"</js>,
+ messages=<js>"nls/SqlQueryResource"</js>,
+ title=<js>"SQL query service"</js>,
+ description=<js>"Executes queries against the local derby
'$C{SqlQueryResource/connectionUrl}' database"</js>,
htmldoc=<ja>@HtmlDoc</ja>(
+ widgets={
+ StyleMenuItem.<jk>class</jk>
+ },
navlinks={
<js>"up: request:/.."</js>,
- <js>"options: servlet:/?method=OPTIONS"</js>
+ <js>"options: servlet:/.."</js>,
+ <js>"$W{StyleMenuItem}"</js>,
+ <js>"source:
$C{Source/gitHub}/org/apache/juneau/examples/rest/$R{servletClassSimple}.java"</js>
+ },
+ aside={
+ <js>"<div style='min-width:200px'
class='text'>"</js>,
+ <js>" <p>An example of a REST interface
over a relational database.</p>"</js>,
+ <js>" <p><a class='link'
href='?sql=select+*+from sys.systables'>try me</a></p>"</js>,
+ <js>"</div>"</js>
}
)
)
<jk>public class</jk> SqlQueryResource <jk>extends</jk>
BasicRestServlet {
- <jk>private static final long</jk> <jsf>serialVersionUID</jsf>
= 1L;
-
- <jk>private</jk> Config <jf>cf</jf> = getConfig();
-
- <jk>private</jk> String <jf>driver</jf> =
cf.getString(<js>"SqlQueryResource/driver"</js>);
- <jk>private</jk> String <jf>connectionUrl</jf> =
cf.getString(<js>"SqlQueryResource/connectionUrl"</js>);
- <jk>private boolean</jk>
- <jf>allowUpdates</jf> =
cf.getBoolean(<js>"SqlQueryResource/allowUpdates"</js>, <jk>false</jk>),
- <jf>allowTempUpdates</jf> =
cf.getBoolean(<js>"SqlQueryResource/allowTempUpdates"</js>, <jk>false</jk>),
- <jf>includeRowNums</jf> =
cf.getBoolean(<js>"SqlQueryResource/includeRowNums"</js>, <jk>false</jk>);
-
- <ja>@Override</ja> <jc>/* Servlet */</jc>
- <jk>public void</jk> init() {
- <jk>try</jk> {
- Class.<jsm>forName</jsm>(driver).newInstance();
- } <jk>catch</jk> (Exception e) {
- <jk>throw new</jk> RuntimeException(e);
- }
- }
-
- <jd>/** GET request handler - Display the query entry page.
*/</jd>
- <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>)
- <jk>public</jk> ReaderResource doGet(RestRequest req)
<jk>throws</jk> IOException {
- <jk>return</jk>
req.getClasspathReaderResource(<js>"SqlQueryResource.html"</js>,
<jk>true</jk>);
- }
+
+ <jk>private</jk> String <jf>driver</jf>, <jf>connectionUrl</jf>;
+ <jk>private boolean</jk> <jf>allowUpdates</jf>,
<jf>allowTempUpdates</jf>, <jf>includeRowNums</jf>;
+
+ <jd>/**
+ * Initializes the registry URL and rest client.
+ *
+ * <ja>@param</ja> builder The resource config.
+ * <ja>@throws</ja> Exception
+ */</jd>
+ <ja>@RestHook</ja>(<jsf>INIT</jsf>)
+ <jk>public void</jk> initConnection(RestContextBuilder builder)
<jk>throws</jk> Exception {
+ Config cf = builder.getConfig();
+
+ <jf>driver</jf> =
cf.getString(<js>"SqlQueryResource/driver"</js>);
+ <jf>connectionUrl</jf> =
cf.getString(<js>"SqlQueryResource/connectionUrl"</js>);
+ <jf>allowUpdates</jf> =
cf.getBoolean(<js>"SqlQueryResource/allowUpdates"</js>, <jk>false</jk>);
+ <jf>allowTempUpdates</jf> =
cf.getBoolean(<js>"SqlQueryResource/allowTempUpdates"</js>, <jk>false</jk>);
+ <jf>includeRowNums</jf> =
cf.getBoolean("<js>SqlQueryResource/includeRowNums"</js>, <jk>false</jk>);
+
+ <jk>try</jk> {
+
Class.<jsm>forName</jsm>(<jf>driver</jf>).newInstance();
+ } <jk>catch</jk> (Exception e) {
+ <jk>throw new</jk> RuntimeException(e);
+ }
+ }
+
+ <jd>/** GET request handler - Display the query entry page.
*/</jd>
+ <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>,
summary=<js>"Display the query entry page"</js>)
+ <jk>public</jk> Div doGet(RestRequest req,
<ja>@Query</ja>(<js>"sql"</js>) String sql) {
+ <jk>return</jk> <jsm>div</jsm>(
+ <jsm>script</jsm>(<js>"text/javascript"</js>,
+ <js>"\n // Quick and dirty function to
allow tabs in textarea."</js>
+ +<js>"\n function checkTab(e)
{"</js>
+ +<js>"\n if (e.keyCode
== 9) {"</js>
+ +<js>"\n var t =
e.target;"</js>
+ +<js>"\n var ss
= t.selectionStart, se = t.selectionEnd;"</js>
+ +<js>"\n t.value
=
t.value.slice(0,ss).concat('\\t').concat(t.value.slice(ss,t.value.length));"</js>
+ +<js>"\n
e.preventDefault();"</js>
+ +<js>"\n }"</js>
+ +<js>"\n }"</js>
+ +<js>"\n // Load results from
IFrame into this document."</js>
+ +<js>"\n function loadResults(b)
{"</js>
+ +<js>"\n var doc =
b.contentDocument || b.contentWindow.document;"</js>
+ +<js>"\n var data =
doc.getElementById('data') || doc.getElementsByTagName('body')[0];"</js>
+ +<js>"\n
document.getElementById('results').innerHTML = data.innerHTML;"</js>
+ +<js>"\n }"</js>
+ ),
+
<jsm>form</jsm>(<js>"servlet:/"</js>).method(<jsf>POST</jsf>).target(<js>"buf"</js>).children(
+ <jsm>table</jsm>(
+ <jsm>tr</jsm>(
+
<jsm>th</jsm>(<js>"Position (1-10000):"</js>),
+
<jsm>td</jsm>(<jsm>input</jsm>().name(<js>"pos"</js>).type(<js>"number"</js>).value(1)),
+
<jsm>th</jsm>(<js>"Limit (1-10000):"</js>),
+
<jsm>td</jsm>(<jsm>input</jsm>().name(<js>"limit"</js>).type(<js>"number"</js>).value(100)),
+
<jsm>td</jsm>(<jsm>button</jsm>(<js>"submit"</js>, <js>"Submit"</js>),
<jsm>button</jsm>(<js>"reset"</js>, <js>"Reset"</js>))
+ ),
+ <jsm>tr</jsm>(
+
<jsm>td</jsm>().colspan(5).children(
+
<jsm>textarea</jsm>().name(<js>"sql"</js>).text(sql == <jk>null</jk> ? <js>"
"</js> : sql)
+
.style(<js>"width:100%;height:200px;font-family:Courier;font-size:9pt;"</js>).onkeydown(<js>"checkTab(event)"</js>)
+ )
+ )
+ )
+ ),
+ <jsm>br</jsm>(),
+ <jsm>div</jsm>().id(<js>"results"</js>),
+
<jsm>iframe</jsm>().name(<js>"buf"</js>).style(<js>"display:none"</js>).onload(<js>"parent.loadResults(this)"</js>)
+ );
+ }
<jd>/** POST request handler - Execute the query. */</jd>
<ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/"</js>)
@@ -15866,62 +15985,7 @@
<jk>public int</jk> <jf>pos</jf> = 1, <jf>limit</jf> =
100;
}
}
- </p>
-
- <h5 class='figure'>SqlQueryResource.html</h5>
- <b>TODO - Needs update</b>
- <p class='bcode'>
- <xt><html></xt>
- <xt><head></xt>
- <xt><style</xt>
<xa>type</xa>=<xs>'text/css'</xs><xt>></xt>
- <xt>@import</xt> <xs>'$R{servletURI}/style.css'</xs>;
- <xt></style></xt>
- <xt><script></xt>
- <jc>// Quick and dirty function to allow tabs in
textarea.</jc>
- <jk>function</jk> checkTab(e) {
- <jk>if</jk> (e.keyCode == 9) {
- <jk>var</jk> t = e.target;
- <jk>var</jk> ss = t.selectionStart, se
= t.selectionEnd;
- t.value =
t.value.slice(0,ss).concat(<js>'\t'</js>).concat(t.value.slice(ss,t.value.length));
- e.preventDefault();
- }
- }
- <jc>// Load results from IFrame into this
document.</jc>
- <jk>function</jk> loadResults(b) {
- <jk>var</jk> doc = b.contentDocument ||
b.contentWindow.document;
- <jk>var</jk> data =
doc.getElementById(<js>'data'</js>) ||
doc.getElementsByTagName(<js>'body'</js>)[0];
-
document.getElementById(<js>'results'</js>).innerHTML = data.innerHTML;
- }
- <xt></script></xt>
- <xt></head></xt>
- <xt><body></xt>
- <xt><h1></xt>SQL Query API<xt></h1></xt>
- <xt><div</xt> <xa>class</xa>=<xs>'data'</xs><xt>></xt>
- <xt><form</xt> <xa>action</xa>=<xs>'sqlQuery'</xs>
<xa>method</xa>=<xs>'POST'</xs> <xa>target</xa>=<xs>'buf'</xs><xt>></xt>
- <xt><table></xt>
- <xt><tr></xt>
- <xt><th></xt>Position
(1-10000):<xt></th></xt>
-
<xt><td></xt><xt><input</xt> <xa>name</xa>=<xs>'pos'</xs>
<xa>type</xa>=<xs>'number'</xs>
<xa>value</xa>=<xs>'1'</xs><xt>></xt><xt></td></xt>
- <xt><th></xt>Limit
(1-10000):<xt></th></xt>
-
<xt><td></xt><xt><input</xt> <xa>name</xa>=<xs>'limit'</xs>
<xa>type</xa>=<xs>'number'</xs>
<xa>value</xa>=<xs>'100'</xs><xt>></xt><xt></td></xt>
-
<xt><td></xt><xt><button</xt>
<xa>type</xa>=<xs>'submit'</xs><xt>></xt>Submit<xt></button></xt><xt><button</xt>
<xa>type</xa>=<xs>'reset'</xs><xt>></xt>Reset<xt></button></xt><xt></td></xt>
- <xt></tr></xt>
- <xt><tr></xt>
- <xt><td</xt>
<xa>colspan</xa>=<xs>"5"</xs><xt>></xt>
- <xt><textarea</xt>
<xa>name</xa>=<xs>'sql'</xs>
<xa>style</xa>=<xs>'width:100%;height:200px;font-family:Courier;font-size:9pt;'</xs>
<xa>onkeydown</xa>=<xs>'checkTab(event)'</xs><xt>></xt><xt></textarea></xt>
- <xt></td></xt>
- <xt></tr></xt>
- <xt></table></xt>
- <xt></form></xt>
- <xt><br></xt>
- <xt><div</xt>
<xa>id</xa>=<xs>'results'</xs><xt>></xt>
- <xt></div></xt>
- <xt></div></xt>
- <xt><iframe</xt> <xa>name</xa>=<xs>'buf'</xs>
<xa>style</xa>=<xs>'display:none'</xs>
<xa>onload</xa>=<xs>"parent.loadResults(this)"</xs><xt>></xt><xt></iframe></xt>
- <xt></body></xt>
- <xt></html></xt>
</p>
-
<h5 class='figure'>samples.cfg</h5>
<p class='bcode'>
<cc>#================================================================================
@@ -15946,11 +16010,11 @@
<p>
Pointing a browser to the resource shows the following:
</p>
- <img class='bordered'
src='doc-files/Samples.ConfigResource.1.png'>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.ConfigResource.1.png'>
<p>
An edit page is provided for altering the raw config
file:
</p>
- <img class='bordered'
src='doc-files/Samples.ConfigResource.3.png'>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.ConfigResource.3.png'>
<p>
The {@link org.apache.juneau.config.Config} class is a
serializable POJO, which makes the resource
relatively straightforward to implement.
@@ -16163,15 +16227,10 @@
<p>
Pointing a browser to the resource shows the following:
</p>
- <img class='bordered'
src='doc-files/Samples.LogsResource.1.png'>
- <p>
- The <l>highlighted</l> links show the contents of the
log file with color highlighting:
- </p>
- <img class='bordered'
src='doc-files/Samples.LogsResource.2.png'>
- <p>
- The <l>parsed</l> links parse the log file and return
the entries as serialized POJOs:
- </p>
- <img class='bordered'
src='doc-files/Samples.LogsResource.3.png'>
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/logs
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.LogsResource.1.png' style='width:800px;'>
</div>
</div>
diff --git a/juneau-examples/juneau-examples-rest/examples.cfg
b/juneau-examples/juneau-examples-rest/examples.cfg
index 8d91b88..53bc085 100755
--- a/juneau-examples/juneau-examples-rest/examples.cfg
+++ b/juneau-examples/juneau-examples-rest/examples.cfg
@@ -184,3 +184,10 @@ includeRowNums = true
#=======================================================================================================================
[Source]
gitHub =
https://github.com/apache/juneau/blob/master/juneau-examples/juneau-examples-rest/src/main/java
+
+#=======================================================================================================================
+# TempDirResource properties
+#=======================================================================================================================
+[TempDirResource]
+dir = tmp
+
diff --git
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/AtomFeedResource.java
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/AtomFeedResource.java
index 8c8f91f..4915318 100644
---
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/AtomFeedResource.java
+++
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/AtomFeedResource.java
@@ -59,7 +59,6 @@ public class AtomFeedResource extends BasicRestServletJena {
@Override /* Servlet */
public void init() {
-
try {
feed =
feed("tag:juneau.sample.com,2013:1", "Juneau
ATOM specification", "2013-05-08T12:29:29Z")
diff --git
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SampleRemoteableServlet.java
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SampleRemoteableServlet.java
index 80fba93..f84cf6b 100644
---
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SampleRemoteableServlet.java
+++
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SampleRemoteableServlet.java
@@ -41,8 +41,7 @@ import org.apache.juneau.rest.remoteable.*;
}
),
// Allow us to use method=POST from a browser.
- allowedMethodParams="*",
- config="$S{juneau.configFile}" // So we can resolve $C{Source/gitHub}
above.
+ allowedMethodParams="*"
)
public class SampleRemoteableServlet extends RemoteableServlet {
@@ -102,15 +101,6 @@ public class SampleRemoteableServlet extends
RemoteableServlet {
return super.listMethods(req, javaInterface);
}
- /**
- * [GET /{javaInterface] - Get the list of all remoteable methods on
the specified interface name.
- *
- * @param req The HTTP servlet request.
- * @param javaInterface The Java interface name.
- * @param javaMethod The Java method name or signature.
- * @return A simple form entry page for invoking a remoteable method.
- * @throws Exception
- */
@Override /* RemoteableServlet */
@RestMethod(name=GET, path="/{javaInterface}/{javaMethod}",
summary="Form entry for method $RP{javaMethod} on interface $RP{javaInterface}",
htmldoc=@HtmlDoc(
diff --git
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SqlQueryResource.java
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SqlQueryResource.java
index c8b1d43..2da3fe1 100644
---
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SqlQueryResource.java
+++
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SqlQueryResource.java
@@ -105,7 +105,7 @@ public class SqlQueryResource extends BasicRestServlet {
+"\n
document.getElementById('results').innerHTML = data.innerHTML;"
+"\n }"
),
- form("sqlQuery").method(POST).target("buf").children(
+ form("servlet:/").method(POST).target("buf").children(
table(
tr(
th("Position (1-10000):"),
diff --git
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java
index bcd3e74..280884f 100644
---
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java
+++
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java
@@ -14,11 +14,13 @@ package org.apache.juneau.examples.rest;
import static org.apache.juneau.dto.html5.HtmlBuilder.*;
import static org.apache.juneau.http.HttpMethodName.*;
+import static org.apache.juneau.rest.annotation.HookEvent.*;
import java.io.*;
import org.apache.commons.fileupload.*;
import org.apache.commons.fileupload.servlet.*;
+import org.apache.commons.io.*;
import org.apache.juneau.dto.html5.*;
import org.apache.juneau.rest.*;
import org.apache.juneau.rest.annotation.*;
@@ -31,7 +33,7 @@ import org.apache.juneau.utils.*;
@RestResource(
path="/tempDir",
title="Temp Directory View Service",
- description="View and download files in the '$S{java.io.tmpdir}'
directory.",
+ description="View and download files in the '$R{rootDir}' directory.",
htmldoc=@HtmlDoc(
widgets={
ContentTypeMenuItem.class,
@@ -53,7 +55,7 @@ import org.apache.juneau.utils.*;
}
),
properties={
- @Property(name="rootDir", value="$S{java.io.tmpdir}"),
+ @Property(name="rootDir",
value="$C{TempDirResource/dir,$S{java.io.tmpdir}}"),
@Property(name="allowViews", value="true"),
@Property(name="allowDeletes", value="true"),
@Property(name="allowPuts", value="false")
@@ -62,6 +64,21 @@ import org.apache.juneau.utils.*;
public class TempDirResource extends DirectoryResource {
private static final long serialVersionUID = 1L;
+ @Override /* DirectoryResource */
+ @RestHook(INIT)
+ public void init(RestContextBuilder b) throws Exception {
+ super.init(b);
+ File rootDir = getRootDir();
+ if (! rootDir.exists()) {
+ rootDir.mkdirs();
+
+ // Make some dummy files.
+ FileUtils.touch(new File(rootDir, "A.txt"));
+ FileUtils.touch(new File(rootDir, "B.txt"));
+ FileUtils.touch(new File(rootDir, "C.txt"));
+ }
+ }
+
/**
* [GET /upload] - Display the form entry page for uploading a file to
the temp directory.
*/
diff --git
a/juneau-examples/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMultiPartFormPostsTest.java
b/juneau-examples/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMultiPartFormPostsTest.java
index 051ba65..a75c94e 100644
---
a/juneau-examples/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMultiPartFormPostsTest.java
+++
b/juneau-examples/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMultiPartFormPostsTest.java
@@ -13,7 +13,6 @@
package org.apache.juneau.examples.rest;
import static org.junit.Assert.*;
-import static org.apache.juneau.internal.FileUtils.*;
import java.io.*;
@@ -34,7 +33,8 @@ public class TestMultiPartFormPostsTest extends RestTestcase {
@Test
public void testUpload() throws Exception {
RestClient client = SamplesMicroservice.DEFAULT_CLIENT;
- File f = createTempFile("testMultiPartFormPosts.txt");
+ File f = new File("tmp/testMultiPartFormPosts.txt");
+ f.deleteOnExit();
try (FileWriter fw = new FileWriter(f)) {
IOPipe.create(new StringReader("test!"), fw).run();
}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/response/DefaultHandler.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/response/DefaultHandler.java
index 548369f..6d31c83 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/response/DefaultHandler.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/response/DefaultHandler.java
@@ -53,7 +53,12 @@ public class DefaultHandler implements ResponseHandler {
MediaType mediaType = res.getMediaType();
if (mediaType == null)
mediaType = sm.getMediaType();
-
res.setContentType(s.getResponseContentType().toString());
+
+ MediaType responseType = s.getResponseContentType();
+ if (responseType == null)
+ responseType = mediaType;
+
+ res.setContentType(responseType.toString());
try {
RequestProperties p = res.getProperties();
--
To stop receiving notification emails like this one, please contact
[email protected].