This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/juneau-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new 1090af8  Petstore documentation.
1090af8 is described below

commit 1090af8483253f8fbba87b2401ded3885fcffebb
Author: JamesBognar <[email protected]>
AuthorDate: Fri Sep 13 13:17:44 2019 -0400

    Petstore documentation.
---
 content/petstore.html              |  60 +++++++++++++++++++++++++++++++++++++
 content/petstore/1.png             | Bin 1878139 -> 0 bytes
 content/petstore/2a.png            | Bin 20939 -> 0 bytes
 content/petstore/2b.png            | Bin 21099 -> 0 bytes
 content/petstore/2c.png            | Bin 18792 -> 0 bytes
 content/petstore/2d.png            | Bin 29067 -> 0 bytes
 content/petstore/3a.png            | Bin 196893 -> 0 bytes
 content/petstore/3b.png            | Bin 376985 -> 0 bytes
 content/petstore/4a.png            | Bin 274461 -> 0 bytes
 content/petstore/4b.png            | Bin 165332 -> 0 bytes
 content/petstore/5a.png            | Bin 195096 -> 0 bytes
 content/petstore/5b.png            | Bin 20719 -> 0 bytes
 content/petstore/6a.png            | Bin 172281 -> 0 bytes
 content/petstore/6b.png            | Bin 185001 -> 0 bytes
 content/petstore/7a.png            | Bin 157815 -> 0 bytes
 content/petstore/7b.png            | Bin 166928 -> 0 bytes
 content/petstore/8a.png            | Bin 199619 -> 0 bytes
 content/petstore/PetStore_pets.png | Bin 0 -> 233639 bytes
 18 files changed, 60 insertions(+)

diff --git a/content/petstore.html b/content/petstore.html
index d76cc6a..d9b8185 100644
--- a/content/petstore.html
+++ b/content/petstore.html
@@ -415,6 +415,66 @@
                <img class='bordered w800' src='petstore/PetStore.png'>
        
                <p>
