Repository: incubator-juneau Updated Branches: refs/heads/master 1dfd1c76b -> 39cecfc7a
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/HasQuery.java ---------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/HasQuery.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/HasQuery.java index f355ebd..d7dc349 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/HasQuery.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/HasQuery.java @@ -31,7 +31,7 @@ import org.apache.juneau.rest.*; * * <h5 class='section'>Example:</h5> * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>) * <jk>public void</jk> doPost(<ja>@HasQuery</ja>(<js>"p1"</js>) <jk>boolean</jk> p1, <ja>@Body</ja> Bean myBean) { * ... * } @@ -40,7 +40,7 @@ import org.apache.juneau.rest.*; * <p> * This is functionally equivalent to the following code... * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>) * <jk>public void</jk> doGet(RestRequest req) { * <jk>boolean</jk> p1 = req.hasQueryParameter(<js>"p1"</js>); * ... http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Header.java ---------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Header.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Header.java index d7758b1..2efe4ea 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Header.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Header.java @@ -23,7 +23,7 @@ import java.lang.annotation.*; * * <h5 class='section'>Example:</h5> * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>) * <jk>public void</jk> doGet(RestRequest req, RestResponse res, <ja>@Header</ja>(<js>"ETag"</js>) UUID etag) { * ... * } @@ -32,7 +32,7 @@ import java.lang.annotation.*; * <p> * This is functionally equivalent to the following code... * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>) * <jk>public void</jk> doPostPerson(RestRequest req, RestResponse res) { * UUID etag = req.getHeader(UUID.<jk>class</jk>, "ETag"); * ... http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Messages.java ---------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Messages.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Messages.java index 921b0bc..630aa77 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Messages.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Messages.java @@ -29,7 +29,7 @@ import org.apache.juneau.utils.*; * * <h5 class='section'>Example:</h5> * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>) * <jk>public</jk> String doGet(<ja>@Messages</ja> ResourceBundle messages) { * <jk>return</jk> messages.getString(<js>"myLocalizedMessage"</js>); * } @@ -38,7 +38,7 @@ import org.apache.juneau.utils.*; * <p> * This is functionally equivalent to the following code... * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>) * <jk>public</jk> String doGet(RestRequest req) { * <jk>return</jk> req.getMessage(<js>"myLocalizedMessage"</js>); * } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/MethodSwagger.java ---------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/MethodSwagger.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/MethodSwagger.java index 2b45609..8500286 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/MethodSwagger.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/MethodSwagger.java @@ -130,7 +130,7 @@ public @interface MethodSwagger { * <h5 class='section'>Example:</h5> * <p class='bcode'> * <ja>@RestMethod</ja>( - * name=<js>"POST"</js>, path=<js>"/{a}"</js>, + * name=<jsf>POST</jsf>, path=<js>"/{a}"</js>, * description=<js>"This is my method."</js>, * swagger=<ja>@MethodSwagger</ja>( * parameters={ @@ -177,7 +177,7 @@ public @interface MethodSwagger { * <h5 class='section'>Example:</h5> * <p class='bcode'> * <ja>@RestMethod</ja>( - * name=<js>"GET"</js>, path=<js>"/"</js>, + * name=<jsf>GET</jsf>, path=<js>"/"</js>, * swagger=<ja>@MethodSwagger</ja>( * responses={ * <ja>@Response</ja>(200), http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Path.java ---------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Path.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Path.java index 212f290..6959e1c 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Path.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Path.java @@ -23,7 +23,7 @@ import java.lang.annotation.*; * * <h5 class='section'>Example:</h5> * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/myurl/{foo}/{bar}/{baz}/*"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/myurl/{foo}/{bar}/{baz}/*"</js>) * <jk>public void</jk> doGet(RestRequest req, RestResponse res, * <ja>@Path</ja> String foo, <ja>@Path</ja> <jk>int</jk> bar, <ja>@Path</ja> UUID baz) { * ... @@ -36,7 +36,7 @@ import java.lang.annotation.*; * variables in the URL path pattern. * The following example is equivalent to the previous example. * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/myurl/{foo}/{bar}/{baz}/*"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/myurl/{foo}/{bar}/{baz}/*"</js>) * <jk>public void</jk> doGet(RestRequest req, RestResponse res, * String foo, <jk>int</jk> bar, UUID baz) { * ... @@ -49,7 +49,7 @@ import java.lang.annotation.*; * The following example is equivalent to the previous example, except the parameter order has been switched, requiring * the use of the <ja>@Path</ja> annotations. * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/myurl/{foo}/{bar}/{baz}/*"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/myurl/{foo}/{bar}/{baz}/*"</js>) * <jk>public void</jk> doGet(RestRequest req, RestResponse res, * <ja>@Path</ja>(<js>"baz"</js>) UUID baz, <ja>@Path</ja>(<js>"foo"</js>) String foo, <ja>@Path</ja>(<js>"bar"</js>) <jk>int</jk> bar) { * ... @@ -59,7 +59,7 @@ import java.lang.annotation.*; * <p> * You can also use <code>{#}</code> notation to specify path parameters without specifying names. * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/myurl/{0}/{1}/{2}/*"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/myurl/{0}/{1}/{2}/*"</js>) * <jk>public void</jk> doGet(RestRequest req, RestResponse res, * <ja>@Path</ja> String foo, <ja>@Path</ja> <jk>int</jk> bar, <ja>@Path</ja> UUID baz) { * ... http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/PathRemainder.java ---------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/PathRemainder.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/PathRemainder.java index 85496a1..36fcd25 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/PathRemainder.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/PathRemainder.java @@ -23,7 +23,7 @@ import java.lang.annotation.*; * * <h5 class='section'>Example:</h5> * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/foo/*"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/foo/*"</js>) * <jk>public void</jk> doGet(RestRequest req, RestResponse res, <ja>@PathRemainder</ja> String remainder) { * ... * } @@ -32,7 +32,7 @@ import java.lang.annotation.*; * <p> * This is functionally equivalent to the following code... * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/foo/*"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/foo/*"</js>) * <jk>public void</jk> doGet(RestRequest req, RestResponse res) { * String remainder = req.getPathRemainder(); * ... http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Properties.java ---------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Properties.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Properties.java index c00269f..ee2fdf2 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Properties.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Properties.java @@ -25,7 +25,7 @@ import org.apache.juneau.*; * * <h5 class='section'>Example:</h5> * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>) * <jk>public Person</jk> doGetPerson(<ja>@Properties</ja> ObjectMap properties) { * properties.put(<jsf>HTMLDOC_title</jsf>, <js>"This is a person"</js>); * ... @@ -35,7 +35,7 @@ import org.apache.juneau.*; * <p> * This is functionally equivalent to the following code... * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>) * <jk>public Person</jk> doGetPerson(RestResponse res) { * ObjectMap properties = res.getProperties(); * properties.put(<jsf>HTMLDOC_title</jsf>, <js>"This is a person"</js>); @@ -46,7 +46,7 @@ import org.apache.juneau.*; * <p> * ...or this... * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>) * <jk>public Person</jk> doGetPerson(RestResponse res) { * res.setProperty(<jsf>HTMLDOC_title</jsf>, <js>"This is a person"</js>); * ... http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Query.java ---------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Query.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Query.java index 4738d11..6406ebe 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Query.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Query.java @@ -31,7 +31,7 @@ import org.apache.juneau.rest.*; * * <h5 class='section'>Example:</h5> * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>) * <jk>public void</jk> doGet(RestRequest req, RestResponse res, * <ja>@Query</ja>(<js>"p1"</js>) <jk>int</jk> p1, <ja>@Query</ja>(<js>"p2"</js>) String p2, <ja>@Query</ja>(<js>"p3"</js>) UUID p3) { * ... @@ -41,7 +41,7 @@ import org.apache.juneau.rest.*; * <p> * This is functionally equivalent to the following code... * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>) * <jk>public void</jk> doGet(RestRequest req, RestResponse res) { * <jk>int</jk> p1 = req.getQueryParameter(<jk>int</jk>.<jk>class</jk>, <js>"p1"</js>, 0); * String p2 = req.getQueryParameter(String.<jk>class</jk>, <js>"p2"</js>); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java ---------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java index ba629a6..90bb10f 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java @@ -45,6 +45,9 @@ public @interface RestMethod { * Method names are case-insensitive (always folded to upper-case). * * <p> + * Note that you can use {@link org.apache.juneau.http.HttpMethodName} for constant values. + * + * <p> * Besides the standard HTTP method names, the following can also be specified: * <ul class='spaced-list'> * <li> @@ -90,10 +93,10 @@ public @interface RestMethod { * The path can contain variables that get resolved to {@link Path @Path} parameters: * <p class='bcode'> * <jc>// Example 1</jc> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/myurl/{foo}/{bar}/{baz}/*"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/myurl/{foo}/{bar}/{baz}/*"</js>) * * <jc>// Example 2</jc> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/myurl/{0}/{1}/{2}/*"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/myurl/{0}/{1}/{2}/*"</js>) * </p> * * <p> @@ -172,7 +175,7 @@ public @interface RestMethod { * <jk>public class</jk> MyResource <jk>extends</jk> RestServlet { * * <ja>@RestMethod</ja>( - * name=<js>"GET"</js>, + * name=<jsf>GET</jsf>, * path=<js>"/foo"</js>, * serializers=MySpecialSerializer.<jk>class</jk>, * serializersInherit=<jsf>SERIALIZERS</jsf> @@ -224,7 +227,7 @@ public @interface RestMethod { * <jk>public class</jk> MyResource <jk>extends</jk> RestServlet { * * <ja>@RestMethod</ja>( - * name=<js>"PUT"</js>, + * name=<jsf>PUT</jsf>, * path=<js>"/foo"</js>, * parsers=MySpecialParser.<jk>class</jk>, * parsersInherit=<jsf>PARSERS</jsf> @@ -275,7 +278,7 @@ public @interface RestMethod { * <jk>public class</jk> MyResource <jk>extends</jk> RestServlet { * * <ja>@RestMethod</ja>( - * name=<js>"PUT"</js>, + * name=<jsf>PUT</jsf>, * path=<js>"/foo"</js>, * encoders={GzipEncoder.<jk>class</jk>} * ) @@ -346,11 +349,11 @@ public @interface RestMethod { * } * * <jc>// Only render "id" property.</jc> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/mybeans"</js>, bpi=<js>"MyBean: id"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/mybeans"</js>, bpi=<js>"MyBean: id"</js>) * <jk>public</jk> List<MyBean> getBeanSummary(); * * <jc>// Only render "a" and "b" properties.</jc> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/mybeans/{id}"</js>, bpi=<js>"MyBean: a,b"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/mybeans/{id}"</js>, bpi=<js>"MyBean: a,b"</js>) * <jk>public</jk> MyBean getBeanDetails(<ja>@Path</ja> String id); * </p> * @@ -392,11 +395,11 @@ public @interface RestMethod { * } * * <jc>// Don't show "a" and "b" properties.</jc> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/mybeans"</js>, bpx=<js>"MyBean: a,b"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/mybeans"</js>, bpx=<js>"MyBean: a,b"</js>) * <jk>public</jk> List<MyBean> getBeanSummary(); * * <jc>// Render all properties.</jc> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/mybeans/{id}"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/mybeans/{id}"</js>) * <jk>public</jk> MyBean getBeanDetails(<ja>@Path</ja> String id); * </p> * @@ -438,7 +441,7 @@ public @interface RestMethod { * <h5 class='section'>Example:</h5> * <p class='bcode'> * <jc>// Assume "text/json" Accept value when Accept not specified</jc> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/*"</js>, defaultRequestHeaders={<js>"Accept: text/json"</js>}) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/*"</js>, defaultRequestHeaders={<js>"Accept: text/json"</js>}) * <jk>public</jk> String doGet() { * ... * } @@ -461,7 +464,7 @@ public @interface RestMethod { * * <h5 class='section'>Example:</h5> * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/*"</js>, defaultQuery={<js>"foo=bar"</js>}) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/*"</js>, defaultQuery={<js>"foo=bar"</js>}) * <jk>public</jk> String doGet(<ja>@Query</ja>(<js>"foo"</js>) String foo) { * ... * } @@ -485,7 +488,7 @@ public @interface RestMethod { * * <h5 class='section'>Example:</h5> * <p class='bcode'> - * <ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/*"</js>, defaultFormData={<js>"foo=bar"</js>}) + * <ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/*"</js>, defaultFormData={<js>"foo=bar"</js>}) * <jk>public</jk> String doGet(<ja>@FormData</ja>(<js>"foo"</js>) String foo) { * ... * } @@ -571,19 +574,19 @@ public @interface RestMethod { * <p class='bcode'> * <jc>// Call this method if X-Client-Version is at least 2.0. * // Note that this also matches 2.0.1.</jc> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/foobar"</js>, clientVersion=<js>"2.0"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/foobar"</js>, clientVersion=<js>"2.0"</js>) * <jk>public</jk> Object method1() { * ... * } * * <jc>// Call this method if X-Client-Version is at least 1.1, but less than 2.0.</jc> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/foobar"</js>, clientVersion=<js>"[1.1,2.0)"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/foobar"</js>, clientVersion=<js>"[1.1,2.0)"</js>) * <jk>public</jk> Object method2() { * ... * } * * <jc>// Call this method if X-Client-Version is less than 1.1.</jc> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/foobar"</js>, clientVersion=<js>"[0,1.1)"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/foobar"</js>, clientVersion=<js>"[0,1.1)"</js>) * <jk>public</jk> Object method3() { * ... * } @@ -594,13 +597,13 @@ public @interface RestMethod { * backwards compatibility. * <p class='bcode'> * <jc>// Call this method if X-Client-Version is at least 2.0.</jc> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/foobar"</js>, clientVersion=<js>"2.0"</js>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/foobar"</js>, clientVersion=<js>"2.0"</js>) * <jk>public</jk> NewPojo newMethod() { * ... * } * * <jc>// Call this method if X-Client-Version is at least 1.1, but less than 2.0.</jc> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/foobar"</js>, clientVersion=<js>"[1.1,2.0)"</js>, transforms={NewToOldPojoSwap.<jk>class</jk>}) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/foobar"</js>, clientVersion=<js>"[1.1,2.0)"</js>, transforms={NewToOldPojoSwap.<jk>class</jk>}) * <jk>public</jk> NewPojo oldMethod() { * <jk>return</jk> newMethod() * } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/converters/Traversable.java ---------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/converters/Traversable.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/converters/Traversable.java index 4768da2..76842b3 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/converters/Traversable.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/converters/Traversable.java @@ -28,7 +28,7 @@ import org.apache.juneau.utils.*; * * <p class='bcode'> * <jc>// Resource method on resource "http://localhost:8080/sample/addressBook"</jc> - * <ja>@RestMethod</ja>(name=<js>"GET"</js>, converters=Traversable.<jk>class</jk>) + * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, converters=Traversable.<jk>class</jk>) * <jk>public void</jk> doGet(RestRequest req, RestResponse res) { * <jk>return new</jk> AddressBook(); * } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/package.html ---------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/package.html b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/package.html index b433c00..fa775d0 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/package.html +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/package.html @@ -252,7 +252,7 @@ <jk>public class</jk> HelloWorldResource <jk>extends</jk> Resource { <jd>/** GET request handler */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/*"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/*"</js>) <jk>public</jk> String sayHello() { <jk>return</jk> <js>"Hello world!"</js>; } @@ -562,7 +562,7 @@ </p> <p class='bcode'> <jd>/** GET request handler */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>) <jk>public</jk> String sayHello() { <jk>return</jk> <js>"Hello world!"</js>; } @@ -590,13 +590,13 @@ </p> <p class='bcode'> <jc>// Equivalent method 1</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>) <jk>public void</jk> doGet(RestResponse res) { res.setOutput(<js>"Hello World!"</js>); } <jc>// Equivalent method 2</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>) <jk>public</jk> String doGet() { <jk>return</jk> <js>"Hello World!"</js>; } @@ -734,7 +734,7 @@ </ul> <p class='bcode'> <jc>// Example GET request using annotated attributes</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/example1/{a1}/{a2}/{a3}/*"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/example1/{a1}/{a2}/{a3}/*"</js>) <jk>public</jk> String doGetExample1( RestRequest req, RestResponse res, @@ -766,7 +766,7 @@ </p> <p class='bcode'> <jc>// Example GET with access to HTTP headers</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/*"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/*"</js>) <jk>public</jk> String doGet(<ja>@Header</ja>(<js>"Accept-Language"</js>) String lang, <ja>@Header</ja>(<js>"ETag"</js>) UUID eTag) <jk>throws</jk> Exception { ... } @@ -792,19 +792,19 @@ </p> <p class='bcode'> <jc>// Default method</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/*"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/*"</js>) <jk>public void</jk> doGetDefault() { ... } <jc>// Method with path pattern</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/xxx"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/xxx"</js>) <jk>public void</jk> doGetNoArgs(...) { ... } <jc>// Method with path pattern with arguments</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/xxx/{foo}/{bar}/{baz}/{bing}"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/xxx/{foo}/{bar}/{baz}/{bing}"</js>) <jk>public void</jk> doGetWithArgs(<ja>@Path</ja> String foo, <ja>@Path</ja> <jk>int</jk> bar, <ja>@Path</ja> MyEnum baz, <ja>@Path</ja> UUID bing) { ... } @@ -815,25 +815,25 @@ </p> <p class='bcode'> <jc>// Try first </jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/foo/bar"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/foo/bar"</js>) <jk>public void</jk> method1() { ... } <jc>// Try second</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/foo/{bar}"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/foo/{bar}"</js>) <jk>public void</jk> method2(...) { ... } <jc>// Try third</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/foo/*"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/foo/*"</js>) <jk>public void</jk> method3(...) { ... } <jc>// Try last</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/*"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/*"</js>) <jk>public void</jk> method4(...) { ... } @@ -856,12 +856,12 @@ The following example shows the distinction. </p> <p class='bcode'> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/*"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/*"</js>) <jk>public void</jk> doGet(<ja>@PathRemainder</ja> String remainder) { <jc>// URL path pattern can have remainder accessible through req.getRemainder().</jc> } - <ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/"</js>) + <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/"</js>) <jk>public void</jk> doPut() { <jc>// URL path pattern must match exactly and will cause a 404 error if a remainder exists.</jc> } @@ -872,7 +872,7 @@ </p> <p class='bcode'> <jc>// Example GET request with access to query parameters</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/urlWithParams"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/urlWithParams"</js>) <jk>public</jk> String doGetWithParams(<ja>@Query</ja>(<js>"foo"</js>) String foo, <ja>@Query</ja>(<js>"bar"</js>) <jk>int</jk> bar, <ja>@Query</ja>(<js>"baz"</js>) UUID baz) <jk>throws</jk> Exception { <jk>return</jk> <js>"GET /urlWithParams?foo="</js>+foo+<js>"&bar="</js>+bar+<js>"&baz="</js>+baz); } @@ -890,13 +890,13 @@ </p> <p class='bcode'> <jc>// GET method that gets invoked for administrators</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/*"</js>, matchers=IsAdminMatcher.<jk>class</jk>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/*"</js>, matchers=IsAdminMatcher.<jk>class</jk>) <jk>public</jk> Object doGetForAdmin() { ... } <jc>// GET method that gets invoked for everyone else</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/*"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/*"</js>) <jk>public</jk> Object doGetForEveryoneElse() { ... } @@ -943,7 +943,7 @@ </p> <p class='bcode'> <jc>// Example POST of a bean</jc> - <ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/"</js>) + <ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/"</js>) <jk>public void</jk> doPost(<ja>@Body</ja> Person person) <jk>throws</jk> Exception { <jc>// Do something with person.</jc> } @@ -955,13 +955,13 @@ </p> <p class='bcode'> <jc>// Equivalent method 1</jc> - <ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/example1"</js>) + <ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/example1"</js>) <jk>public void</jk> doPost1(<ja>@Body</ja> Person p) { <jc>// Do something with p.</jc> } <jc>// Equivalent method 2</jc> - <ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/example2"</js>) + <ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/example2"</js>) <jk>public void</jk> doPost2(RestRequest req) { Person p = req.getBody).asType(Person.<jk>class</jk>); <jc>// Do something with p.</jc> @@ -993,7 +993,7 @@ <jk>public class</jk> UrlEncodedFormResource <jk>extends</jk> Resource { <jd>/** POST request handler */</jd> - <ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/"</js>) + <ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/"</js>) <jk>public</jk> Object doPost(<ja>@Body</ja> FormInputBean input) <jk>throws</jk> Exception { <jc>// Just mirror back the request</jc> <jk>return</jk> input; @@ -1012,7 +1012,7 @@ </p> <p class='bcode'> <jd>/** POST request handler */</jd> - <ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/"</js>) + <ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/"</js>) <jk>public</jk> Object doPost(<ja>@FormData</ja>(<js>"aString"</js>) String aString, <ja>@FormData</ja>(<js>"aNumber"</js>) <jk>int</jk> aNumber, <ja>@FormData</ja>(<js>"aDate"</js>) Calendar aDate) <jk>throws</jk> Exception { ... } @@ -1054,7 +1054,7 @@ * [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=<js>"POST"</js>, 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); @@ -1100,14 +1100,14 @@ </ul> <p class='bcode'> <jc>// Equivalent method 1</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/example1/{personId}"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/example1/{personId}"</js>) <jk>public</jk> Person doGet1(<ja>@Path</ja> UUID personId) { Person p = getPersonById(personId); <jk>return</jk> p; } <jc>// Equivalent method 2</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/example2/{personId}"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/example2/{personId}"</js>) <jk>public void</jk> doGet2(RestResponse res, <ja>@Path</ja> UUID personId) { Person p = getPersonById(personId); res.setOutput(p); @@ -1115,7 +1115,7 @@ <jc>// (Sorta) Equivalent method 3</jc> <jc>// (Ignores any converters or method-level properties)</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/example3/{personId}"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/example3/{personId}"</js>) <jk>public void</jk> doGet3(RestRequest req, RestResponse res, <ja>@Path</ja> UUID personId) { Person p = getPersonById(personId); String accept = req.getHeader(<js>"Accept"</js>, <js>"text/json"</js>); @@ -1240,7 +1240,7 @@ * <ja>@param</ja> req The HTTP request. * <ja>@return</ja> A bean containing the contents for the OPTIONS page. */</jd> - <ja>@RestMethod</ja>(name=<js>"OPTIONS"</js>, path=<js>"/*"</js>, + <ja>@RestMethod</ja>(name=<jsf>OPTIONS</jsf>, path=<js>"/*"</js>, summary=<js>"Resource options"</js>, htmldoc=<ja>@HtmlDoc</ja>( links={ @@ -1373,7 +1373,7 @@ </p> <p class='bcode'> <ja>@RestMethod</ja>( - name=<js>"GET"</js>, + name=<jsf>GET</jsf>, path=<js>"/people/{id}/*"</js>, converters={Traversable.<jk>class</jk>,Queryable.<jk>class</jk>,Introspectable.<jk>class</jk>}, description=<js>"Get a person by id in the address book"</js>, @@ -1394,7 +1394,7 @@ </p> <p class='bcode'> <ja>@RestMethod</ja>( - name=<js>"GET"</js>, + name=<jsf>GET</jsf>, path=<js>"/people/{id}/*"</js>, converters={Traversable.<jk>class</jk>,Queryable.<jk>class</jk>,Introspectable.<jk>class</jk>} <jc>// Don't specify annotations for labels...they'll be detected in resource bundle.</jc> @@ -1532,7 +1532,7 @@ } <jc>// Example #2 - Serializers defined on method through annotation</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/*"</js> + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/*"</js> serializers={JsonSerializer.<jk>class</jk>, XmlSerializer.<jk>class</jk>} ) <jk>public</jk> Object doGet() { @@ -1601,7 +1601,7 @@ } <jc>// Example #2 - Parsers defined on method through annotation</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/*"</js> + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/*"</js> parsers={JsonParser.<jk>class</jk>, XmlParser.<jk>class</jk>} ) <jk>public void</jk> doPut(<ja>@Body</ja> Foo input) { @@ -1679,7 +1679,7 @@ <p class='bcode'> <jc>// GET method with method-level properties</jc> <ja>@RestMethod</ja>( - name=<js>"GET"</js>, path=<js>"/*"</js>, + name=<jsf>GET</jsf>, path=<js>"/*"</js>, properties={ <jc>// Nulls should not be serialized</jc> <ja>@Property</ja>(name=<jsf>TRIM_NULLS</jsf>, value=<js>"true"</js>), @@ -1829,7 +1829,7 @@ </p> <p class='bcode'> <jc>// DELETE method</jc> - <ja>@RestMethod</ja>(name=<js>"DELETE"</js>, guards={AdminGuard.<jk>class</jk>}) + <ja>@RestMethod</ja>(name=<jsf>DELETE</jsf>, guards={AdminGuard.<jk>class</jk>}) <jk>public void</jk> doDelete(RestRequest req, RestResponse res) <jk>throws</jk> Exception { ... </p> @@ -1891,7 +1891,7 @@ <jc>// Traversable conversion enabled to allow nodes in returned POJO tree to be addressed.</jc> <jc>// Queryable conversion enabled to allow returned POJO to be searched/viewed/sorted.</jc> <ja>@RestMethod</ja>( - name=<js>"GET"</js>, path=<js>"/people/{id}/*"</js>, + name=<jsf>GET</jsf>, path=<js>"/people/{id}/*"</js>, converters={Traversable.<jk>class</jk>,Queryable.<jk>class</jk>} ) <jk>public</jk> Person getPerson(<ja>@Path</ja> <jk>int</jk> id) { @@ -2064,7 +2064,7 @@ * <ja>@param</ja> req The HTTP request. * <ja>@return</ja> The bean containing links to the child resources. */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/"</js>, description=<js>"Child resources"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>, description=<js>"Child resources"</js>) <jk>public</jk> ChildResourceDescriptions getChildren(RestRequest req) { <jk>return new</jk> ChildResourceDescriptions(<jk>this</jk>, req); } @@ -2101,7 +2101,7 @@ <jk>public</jk> MyRestServlet <jk>extends</jk> RestServlet { <jc>// Returns the localized greeting from the "greeting" key in MyMessages.properties</jc> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>) <jk>public</jk> String printLocalizedGreeting(RestRequest req) { <jk>return</jk> req.getMessage(<js>"greeting"</js>); } @@ -2111,7 +2111,7 @@ {@link org.apache.juneau.rest.annotation.Messages @Messages} annotation: </p> <p class='bcode'> - <ja>@RestMethod</ja>(name=<js>"GET"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>) <jk>public</jk> String printLocalizedGreeting(<ja>@Messages</ja> ResourceBundle messages) { <jk>return</jk> messages.getString(<js>"greeting"</js>); } @@ -2436,13 +2436,13 @@ <jk>private static final long</jk> <jsf>serialVersionUID</jsf> = 1L; <jd>/** GET request handler */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/"</js>) + <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.getReaderResource(<js>"UrlEncodedForm.html"</js>, <jk>true</jk>); } <jd>/** POST request handler */</jd> - <ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/"</js>) + <ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/"</js>) <jk>public</jk> Object doPost(<ja>@Body</ja> FormInputBean input) <jk>throws</jk> Exception { <jc>// Just mirror back the request</jc> <jk>return</jk> input; @@ -2793,7 +2793,7 @@ * GET request handler. * Specify the GET parameter "?person=X" for a specialized message! */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>) <jk>public</jk> String sayHello(RestRequest req) { <jk>return</jk> req.getConfig().getString(<js>"HelloWorldResource/message"</js>); } @@ -2831,7 +2831,7 @@ * GET request handler. * Specify the GET parameter "?person=X" for a specialized message! */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>) <jk>public</jk> String sayHello(RestRequest req) { <jk>return</jk> req.getConfig().getString(<js>"HelloWorldResource/message"</js>); } @@ -3197,7 +3197,7 @@ } <jd>/** GET request handler for list of all photos */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/"</js>) + <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>); @@ -3205,7 +3205,7 @@ } <jd>/** GET request handler for single photo */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/{id}"</js>, serializers=ImageSerializer.<jk>class</jk>) + <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>) @@ -3214,14 +3214,14 @@ } <jd>/** PUT request handler */</jd> - <ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/{id}"</js>, parsers=ImageParser.<jk>class</jk>) + <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)); <jk>return</jk> <js>"OK"</js>; } <jd>/** POST request handler */</jd> - <ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/"</js>, parsers=ImageParser.<jk>class</jk>) + <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); @@ -3230,7 +3230,7 @@ } <jd>/** DELETE request handler */</jd> - <ja>@RestMethod</ja>(name=<js>"DELETE"</js>, path=<js>"/{id}"</js>) + <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>) @@ -3239,7 +3239,7 @@ } <jd>/** OPTIONS request handler */</jd> - <ja>@RestMethod</ja>(name=<js>"OPTIONS"</js>, path=<js>"/*"</js>) + <ja>@RestMethod</ja>(name=<jsf>OPTIONS</jsf>, path=<js>"/*"</js>) <jk>public</jk> Swagger getOptions(RestRequest req) { <jk>return</jk> req.getSwagger(); } @@ -3564,7 +3564,7 @@ * [GET /] * Get root page. */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/"</js>, + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>, converters=Queryable.<jk>class</jk> ) <jk>public</jk> Link[] getRoot() <jk>throws</jk> Exception { @@ -3580,7 +3580,7 @@ * Traversable transforming enabled to allow nodes in returned POJO tree to be addressed. * Introspectable transforming enabled to allow public methods on the returned object to be invoked. */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/people/*"</js>, + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/people/*"</js>, converters={Traversable.<jk>class</jk>,Queryable.<jk>class</jk>,Introspectable.<jk>class</jk>} ) <jk>public</jk> List<Person> getAllPeople() <jk>throws</jk> Exception { @@ -3593,7 +3593,7 @@ * Traversable transforming enabled to allow nodes in returned POJO tree to be addressed. * Introspectable transforming enabled to allow public methods on the returned object to be invoked. */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/people/{id}/*"</js>, + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/people/{id}/*"</js>, converters={Traversable.<jk>class</jk>,Queryable.<jk>class</jk>,Introspectable.<jk>class</jk>} ) <jk>public</jk> Person getPerson(<ja>@Path</ja> <jk>int</jk> id) <jk>throws</jk> Exception { @@ -3604,7 +3604,7 @@ * [GET /addresses/*] * Get all addresses in the address book. */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/addresses/*"</js>, + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/addresses/*"</js>, converters={Traversable.<jk>class</jk>,Queryable.<jk>class</jk>} ) <jk>public</jk> List<Address> getAllAddresses() <jk>throws</jk> Exception { @@ -3615,7 +3615,7 @@ * [GET /addresses/{id}/*] * Get a single address by ID. */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/addresses/{id}/*"</js>, + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/addresses/{id}/*"</js>, converters={Traversable.<jk>class</jk>,Queryable.<jk>class</jk>} ) <jk>public</jk> Address getAddress(<ja>@Path</ja> <jk>int</jk> id) <jk>throws</jk> Exception { @@ -3626,7 +3626,7 @@ * [POST /people] * Create a new Person bean. */</jd> - <ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/people"</js>, + <ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/people"</js>, guards=AdminGuard.<jk>class</jk> ) <jk>public</jk> Redirect createPerson(<ja>@Body</ja> CreatePerson cp) <jk>throws</jk> Exception { @@ -3638,7 +3638,7 @@ * [POST /people/{id}/addresses] * Create a new Address bean. */</jd> - <ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/people/{id}/addresses"</js>, + <ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/people/{id}/addresses"</js>, guards=AdminGuard.<jk>class</jk> ) <jk>public</jk> Redirect createAddress(<ja>@Path</ja> <jk>int</jk> id, <ja>@Body</ja> CreateAddress ca) <jk>throws</jk> Exception { @@ -3651,7 +3651,7 @@ * [DELETE /people/{id}] * Delete a Person bean. */</jd> - <ja>@RestMethod</ja>(name=<js>"DELETE"</js>, path=<js>"/people/{id}"</js>, + <ja>@RestMethod</ja>(name=<jsf>DELETE</jsf>, path=<js>"/people/{id}"</js>, guards=AdminGuard.<jk>class</jk>, ) <jk>public</jk> String deletePerson(<ja>@Path</ja> <jk>int</jk> id) <jk>throws</jk> Exception { @@ -3663,7 +3663,7 @@ * [DELETE /addresses/{id}] * Delete an Address bean. */</jd> - <ja>@RestMethod</ja>(name=<js>"DELETE"</js>, path=<js>"/addresses/{id}"</js>, + <ja>@RestMethod</ja>(name=<jsf>DELETE</jsf>, path=<js>"/addresses/{id}"</js>, guards=AdminGuard.<jk>class</jk> ) <jk>public</jk> String deleteAddress(<ja>@Path</ja> <jk>int</jk> addressId) <jk>throws</jk> Exception { @@ -3679,7 +3679,7 @@ * [PUT /people/{id}/*] * Change property on Person bean. */</jd> - <ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/people/{id}/*"</js>, + <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/people/{id}/*"</js>, guards=AdminGuard.<jk>class</jk> ) <jk>public</jk> String updatePerson(RestRequest req, <ja>@Path</ja> <jk>int</jk> id, <ja>@PathRemainder</ja> String pathRemainder) <jk>throws</jk> Exception { @@ -3699,7 +3699,7 @@ * [PUT /addresses/{id}/*] * Change property on Address bean. */</jd> - <ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/addresses/{id}/*"</js>, + <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/addresses/{id}/*"</js>, guards=AdminGuard.<jk>class</jk> ) <jk>public</jk> String updateAddress(RestRequest req, <ja>@Path</ja> <jk>int</jk> id, <ja>@PathRemainder</ja> String pathRemainder) <jk>throws</jk> Exception { @@ -3731,7 +3731,7 @@ * [GET /cognos] * Get data in Cognos/XML format */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/cognos"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/cognos"</js>) <jk>public</jk> DataSet getCognosData() <jk>throws</jk> Exception { <jc>// The Cognos metadata</jc> @@ -3757,7 +3757,7 @@ * View resource options */</jd> <ja>@Override</ja> /* RestServletDefault */ - <ja>@RestMethod</ja>(name=<js>"OPTIONS"</js>, path=<js>"/*"</js>) + <ja>@RestMethod</ja>(name=<jsf>OPTIONS</jsf>, path=<js>"/*"</js>) <jk>public</jk> Swagger getOptions(RestRequest req) { <jk>return</jk> req.getSwagger(); } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServlet.java ---------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServlet.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServlet.java index 8cb8f96..4254a83 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServlet.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServlet.java @@ -13,6 +13,7 @@ package org.apache.juneau.rest.remoteable; import static javax.servlet.http.HttpServletResponse.*; +import static org.apache.juneau.http.HttpMethodName.*; import java.util.*; import java.util.concurrent.*; @@ -66,7 +67,7 @@ public abstract class RemoteableServlet extends RestServletDefault { * @return The list of links to the remote interfaces. * @throws Exception */ - @RestMethod(name="GET", path="/") + @RestMethod(name=GET, path="/") public List<Link> getInterfaces(RestRequest req) throws Exception { List<Link> l = new LinkedList<Link>(); boolean useAll = ! useOnlyAnnotated(); @@ -84,7 +85,7 @@ public abstract class RemoteableServlet extends RestServletDefault { * @return The methods defined on the interface. * @throws Exception */ - @RestMethod(name="GET", path="/{javaInterface}") + @RestMethod(name=GET, path="/{javaInterface}") public Collection<String> listMethods(@Path String javaInterface) throws Exception { return getMethods(javaInterface).keySet(); } @@ -98,7 +99,7 @@ public abstract class RemoteableServlet extends RestServletDefault { * @return The results from invoking the specified Java method. * @throws Exception */ - @RestMethod(name="POST", path="/{javaInterface}/{javaMethod}") + @RestMethod(name=POST, path="/{javaInterface}/{javaMethod}") public Object invoke(RestRequest req, @Path String javaInterface, @Path String javaMethod) throws Exception { // Find the parser. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/ContentTypeMenuItem.java ---------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/ContentTypeMenuItem.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/ContentTypeMenuItem.java index 226a951..36498ec 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/ContentTypeMenuItem.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/ContentTypeMenuItem.java @@ -34,7 +34,7 @@ import org.apache.juneau.utils.*; * a drop-down menu item for rendering all other supported content types in plain text: * <p class='bcode'> * <ja>@RestMethod</ja>( - * name=<js>"GET"</js>, + * name=<jsf>GET</jsf>, * path=<js>"/"</js>, * widgets={ * ContentTypeMenuItem.<jk>class</jk>, http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/QueryMenuItem.java ---------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/QueryMenuItem.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/QueryMenuItem.java index d4eab91..f244aea 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/QueryMenuItem.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/QueryMenuItem.java @@ -31,7 +31,7 @@ import org.apache.juneau.rest.converters.*; * search/view/sort capabilities against the collection of POJOs: * <p class='bcode'> * <ja>@RestMethod</ja>( - * name=<js>"GET"</js>, + * name=<jsf>GET</jsf>, * path=<js>"/"</js>, * widgets={ * QueryMenuItem.<jk>class</jk>, http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/StyleMenuItem.java ---------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/StyleMenuItem.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/StyleMenuItem.java index de6e7f6..c5b8d0c 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/StyleMenuItem.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/StyleMenuItem.java @@ -29,7 +29,7 @@ import org.apache.juneau.utils.*; * a drop-down menu item for rendering all other supported content types in plain text: * <p class='bcode'> * <ja>@RestMethod</ja>( - * name=<js>"GET"</js>, + * name=<jsf>GET</jsf>, * path=<js>"/"</js>, * widgets={ * StyleMenuItem.<jk>class</jk>, http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/Tooltip.java ---------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/Tooltip.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/Tooltip.java index 829c740..2eb2793 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/Tooltip.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/Tooltip.java @@ -40,7 +40,7 @@ import org.apache.juneau.dto.html5.*; * <ja>@Override</ja> * <jk>public</jk> Object getContent(RestRequest req) <jk>throws</jk> Exception { * <jk>return</jk> div( - * <jsm>form</jsm>().id(<js>"form"</js>).action(<js>"servlet:/form"</js>).method(<js>"POST"</js>).children( + * <jsm>form</jsm>().id(<js>"form"</js>).action(<js>"servlet:/form"</js>).method(<jsf>POST</jsf>).children( * <jsm>table</jsm>( * <jsm>tr</jsm>( * <jsm>th</jsm>(<js>"Field 1:"</js>),