+                       The methods defined in our <c>PetStore</c> interface 
are implemented like so:
+               </p>            
+               <h5 class='figure'>PetStoreResource.java</h5>
+               <p class='bcode w800'>
+       <ja>@Override</ja> <jc>/* PetStore */</jc>
+       <ja>@RestMethod</ja>(
+               name=<jsf>GET</jsf>,
+               path=<js>"/pet"</js>,
+               summary=<js>"All pets in the store"</js>,
+               swagger=<ja>@MethodSwagger</ja>(
+                       tags=<js>"pet"</js>,
+                       parameters={
+                               Queryable.<jsf>SWAGGER_PARAMS</jsf>  <jc>// 
Documents searching.</jc>
+                       }
+               ),
+               converters={Queryable.<jk>class</jk>}  <jc>// Searching 
support.</jc>
+       )
+       <ja>@BeanConfig</ja>(
+               bpx=<js>"Pet: tags,photo"</js>  <jc>// In this view, don't 
serialize tags/photos properties.</jc>
+       )
+       <jk>public</jk> Collection&lt;Pet&gt; getPets() <jk>throws</jk> 
NotAcceptable {
+               <jk>return</jk> <jf>store</jf>.getPets();
+       }
+
+       <ja>@Override</ja> <jc>/* PetStore */</jc>
+       <ja>@RestMethod</ja>(
+               name=<jsf>GET</jsf>,
+               path=<js>"/pet/{petId}"</js>,
+               summary=<js>"Find pet by ID"</js>,
+               description=<js>"Returns a single pet"</js>,
+               swagger=<ja>@MethodSwagger</ja>(
+                       tags=<js>"pet"</js>
+               )
+       )
+       <jk>public</jk> Pet getPet(long petId) <jk>throws</jk> IdNotFound, 
NotAcceptable {
+               <jk>return</jk> <jf>store</jf>.getPet(petId);
+       }
+
+       <ja>@Override</ja> <jc>/* PetStore */</jc>
+       <ja>@RestMethod</ja>(
+               name=<jsf>POST</jsf>,
+               path=<js>"/pet"</js>,
+               summary=<js>"Add a new pet to the store"</js>,
+               swagger=<ja>@MethodSwagger</ja>(
+                       tags=<js>"pet"</js>
+               ),
+               roleGuard=<js>"ROLE_ADMIN || (ROLE_USER &amp;&amp; 
ROLE_WRITABLE)"</js>  <jc>// Restrict access to this method.</jc>
+       )
+       <jk>public long</jk> createPet(CreatePet pet) <jk>throws</jk> 
IdConflict, NotAcceptable, UnsupportedMediaType {
+               <jk>return</jk> <jf>store</jf>.create(pet).getId();
+               </p>            
+               <p>
+                       After running the <c>Main</c> method in the client code 
to populate the database, the page renders as follows:
+               </p>
+               <p class='bcode w800'>
+       http://localhost:5000/petstore/pets
+               </p>                    
+               <img class='bordered w800' src='petstore/PetStore_pets.png'>
+       
+               <p>
                        The <l>OPTIONS</l> menu items takes you to the 
auto-generated Swagger UI for the application:
                </p>
                <p class='bcode w900'>
diff --git a/content/petstore/1.png b/content/petstore/1.png
deleted file mode 100644
index fc65f06..0000000
Binary files a/content/petstore/1.png and /dev/null differ
diff --git a/content/petstore/2a.png b/content/petstore/2a.png
deleted file mode 100644
index 9515c5c..0000000
Binary files a/content/petstore/2a.png and /dev/null differ
diff --git a/content/petstore/2b.png b/content/petstore/2b.png
deleted file mode 100644
index 2afcbcf..0000000
Binary files a/content/petstore/2b.png and /dev/null differ
diff --git a/content/petstore/2c.png b/content/petstore/2c.png
deleted file mode 100644
index 7e27708..0000000
Binary files a/content/petstore/2c.png and /dev/null differ
diff --git a/content/petstore/2d.png b/content/petstore/2d.png
deleted file mode 100644
index 014fcf6..0000000
Binary files a/content/petstore/2d.png and /dev/null differ
diff --git a/content/petstore/3a.png b/content/petstore/3a.png
deleted file mode 100644
index ae029d8..0000000
Binary files a/content/petstore/3a.png and /dev/null differ
diff --git a/content/petstore/3b.png b/content/petstore/3b.png
deleted file mode 100644
index 9193b1d..0000000
Binary files a/content/petstore/3b.png and /dev/null differ
diff --git a/content/petstore/4a.png b/content/petstore/4a.png
deleted file mode 100644
index 2f47259..0000000
Binary files a/content/petstore/4a.png and /dev/null differ
diff --git a/content/petstore/4b.png b/content/petstore/4b.png
deleted file mode 100644
index 5a91391..0000000
Binary files a/content/petstore/4b.png and /dev/null differ
diff --git a/content/petstore/5a.png b/content/petstore/5a.png
deleted file mode 100644
index 5c88c5a..0000000
Binary files a/content/petstore/5a.png and /dev/null differ
diff --git a/content/petstore/5b.png b/content/petstore/5b.png
deleted file mode 100644
index 46cd848..0000000
Binary files a/content/petstore/5b.png and /dev/null differ
diff --git a/content/petstore/6a.png b/content/petstore/6a.png
deleted file mode 100644
index ddbee32..0000000
Binary files a/content/petstore/6a.png and /dev/null differ
diff --git a/content/petstore/6b.png b/content/petstore/6b.png
deleted file mode 100644
index 9c04552..0000000
Binary files a/content/petstore/6b.png and /dev/null differ
diff --git a/content/petstore/7a.png b/content/petstore/7a.png
deleted file mode 100644
index ffd41ce..0000000
Binary files a/content/petstore/7a.png and /dev/null differ
diff --git a/content/petstore/7b.png b/content/petstore/7b.png
deleted file mode 100644
index e65d56c..0000000
Binary files a/content/petstore/7b.png and /dev/null differ
diff --git a/content/petstore/8a.png b/content/petstore/8a.png
deleted file mode 100644
index 3cc3f6f..0000000
Binary files a/content/petstore/8a.png and /dev/null differ
diff --git a/content/petstore/PetStore_pets.png 
b/content/petstore/PetStore_pets.png
new file mode 100644
index 0000000..e5e5c72
Binary files /dev/null and b/content/petstore/PetStore_pets.png differ

Reply via email to