Add new HttpMethodName class. Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau/commit/39cecfc7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau/tree/39cecfc7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau/diff/39cecfc7
Branch: refs/heads/master Commit: 39cecfc7ace2ad629bbc5f43d1244b60e4b4257a Parents: 1dfd1c7 Author: JamesBognar <[email protected]> Authored: Mon Oct 2 18:32:39 2017 -0400 Committer: JamesBognar <[email protected]> Committed: Mon Oct 2 18:32:39 2017 -0400 ---------------------------------------------------------------------- .../java/org/apache/juneau/ini/package.html | 4 +- .../apache/juneau/dto/jsonschema/package.html | 6 +- .../main/java/org/apache/juneau/BeanMeta.java | 7 +- .../org/apache/juneau/http/HttpMethodName.java | 56 ++++ .../apache/juneau/remoteable/RemoteMethod.java | 4 +- juneau-doc/src/main/javadoc/overview.html | 126 ++++---- .../juneau/examples/rest/AtomFeedResource.java | 5 +- .../examples/rest/CodeFormatterResource.java | 7 +- .../juneau/examples/rest/DirectoryResource.java | 8 +- .../examples/rest/DockerRegistryResource.java | 5 +- .../examples/rest/HelloWorldResource.java | 4 +- .../examples/rest/JsonSchemaResource.java | 6 +- .../examples/rest/MethodExampleResource.java | 10 +- .../juneau/examples/rest/PetStoreResource.java | 9 +- .../juneau/examples/rest/PhotosResource.java | 11 +- .../juneau/examples/rest/SqlQueryResource.java | 7 +- .../examples/rest/SystemPropertiesResource.java | 17 +- .../juneau/examples/rest/TempDirResource.java | 7 +- .../examples/rest/TumblrParserResource.java | 6 +- .../examples/rest/UrlEncodedFormResource.java | 7 +- .../rest/addressbook/AddressBookResource.java | 27 +- .../org/apache/juneau/microservice/package.html | 6 +- .../microservice/resources/ConfigResource.java | 17 +- .../microservice/resources/DebugResource.java | 8 +- .../resources/DirectoryResource.java | 7 +- .../microservice/resources/LogsResource.java | 5 +- .../resources/ShutdownResource.java | 4 +- .../microservice/sample/HelloWorldResource.java | 4 +- .../juneau/rest/test/AcceptCharsetResource.java | 6 +- .../test/BeanContextPropertiesResource.java | 4 +- .../apache/juneau/rest/test/BpiResource.java | 34 +- .../rest/test/CallbackStringsResource.java | 6 +- .../rest/test/CharsetEncodingsResource.java | 3 +- .../juneau/rest/test/ClientFuturesResource.java | 4 +- .../juneau/rest/test/ClientVersionResource.java | 22 +- .../apache/juneau/rest/test/ConfigResource.java | 6 +- .../juneau/rest/test/ContentResource.java | 20 +- .../rest/test/DefaultContentTypesResource.java | 13 +- .../rest/test/ErrorConditionsResource.java | 20 +- .../juneau/rest/test/FormDataResource.java | 11 +- .../apache/juneau/rest/test/GroupsResource.java | 7 +- .../apache/juneau/rest/test/GzipResource.java | 18 +- .../juneau/rest/test/HeadersResource.java | 70 +++-- .../juneau/rest/test/InheritanceResource.java | 29 +- .../rest/test/InterfaceProxyResource.java | 5 +- .../juneau/rest/test/LargePojosResource.java | 6 +- .../juneau/rest/test/MessagesResource.java | 4 +- .../juneau/rest/test/NlsPropertyResource.java | 6 +- .../apache/juneau/rest/test/NlsResource.java | 16 +- .../juneau/rest/test/NoParserInputResource.java | 7 +- .../juneau/rest/test/OnPostCallResource.java | 5 +- .../juneau/rest/test/OnPreCallResource.java | 5 +- .../rest/test/OptionsWithoutNlsResource.java | 6 +- .../rest/test/OverlappingMethodsResource.java | 32 +- .../apache/juneau/rest/test/ParamsResource.java | 97 +++--- .../juneau/rest/test/ParsersResource.java | 11 +- .../apache/juneau/rest/test/PathResource.java | 8 +- .../juneau/rest/test/PathVariablesResource.java | 10 +- .../apache/juneau/rest/test/PathsResource.java | 10 +- .../juneau/rest/test/PropertiesResource.java | 5 +- .../apache/juneau/rest/test/QueryResource.java | 10 +- .../rest/test/RequestBeanProxyResource.java | 9 +- .../juneau/rest/test/RestClient2Resource.java | 4 +- .../juneau/rest/test/RestHooksInitResource.java | 11 +- .../java/org/apache/juneau/rest/test/Root.java | 4 +- .../juneau/rest/test/SerializersResource.java | 11 +- .../juneau/rest/test/StaticFilesResource.java | 4 +- .../rest/test/ThirdPartyProxyResource.java | 311 ++++++++++--------- .../juneau/rest/test/TransformsResource.java | 14 +- .../apache/juneau/rest/test/UrisResource.java | 26 +- .../juneau/rest/test/UrlContentResource.java | 10 +- .../apache/juneau/rest/test/ContentTest.java | 54 ++-- .../org/apache/juneau/rest/test/ParamsTest.java | 16 +- .../java/org/apache/juneau/rest/Redirect.java | 8 +- .../apache/juneau/rest/RequestPathMatch.java | 2 +- .../org/apache/juneau/rest/ResponseHandler.java | 2 +- .../org/apache/juneau/rest/RestContext.java | 2 +- .../org/apache/juneau/rest/RestConverter.java | 2 +- .../java/org/apache/juneau/rest/RestGuard.java | 2 +- .../org/apache/juneau/rest/RestMatcher.java | 4 +- .../org/apache/juneau/rest/RestResponse.java | 2 +- .../apache/juneau/rest/RestServletDefault.java | 4 +- .../juneau/rest/RestServletGroupDefault.java | 4 +- .../org/apache/juneau/rest/annotation/Body.java | 6 +- .../apache/juneau/rest/annotation/FormData.java | 4 +- .../juneau/rest/annotation/HasFormData.java | 4 +- .../apache/juneau/rest/annotation/HasQuery.java | 4 +- .../apache/juneau/rest/annotation/Header.java | 4 +- .../apache/juneau/rest/annotation/Messages.java | 4 +- .../juneau/rest/annotation/MethodSwagger.java | 4 +- .../org/apache/juneau/rest/annotation/Path.java | 8 +- .../juneau/rest/annotation/PathRemainder.java | 4 +- .../juneau/rest/annotation/Properties.java | 6 +- .../apache/juneau/rest/annotation/Query.java | 4 +- .../juneau/rest/annotation/RestMethod.java | 37 ++- .../juneau/rest/converters/Traversable.java | 2 +- .../java/org/apache/juneau/rest/package.html | 122 ++++---- .../rest/remoteable/RemoteableServlet.java | 7 +- .../juneau/rest/widget/ContentTypeMenuItem.java | 2 +- .../juneau/rest/widget/QueryMenuItem.java | 2 +- .../juneau/rest/widget/StyleMenuItem.java | 2 +- .../org/apache/juneau/rest/widget/Tooltip.java | 2 +- 102 files changed, 902 insertions(+), 738 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/package.html ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/package.html b/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/package.html index aeda8c4..111048a 100644 --- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/package.html +++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/package.html @@ -588,7 +588,7 @@ * <ja>@return</ja> The config file. * <ja>@throws</ja> Exception */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/"</js>, description=<js>"Show contents of config file."</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jfs>, path=<js>"/"</js>, description=<js>"Show contents of config file."</js>) <jk>public</jk> ConfigFile getConfigContents() <jk>throws</jk> Exception { <jk>return</jk> getConfig(); } @@ -639,7 +639,7 @@ * <ja>@return</ja> The new config file contents. * <ja>@throws</ja> Exception */</jd> - <ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/"</js>, + <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/"</js>, description=<js>"Sets contents of config file."</js>, parameters={ <ja>@Parameter</ja>(in=<js>"body"</js>, description=<js>"New contents in INI file format."</js>) http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/jsonschema/package.html ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/jsonschema/package.html b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/jsonschema/package.html index a70f4ff..92a023f 100644 --- a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/jsonschema/package.html +++ b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/jsonschema/package.html @@ -456,7 +456,7 @@ } <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> Schema getSchema() <jk>throws</jk> Exception { <jk>return</jk> <jf>schema</jf>; } @@ -465,14 +465,14 @@ * PUT request handler. * Replaces the schema document with the specified content, and then mirrors it as the response. */</jd> - <ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/"</js>) + <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/"</js>) <jk>public</jk> Schema setSchema(<ja>@Body</ja> Schema schema) <jk>throws</jk> Exception { <jk>this</jk>.<jf>schema</jf> = schema; <jk>return</jk> <jk>this</jk>.<jf>schema</jf>; } <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> ResourceOptions doOptions(RestRequest req) { <jk>return new</jk> ResourceOptions(<jk>this</jk>, req); } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java index bd370ae..fc50475 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java @@ -717,9 +717,10 @@ public class BeanMeta<T> { return constructor.newInstance((Object[])null); InvocationHandler h = classMeta.getProxyInvocationHandler(); if (h != null) { - ClassLoader cl = classMeta.getBeanContext().classLoader; - if (cl == null) - cl = this.getClass().getClassLoader(); +// ClassLoader cl = classMeta.getBeanContext().classLoader; +// if (cl == null) +// cl = this.getClass().getClassLoader(); + ClassLoader cl = classMeta.innerClass.getClassLoader(); return (T)Proxy.newProxyInstance(cl, new Class[] { classMeta.innerClass, java.io.Serializable.class }, h); } } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/HttpMethodName.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/HttpMethodName.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/HttpMethodName.java new file mode 100644 index 0000000..73f64df --- /dev/null +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/HttpMethodName.java @@ -0,0 +1,56 @@ +// *************************************************************************************************************************** +// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * +// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * +// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * +// * with the License. You may obtain a copy of the License at * +// * * +// * http://www.apache.org/licenses/LICENSE-2.0 * +// * * +// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * +// * specific language governing permissions and limitations under the License. * +// *************************************************************************************************************************** +package org.apache.juneau.http; + +/** + * Represents valid HTTP 1.1 method name static strings per the RFC 2616 spec. + * + * <h6 class='topic'>Additional Information</h6> + * <ul class='doctree'> + * <li class='extlink'> + * <a class='doclink' href='https://www.w3.org/Protocols/rfc2616/rfc2616.html'> + * Hypertext Transfer Protocol -- HTTP/1.1</a> + * </ul> + */ +public final class HttpMethodName { + + /** <a class='doclink' href='https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.2'>OPTIONS</a> */ + public static final String OPTIONS = "OPTIONS"; + + /** <a class='doclink' href='https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3'>GET</a> */ + public static final String GET = "GET"; + + /** <a class='doclink' href='https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4'>HEAD</a> */ + public static final String HEAD = "HEAD"; + + /** <a class='doclink' href='https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5'>POST</a> */ + public static final String POST = "POST"; + + /** <a class='doclink' href='https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6'>PUT</a> */ + public static final String PUT = "PUT"; + + /** <a class='doclink' href='https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.7'>DELETE</a> */ + public static final String DELETE = "DELETE"; + + /** <a class='doclink' href='https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.8'>TRACE</a> */ + public static final String TRACE = "TRACE"; + + /** <a class='doclink' href='https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.9'>CONNECT</a> */ + public static final String CONNECT = "CONNECT"; + + /** Special case for a REST method that implements a proxy interface. */ + public static final String PROXY = "PROXY"; + + /** A non-standard value. */ + public static final String OTHER = "OTHER"; +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethod.java ---------------------------------------------------------------------- diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethod.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethod.java index 906f992..dc6f6f5 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethod.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethod.java @@ -65,8 +65,8 @@ public @interface RemoteMethod { * <p> * Possible values: * <ul> - * <li><js>"POST"</js> (default) - Parameters are serialized using the serializer registered with the RestClient. - * <li><js>"GET"</js> - Parameters are serialized using the UrlEncodingSerializer registered with the RestClient. + * <li><jsf>POST</jsf> (default) - Parameters are serialized using the serializer registered with the RestClient. + * <li><jsf>GET</jsf> - Parameters are serialized using the UrlEncodingSerializer registered with the RestClient. * </ul> * * <p> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-doc/src/main/javadoc/overview.html ---------------------------------------------------------------------- diff --git a/juneau-doc/src/main/javadoc/overview.html b/juneau-doc/src/main/javadoc/overview.html index 2304c63..333a410 100644 --- a/juneau-doc/src/main/javadoc/overview.html +++ b/juneau-doc/src/main/javadoc/overview.html @@ -3109,7 +3109,7 @@ <jk>public class</jk> SystemPropertiesResource <jk>extends</jk> RestServletDefault { <ja>@RestMethod</ja>( - name=<js>"GET"</js>, path=<js>"/"</js>, + name=<jsf>GET</jsf>, path=<js>"/"</js>, summary=<js>"Show all system properties"</js>, description=<js>"Returns all system properties defined in the JVM."</js>, parameters={ @@ -3128,7 +3128,7 @@ } <ja>@RestMethod</ja>( - name=<js>"GET"</js>, path=<js>"/{propertyName}"</js>, + name=<jsf>GET</jsf>, path=<js>"/{propertyName}"</js>, summary=<js>"Get system property"</js>, description=<js>"Returns the value of the specified system property."</js>, parameters={ @@ -3144,7 +3144,7 @@ } <ja>@RestMethod</ja>( - name=<js>"PUT"</js>, path=<js>"/{propertyName}"</js>, + name=<jsf>PUT</jsf>, path=<js>"/{propertyName}"</js>, summary=<js>"Replace system property"</js>, description=<js>"Sets a new value for the specified system property."</js>, guards=AdminGuard.<jk>class</jk>, @@ -3169,7 +3169,7 @@ } <ja>@RestMethod</ja>( - name=<js>"POST"</js>, path=<js>"/"</js>, + name=<jsf>POST</jsf>, path=<js>"/"</js>, summary=<js>"Add an entire set of system properties"</js>, description=<js>"Takes in a map of key/value pairs and creates a set of new system properties."</js>, guards=AdminGuard.<jk>class</jk>, @@ -3195,7 +3195,7 @@ } <ja>@RestMethod</ja>( - name=<js>"DELETE"</js>, path=<js>"/{propertyName}"</js>, + name=<jsf>DELETE</jsf>, path=<js>"/{propertyName}"</js>, summary=<js>"Delete system property"</js>, description=<js>"Deletes the specified system property."</js>, guards=AdminGuard.<jk>class</jk>, @@ -3219,7 +3219,7 @@ } <ja>@RestMethod</ja>( - name=<js>"OPTIONS"</js>, path=<js>"/*"</js>, + name=<jsf>OPTIONS</jsf>, path=<js>"/*"</js>, summary=<js>"Show resource options"</js>, description=<js>"Show resource options as a Swagger doc"</js> ) @@ -3445,7 +3445,7 @@ <li> Extending from <code>RemoteableServlet</code>. <li> - Using a <code><ja>@RestMethod</ja>(name=<js>"PROXY"</js>)</code> annotation on a Java method. + Using a <code><ja>@RestMethod</ja>(name=<jsf>PROXY</jsf>)</code> annotation on a Java method. </ol> <p> The <code>RemoteableServlet</code> class is a simple specialized servlet with an abstract @@ -3474,14 +3474,14 @@ } </p> <p> - The <code><ja>@RestMethod</ja>(name=<js>"PROXY"</js>)</code> approach is easier if you only have a single + The <code><ja>@RestMethod</ja>(name=<jsf>PROXY</jsf>)</code> approach is easier if you only have a single interface you want to expose. You simply define a Java method whose return type is an interface, and return the implementation of that interface: </p> <p class='bcode'> <jc>// Our exposed proxy object.</jc> - <ja>@RestMethod</ja>(name=<js>"PROXY"</js>, path=<js>"/addressbookproxy/*"</js>) + <ja>@RestMethod</ja>(name=<jsf>PROXY</jsf>, path=<js>"/addressbookproxy/*"</js>) <jk>public</jk> IAddressBook getProxy() { <jk>return</jk> addressBook; } @@ -3772,7 +3772,7 @@ <ja>@Remoteable</ja> <jk>public interface</jk> MyProxyInterface { - <ja>@RemoteMethod</ja>(httpMethod=<js>"POST"</js>, path=<js>"/method"</js>) + <ja>@RemoteMethod</ja>(httpMethod=<jsf>POST</jsf>, path=<js>"/method"</js>) String callMyMethod(<ja>@Header</ja>(<js>"E-Tag"</js>) UUID etag, <ja>@Query</ja>(<js>"debug"</js>) <jk>boolean</jk> debug, <ja>@Body</ja> MyPojo pojo); } @@ -4305,7 +4305,7 @@ <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> String sayHello() { <jk>return</jk> <js>"Hello world!"</js>; } @@ -4398,7 +4398,7 @@ <jk>private static final long</jk> <jsf>serialVersionUID</jsf> = 1L; <jd>/** Example GET request that redirects to our example method */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>) <jk>public</jk> Redirect doExample() <jk>throws</jk> Exception { <jk>return new</jk> Redirect(<js>"example1/xxx/123/{0}/xRemainder?q1=123&q2=yyy"</js>, UUID.<jsm>randomUUID</jsm>()); @@ -4408,7 +4408,7 @@ * Methodology #1 - GET request using annotated attributes. * This approach uses annotated parameters for retrieving input. */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/example1/{p1}/{p2}/{p3}/*"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/example1/{p1}/{p2}/{p3}/*"</js>) <jk>public</jk> String example1( <ja>@Method</ja> String method, <jc>// HTTP method.</jc> <ja>@Path</ja> String p1, <jc>// Path variables.</jc> @@ -4434,7 +4434,7 @@ * Methodology #2 - GET request using methods on RestRequest and RestResponse. * This approach uses low-level request/response objects to perform the same as above. */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/example2/{p1}/{p2}/{p3}/*"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/example2/{p1}/{p2}/{p3}/*"</js>) <jk>public</jk> String example2( RestRequest req, <jc>// A direct subclass of HttpServletRequest.</jc> RestResponse res <jc>// A direct subclass of HttpServletResponse.</jc> @@ -4475,7 +4475,7 @@ * This approach uses intermediate-level APIs. * The framework recognizes the parameter types and knows how to resolve them. */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/example3/{p1}/{p2}/{p3}/*"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/example3/{p1}/{p2}/{p3}/*"</js>) <jk>public</jk> String example3( HttpMethod method, <jc>// HTTP method.</jc> RequestPathMatch path, <jc>// Path variables.</jc> @@ -4607,7 +4607,7 @@ <h6 class='figure'>RestServletDefault.java</h6> <p class='bcode'> <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(); } @@ -4706,13 +4706,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; @@ -4821,7 +4821,7 @@ <jk>import static</jk> org.apache.juneau.dto.html5.HtmlBuilder.*; <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> Div doGet(RestRequest req) { <jk>return</jk> div( script(<js>"text/javascript"</js>, @@ -4832,7 +4832,7 @@ +<js>"\n document.getElementById('results').innerHTML = buffBody.innerHTML;"</js> +<js>"\n }"</js> ), - <jsf>form</jsf>().id(<js>"form"</js>).action(req.getServletURI()).method(<js>"POST"</js>).target(<js>"buff"</js>).children( + <jsf>form</jsf>().id(<js>"form"</js>).action(req.getServletURI()).method(<jsf>POST</jsf>).target(<js>"buff"</js>).children( <jsf>table</jsf>( <jsf>tr</jsf>( <jsf>th</jsf>(req.getMessage(<js>"aString"</js>)), @@ -4929,7 +4929,7 @@ <jk>public class</jk> RequestEchoResource <jk>extends</jk> Resource { <jd>/** GET request handler */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/*"</js>, converters={Queryable.<jk>class</jk>,Traversable.<jk>class</jk>}) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/*"</js>, converters={Queryable.<jk>class</jk>,Traversable.<jk>class</jk>}) <jk>public</jk> HttpServletRequest doGet(RestRequest req, RestResponse res, <ja>@Properties</ja> ObjectMap properties) { <jc>// Set the HtmlDocSerializer title programmatically.</jc> res.setPageTitle(req.getPathInfo()); @@ -5520,7 +5520,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 { @@ -5536,7 +5536,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> AddressBook getAllPeople() <jk>throws</jk> Exception { @@ -5549,7 +5549,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 { @@ -5560,7 +5560,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 { @@ -5571,7 +5571,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 { @@ -5582,7 +5582,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 { @@ -5594,7 +5594,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 { @@ -5607,7 +5607,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 { @@ -5619,7 +5619,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 { @@ -5635,7 +5635,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> @@ -5656,7 +5656,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, @@ -5689,7 +5689,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> @@ -5715,7 +5715,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(); } @@ -5769,7 +5769,7 @@ to locate and update individual nodes in a POJO tree using the path remainder on the request. <li> The <l>doInit()</l> method shows an example of an overloaded method using the - <l>@RestMethod(name="INIT")</l> annotation. + <l>@RestMethod(name=<jsf>INIT</jsf>)</l> annotation. <li> The <l>getOptions()</l> method shows the default OPTIONS page augmented with some additional information. @@ -6299,7 +6299,7 @@ <jd>/** * [GET /upload] - Display the form entry page for uploading a file to the temp directory. */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/upload"</js>) + <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.getReaderResource(<js>"TempDirUploadPage.html"</js>, <jk>true</jk>); } @@ -6308,7 +6308,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>, + <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(); @@ -6473,7 +6473,7 @@ <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> Feed getFeed() <jk>throws</jk> Exception { <jk>return</jk> <jf>feed</jf>; } @@ -6482,7 +6482,7 @@ * PUT request handler. * Replaces the feed with the specified content, and then mirrors it as the response. */</jd> - <ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/"</js>) + <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>this</jk>.<jf>feed</jf> = feed; <jk>return</jk> feed; @@ -6548,7 +6548,7 @@ <jd>/** [GET /] - Show child resources. */</jd> <ja>@SuppressWarnings</ja>(<js>"nls"</js>) - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/"</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>) @@ -6559,7 +6559,7 @@ * PUT request handler. * Replaces the feed with the specified content, and then mirrors it as the response. */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/search"</js>) + <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>); @@ -6635,12 +6635,12 @@ <jk>public class</jk> TumblrParserResource <jk>extends</jk> Resource { <jk>private static final long</jk> <jsf>serialVersionUID</jsf> = 1L; - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>) <jk>public</jk> String getInstructions() <jk>throws</jk> Exception { <jk>return</jk> <js>"Append the Tumblr blog name to the URL above (e.g. /tumblrParser/mytumblrblog)"</js>; } - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/{blogName}"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/{blogName}"</js>) <jk>public</jk> ObjectList parseBlog(<ja>@Path</ja> String blogName) <jk>throws</jk> Exception { ObjectList l = <jk>new</jk> ObjectList(); RestClient rc = <jk>new</jk> RestClientBuilder().build(); @@ -6758,7 +6758,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>); @@ -6766,7 +6766,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>) @@ -6775,14 +6775,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); @@ -6791,7 +6791,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>) @@ -6800,7 +6800,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(); } @@ -6895,7 +6895,7 @@ } <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> Schema getSchema() <jk>throws</jk> Exception { <jk>return</jk> <jf>schema</jf>; } @@ -6904,7 +6904,7 @@ * PUT request handler. * Replaces the schema document with the specified content, and then mirrors it as the response. */</jd> - <ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/"</js>) + <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/"</js>) <jk>public</jk> Schema setSchema(<ja>@Body</ja> Schema schema) <jk>throws</jk> Exception { <jk>this</jk>.<jf>schema</jf> = schema; <jk>return</jk> schema; @@ -6980,13 +6980,13 @@ } <jd>/** GET request handler - Display the query entry page. */</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>"SqlQueryResource.html"</js>, <jk>true</jk>); } <jd>/** POST request handler - Execute the query. */</jd> - <ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/"</js>) + <ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/"</js>) <jk>public</jk> List<Object> doPost(<ja>@Body</ja> PostInput in) <jk>throws</jk> Exception { List<Object> results = <jk>new</jk> LinkedList<Object>(); @@ -7163,7 +7163,7 @@ * <ja>@return</ja> The config file. * <ja>@throws</ja> Exception */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/"</js>, description=<js>"Show contents of config file."</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>, description=<js>"Show contents of config file."</js>) <jk>public</jk> ConfigFile getConfigContents() <jk>throws</jk> Exception { <jk>return</jk> getConfig(); } @@ -7175,7 +7175,7 @@ * <ja>@return</ja> The config file as a reader resource. * <ja>@throws</ja> Exception */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/edit"</js>, description=<js>"Show config file edit page."</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/edit"</js>, description=<js>"Show config file edit page."</js>) <jk>public</jk> ReaderResource getConfigEditPage(RestRequest req) <jk>throws</jk> Exception { <jc>// Note that you don't want variables in the config file to be resolved,</jc> <jc>// so you need to escape any $ characters that you see.</jc> @@ -7190,7 +7190,7 @@ * <ja>@return</ja> The config file section. * <ja>@throws</ja> Exception */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/{section}"</js>, + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/{section}"</js>, description=<js>"Show config file section."</js>, parameters={ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"section"</js>, description=<js>"Section name."</js>) @@ -7208,7 +7208,7 @@ * <ja>@return</ja> The value of the config file entry. * <ja>@throws</ja> Exception */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/{section}/{key}"</js>, + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/{section}/{key}"</js>, description=<js>"Show config file entry."</js>, parameters={ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"section"</js>, description=<js>"Section name."</js>), @@ -7226,7 +7226,7 @@ * <ja>@return</ja> The new config file contents. * <ja>@throws</ja> Exception */</jd> - <ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/"</js>, + <ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/"</js>, description=<js>"Sets contents of config file from a FORM post."</js>, parameters={ <ja>@Parameter</ja>(in=<js>"formData"</js>, name=<js>"contents"</js>, description=<js>"New contents in INI file format."</js>) @@ -7243,7 +7243,7 @@ * <ja>@return</ja> The new config file contents. * <ja>@throws</ja> Exception */</jd> - <ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/"</js>, + <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/"</js>, description=<js>"Sets contents of config file."</js>, parameters={ <ja>@Parameter</ja>(in=<js>"body"</js>, description=<js>"New contents in INI file format."</js>) @@ -7262,7 +7262,7 @@ * <ja>@return</ja> The new section. * <ja>@throws</ja> Exception */</jd> - <ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/{section}"</js>, + <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/{section}"</js>, description=<js>"Add or overwrite a config file section."</js>, parameters={ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"section"</js>, description=<js>"Section name."</js>), @@ -7283,7 +7283,7 @@ * <ja>@return</ja> The new value. * <ja>@throws</ja> Exception */</jd> - <ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/{section}/{key}"</js>, + <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/{section}/{key}"</js>, description=<js>"Add or overwrite a config file entry."</js>, parameters={ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"section"</js>, description=<js>"Section name."</js>), @@ -7443,8 +7443,10 @@ <h3 class='topic' onclick='toggle(this)'>6.4.1 (TBD)</h3> <div class='topic'> - <h6 class='topic'>juneau-dto</h6> + <h6 class='topic'>juneau-marshall</h6> <ul class='spaced-list'> + <li> + New class {@link org.apache.juneau.http.HttpMethodName} with valid static string HTTP method names. </ul> </div> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/AtomFeedResource.java ---------------------------------------------------------------------- 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 7d7eebe..2b15e50 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 @@ -16,6 +16,7 @@ import static org.apache.juneau.dto.atom.AtomBuilder.*; import static org.apache.juneau.html.HtmlDocSerializerContext.*; import static org.apache.juneau.jena.RdfCommonContext.*; import static org.apache.juneau.jena.RdfSerializerContext.*; +import static org.apache.juneau.http.HttpMethodName.*; import java.net.*; @@ -99,7 +100,7 @@ public class AtomFeedResource extends ResourceJena { /** * GET request handler */ - @RestMethod(name="GET", path="/", summary="Get the sample ATOM feed") + @RestMethod(name=GET, path="/", summary="Get the sample ATOM feed") public Feed getFeed() throws Exception { return feed; } @@ -108,7 +109,7 @@ public class AtomFeedResource extends ResourceJena { * PUT request handler. * Replaces the feed with the specified content, and then mirrors it as the response. */ - @RestMethod(name="PUT", path="/", summary="Overwrite the sample ATOM feed") + @RestMethod(name=PUT, path="/", summary="Overwrite the sample ATOM feed") public Feed setFeed(@Body Feed feed) throws Exception { this.feed = feed; return feed; http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/CodeFormatterResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/CodeFormatterResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/CodeFormatterResource.java index cc7ca69..a019683 100644 --- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/CodeFormatterResource.java +++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/CodeFormatterResource.java @@ -13,6 +13,7 @@ package org.apache.juneau.examples.rest; import static org.apache.juneau.dto.html5.HtmlBuilder.*; +import static org.apache.juneau.http.HttpMethodName.*; import org.apache.juneau.dto.html5.*; import org.apache.juneau.microservice.*; @@ -47,7 +48,7 @@ import org.apache.juneau.rest.annotation.*; public class CodeFormatterResource extends Resource { /** [GET /] - Display query entry page. */ - @RestMethod(name="GET", path="/") + @RestMethod(name=GET, path="/") public Div getQueryEntryPage(RestRequest req) { return div( script("text/javascript", @@ -67,7 +68,7 @@ public class CodeFormatterResource extends Resource { +"\n document.getElementById('results').innerHTML = data.innerHTML;" +"\n }" ), - form("form").action("codeFormatter").method("POST").target("buff").children( + form("form").action("codeFormatter").method(POST).target("buff").children( table( tr( th("Language: "), @@ -93,7 +94,7 @@ public class CodeFormatterResource extends Resource { } /** [POST /] - Add syntax highlighting to input. */ - @RestMethod(name="POST", path="/") + @RestMethod(name=POST, path="/") public String executeQuery(@FormData("code") String code, @FormData("lang") String lang) throws Exception { return highlight(code, lang); } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DirectoryResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DirectoryResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DirectoryResource.java index e72b17e..f96d4d5 100644 --- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DirectoryResource.java +++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DirectoryResource.java @@ -13,10 +13,10 @@ package org.apache.juneau.examples.rest; import static org.apache.juneau.rest.annotation.HookEvent.*; - import static java.util.logging.Level.*; import static javax.servlet.http.HttpServletResponse.*; import static org.apache.juneau.html.HtmlDocSerializerContext.*; +import static org.apache.juneau.http.HttpMethodName.*; import java.io.*; import java.net.*; @@ -91,7 +91,7 @@ public class DirectoryResource extends Resource { } /** GET request handler */ - @RestMethod(name="GET", path="/*", converters={Queryable.class}) + @RestMethod(name=GET, path="/*", converters={Queryable.class}) public Object doGet(RestRequest req, @Properties ObjectMap properties) throws Exception { String pathInfo = req.getPathInfo(); @@ -118,7 +118,7 @@ public class DirectoryResource extends Resource { } /** DELETE request handler */ - @RestMethod(name="DELETE", path="/*", guards=AdminGuard.class) + @RestMethod(name=DELETE, path="/*", guards=AdminGuard.class) public Object doDelete(RestRequest req) throws Exception { if (! allowDeletes) @@ -133,7 +133,7 @@ public class DirectoryResource extends Resource { } /** PUT request handler */ - @RestMethod(name="PUT", path="/*", guards=AdminGuard.class) + @RestMethod(name=PUT, path="/*", guards=AdminGuard.class) public Object doPut(RestRequest req) throws Exception { if (! allowPuts) http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DockerRegistryResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DockerRegistryResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DockerRegistryResource.java index abad766..49373fd 100644 --- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DockerRegistryResource.java +++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DockerRegistryResource.java @@ -13,6 +13,7 @@ package org.apache.juneau.examples.rest; import static org.apache.juneau.rest.annotation.HookEvent.*; +import static org.apache.juneau.http.HttpMethodName.*; import java.util.*; @@ -69,7 +70,7 @@ public class DockerRegistryResource extends Resource { /** [GET /] - Show child resources. */ @SuppressWarnings("nls") - @RestMethod(name="GET", path="/") + @RestMethod(name=GET, path="/") public ResourceDescription[] getChildren(RestRequest req) { return new ResourceDescription[] { new ResourceDescription("search", "Search Registry") @@ -80,7 +81,7 @@ public class DockerRegistryResource extends Resource { * PUT request handler. * Replaces the feed with the specified content, and then mirrors it as the response. */ - @RestMethod(name="GET", path="/search") + @RestMethod(name=GET, path="/search") public QueryResults query(@Query("q") String q) throws Exception { String url = registryUrl + "/search" + (q == null ? "" : "?q=" + q); synchronized(rc) { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/HelloWorldResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/HelloWorldResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/HelloWorldResource.java index dcf3b08..833c3e4 100644 --- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/HelloWorldResource.java +++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/HelloWorldResource.java @@ -12,6 +12,8 @@ // *************************************************************************************************************************** package org.apache.juneau.examples.rest; +import static org.apache.juneau.http.HttpMethodName.*; + import org.apache.juneau.microservice.*; import org.apache.juneau.rest.annotation.*; @@ -41,7 +43,7 @@ public class HelloWorldResource extends Resource { private static final long serialVersionUID = 1L; /** GET request handler */ - @RestMethod(name="GET", path="/*", summary="Responds with \"Hello world!\"") + @RestMethod(name=GET, path="/*", summary="Responds with \"Hello world!\"") public String sayHello() { return "Hello world!"; } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/JsonSchemaResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/JsonSchemaResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/JsonSchemaResource.java index 5a201b8..c5506b9 100644 --- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/JsonSchemaResource.java +++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/JsonSchemaResource.java @@ -12,6 +12,8 @@ // *************************************************************************************************************************** package org.apache.juneau.examples.rest; +import static org.apache.juneau.http.HttpMethodName.*; + import org.apache.juneau.dto.jsonschema.*; import org.apache.juneau.microservice.*; import org.apache.juneau.rest.annotation.*; @@ -72,7 +74,7 @@ public class JsonSchemaResource extends ResourceJena { } /** GET request handler */ - @RestMethod(name="GET", path="/", summary="Get the JSON-Schema document") + @RestMethod(name=GET, path="/", summary="Get the JSON-Schema document") public Schema getSchema() throws Exception { return schema; } @@ -81,7 +83,7 @@ public class JsonSchemaResource extends ResourceJena { * PUT request handler. * Replaces the schema document with the specified content, and then mirrors it as the response. */ - @RestMethod(name="PUT", path="/", summary="Overwrite the JSON-Schema document") + @RestMethod(name=PUT, path="/", summary="Overwrite the JSON-Schema document") public Schema setSchema(@Body Schema schema) throws Exception { this.schema = schema; return schema; http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/MethodExampleResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/MethodExampleResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/MethodExampleResource.java index a0c7d44..4b84154 100644 --- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/MethodExampleResource.java +++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/MethodExampleResource.java @@ -12,6 +12,8 @@ // *************************************************************************************************************************** package org.apache.juneau.examples.rest; +import static org.apache.juneau.http.HttpMethodName.*; + import java.util.*; import org.apache.juneau.http.*; @@ -49,7 +51,7 @@ public class MethodExampleResource extends Resource { private static final String SAMPLE_UUID_STRING = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"; /** Example GET request that redirects to our example method */ - @RestMethod(name="GET", path="/") + @RestMethod(name=GET, path="/") public ResourceDescription[] doExample() throws Exception { return new ResourceDescription[] { new ResourceDescription("example1/foo/123/"+SAMPLE_UUID+"/path-remainder?q1=456&q2=bar", "Example 1 - Annotated method attributes."), @@ -62,7 +64,7 @@ public class MethodExampleResource extends Resource { * Methodology #1 - GET request using annotated attributes. * This approach uses annotated parameters for retrieving input. */ - @RestMethod(name="GET", path="/example1/{p1}/{p2}/{p3}/*") + @RestMethod(name=GET, path="/example1/{p1}/{p2}/{p3}/*") public Map<String,Object> example1( @Method String method, // HTTP method. @Path String p1, // Path variables. @@ -96,7 +98,7 @@ public class MethodExampleResource extends Resource { * Methodology #2 - GET request using methods on RestRequest and RestResponse. * This approach uses low-level request/response objects to perform the same as above. */ - @RestMethod(name="GET", path="/example2/{p1}/{p2}/{p3}/*") + @RestMethod(name=GET, path="/example2/{p1}/{p2}/{p3}/*") public void example2( RestRequest req, // A direct subclass of HttpServletRequest. RestResponse res // A direct subclass of HttpServletResponse. @@ -146,7 +148,7 @@ public class MethodExampleResource extends Resource { * This approach uses intermediate-level APIs. * The framework recognizes the parameter types and knows how to resolve them. */ - @RestMethod(name="GET", path="/example3/{p1}/{p2}/{p3}/*") + @RestMethod(name=GET, path="/example3/{p1}/{p2}/{p3}/*") public Map<String,Object> example3( HttpMethod method, // HTTP method. RequestPathMatch path, // Path variables. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PetStoreResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PetStoreResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PetStoreResource.java index 532b554..458d25e 100644 --- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PetStoreResource.java +++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PetStoreResource.java @@ -14,6 +14,7 @@ package org.apache.juneau.examples.rest; import static org.apache.juneau.dto.html5.HtmlBuilder.*; import static org.apache.juneau.rest.annotation.HookEvent.*; +import static org.apache.juneau.http.HttpMethodName.*; import java.util.*; import java.util.Map; @@ -83,7 +84,7 @@ public class PetStoreResource extends ResourceJena { // Exclude the 'breed' and 'getsAlongWith' properties from the beans. @RestMethod( - name="GET", + name=GET, path="/", summary="The complete list of pets in the store", bpx="Pet: breed,getsAlongWith", @@ -111,12 +112,12 @@ public class PetStoreResource extends ResourceJena { } // Shows all bean properties. - @RestMethod(name="GET", path="/{id}", summary="Pet details") + @RestMethod(name=GET, path="/{id}", summary="Pet details") public Pet getPet(@Path("id") Integer id) { return petDB.get(id); } - @RestMethod(name="POST", path="/") + @RestMethod(name=POST, path="/") public Redirect addPet(@Body Pet pet) throws Exception { this.petDB.put(pet.id, pet); return new Redirect("servlet:/"); @@ -176,7 +177,7 @@ public class PetStoreResource extends ResourceJena { @Override public Object getContent(RestRequest req) throws Exception { return div( - form().id("form").action("servlet:/").method("POST").children( + form().id("form").action("servlet:/").method(POST).children( table( tr( th("ID:"), http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PhotosResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PhotosResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PhotosResource.java index 475ef07..9939840 100644 --- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PhotosResource.java +++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PhotosResource.java @@ -14,6 +14,7 @@ package org.apache.juneau.examples.rest; import static javax.servlet.http.HttpServletResponse.*; import static org.apache.juneau.html.HtmlSerializerContext.*; +import static org.apache.juneau.http.HttpMethodName.*; import java.awt.image.*; import java.io.*; @@ -91,13 +92,13 @@ public class PhotosResource extends Resource { } /** GET request handler for list of all photos */ - @RestMethod(name="GET", path="/", summary="Show the list of all currently loaded photos") + @RestMethod(name=GET, path="/", summary="Show the list of all currently loaded photos") public Collection<Photo> getAllPhotos() throws Exception { return photos.values(); } /** GET request handler for single photo */ - @RestMethod(name="GET", path="/{id}", serializers=ImageSerializer.class, summary="Get a photo by ID") + @RestMethod(name=GET, path="/{id}", serializers=ImageSerializer.class, summary="Get a photo by ID") public BufferedImage getPhoto(@Path String id) throws Exception { Photo p = photos.get(id); if (p == null) @@ -106,14 +107,14 @@ public class PhotosResource extends Resource { } /** PUT request handler */ - @RestMethod(name="PUT", path="/{id}", parsers=ImageParser.class, summary="Add or overwrite a photo") + @RestMethod(name=PUT, path="/{id}", parsers=ImageParser.class, summary="Add or overwrite a photo") public String addPhoto(@Path String id, @Body BufferedImage image) throws Exception { photos.put(id, new Photo(id, image)); return "OK"; } /** POST request handler */ - @RestMethod(name="POST", path="/", parsers=ImageParser.class, summary="Add a photo") + @RestMethod(name=POST, path="/", parsers=ImageParser.class, summary="Add a photo") public Photo setPhoto(@Body BufferedImage image) throws Exception { Photo p = new Photo(UUID.randomUUID().toString(), image); photos.put(p.id, p); @@ -121,7 +122,7 @@ public class PhotosResource extends Resource { } /** DELETE request handler */ - @RestMethod(name="DELETE", path="/{id}", summary="Delete a photo by ID") + @RestMethod(name=DELETE, path="/{id}", summary="Delete a photo by ID") public String deletePhoto(@Path String id) throws Exception { Photo p = photos.remove(id); if (p == null) http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SqlQueryResource.java ---------------------------------------------------------------------- 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 7b164af..c8a7ff4 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 @@ -16,6 +16,7 @@ import static javax.servlet.http.HttpServletResponse.*; import static org.apache.juneau.dto.html5.HtmlBuilder.*; import static org.apache.juneau.internal.StringUtils.*; import static org.apache.juneau.rest.annotation.HookEvent.*; +import static org.apache.juneau.http.HttpMethodName.*; import java.sql.*; import java.util.*; @@ -85,7 +86,7 @@ public class SqlQueryResource extends Resource { } /** GET request handler - Display the query entry page. */ - @RestMethod(name="GET", path="/", summary="Display the query entry page") + @RestMethod(name=GET, path="/", summary="Display the query entry page") public Div doGet(RestRequest req, @Query("sql") String sql) { return div( script("text/javascript", @@ -105,7 +106,7 @@ public class SqlQueryResource extends Resource { +"\n document.getElementById('results').innerHTML = data.innerHTML;" +"\n }" ), - form("sqlQuery").method("POST").target("buf").children( + form("sqlQuery").method(POST).target("buf").children( table( tr( th("Position (1-10000):"), @@ -128,7 +129,7 @@ public class SqlQueryResource extends Resource { } /** POST request handler - Execute the query. */ - @RestMethod(name="POST", path="/", summary="Execute one or more queries") + @RestMethod(name=POST, path="/", summary="Execute one or more queries") public List<Object> doPost(@Body PostInput in) throws Exception { List<Object> results = new LinkedList<Object>(); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java index 497a4b1..a22a68b 100644 --- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java +++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java @@ -14,6 +14,7 @@ package org.apache.juneau.examples.rest; import static org.apache.juneau.dto.html5.HtmlBuilder.*; import static org.apache.juneau.html.HtmlDocSerializerContext.*; +import static org.apache.juneau.http.HttpMethodName.*; import java.util.*; import java.util.Map; @@ -91,7 +92,7 @@ public class SystemPropertiesResource extends Resource { private static final long serialVersionUID = 1L; @RestMethod( - name="GET", path="/", + name=GET, path="/", summary="Show all system properties", description="Returns all system properties defined in the JVM.", swagger=@MethodSwagger( @@ -111,7 +112,7 @@ public class SystemPropertiesResource extends Resource { } @RestMethod( - name="GET", path="/{propertyName}", + name=GET, path="/{propertyName}", summary="Get system property", description="Returns the value of the specified system property.", swagger=@MethodSwagger( @@ -128,7 +129,7 @@ public class SystemPropertiesResource extends Resource { } @RestMethod( - name="PUT", path="/{propertyName}", + name=PUT, path="/{propertyName}", summary="Replace system property", description="Sets a new value for the specified system property.", guards=AdminGuard.class, @@ -153,7 +154,7 @@ public class SystemPropertiesResource extends Resource { } @RestMethod( - name="POST", path="/", + name=POST, path="/", summary="Add an entire set of system properties", description="Takes in a map of key/value pairs and creates a set of new system properties.", guards=AdminGuard.class, @@ -178,7 +179,7 @@ public class SystemPropertiesResource extends Resource { } @RestMethod( - name="DELETE", path="/{propertyName}", + name=DELETE, path="/{propertyName}", summary="Delete system property", description="Deletes the specified system property.", guards=AdminGuard.class, @@ -202,7 +203,7 @@ public class SystemPropertiesResource extends Resource { } @RestMethod( - name="GET", path="/formPage", + name=GET, path="/formPage", summary="Form entry page", description="A form post page for setting a single system property value", guards=AdminGuard.class, @@ -216,7 +217,7 @@ public class SystemPropertiesResource extends Resource { ) ) public Form getFormPage() { - return form().method("POST").action("servlet:/formPagePost").children( + return form().method(POST).action("servlet:/formPagePost").children( table( tr( th("Set system property").colspan(2) @@ -233,7 +234,7 @@ public class SystemPropertiesResource extends Resource { } @RestMethod( - name="POST", path="/formPagePost", + name=POST, path="/formPagePost", description="Accepts a simple form post of a system property name/value pair.", guards=AdminGuard.class ) http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java ---------------------------------------------------------------------- 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 6d164d6..ba298c3 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 @@ -13,6 +13,7 @@ package org.apache.juneau.examples.rest; import static org.apache.juneau.dto.html5.HtmlBuilder.*; +import static org.apache.juneau.http.HttpMethodName.*; import java.io.*; @@ -64,10 +65,10 @@ public class TempDirResource extends DirectoryResource { /** * [GET /upload] - Display the form entry page for uploading a file to the temp directory. */ - @RestMethod(name="GET", path="/upload") + @RestMethod(name=GET, path="/upload") public Form getUploadForm() { return - form().id("form").action("servlet:/upload").method("POST").enctype("multipart/form-data") + form().id("form").action("servlet:/upload").method(POST).enctype("multipart/form-data") .children( input().name("contents").type("file"), button("submit", "Submit") @@ -79,7 +80,7 @@ public class TempDirResource extends DirectoryResource { * [POST /upload] - Upload a file as a multipart form post. * Shows how to use the Apache Commons ServletFileUpload class for handling multi-part form posts. */ - @RestMethod(name="POST", path="/upload", matchers=TempDirResource.MultipartFormDataMatcher.class) + @RestMethod(name=POST, path="/upload", matchers=TempDirResource.MultipartFormDataMatcher.class) public Redirect uploadFile(RestRequest req) throws Exception { ServletFileUpload upload = new ServletFileUpload(); FileItemIterator iter = upload.getItemIterator(req); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java index 1fbdca0..c971f2f 100644 --- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java +++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java @@ -12,6 +12,8 @@ // *************************************************************************************************************************** package org.apache.juneau.examples.rest; +import static org.apache.juneau.http.HttpMethodName.*; + import org.apache.juneau.*; import org.apache.juneau.dto.Link; import org.apache.juneau.dto.html5.*; @@ -43,12 +45,12 @@ public class TumblrParserResource extends Resource { private static final int MAX_POSTS = 100; - @RestMethod(name="GET", path="/", summary="Get the instructions page") + @RestMethod(name=GET, path="/", summary="Get the instructions page") public String getInstructions() throws Exception { return "Append the Tumblr blog name to the URL above (e.g. /tumblrParser/mytumblrblog)"; } - @RestMethod(name="GET", path="/{blogName}", summary="Parse the specified blog") + @RestMethod(name=GET, path="/{blogName}", summary="Parse the specified blog") public ObjectList parseBlog(@Path String blogName) throws Exception { ObjectList l = new ObjectList(); RestClient rc = new RestClientBuilder().build(); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UrlEncodedFormResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UrlEncodedFormResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UrlEncodedFormResource.java index 4d18d87..9cc6aa4 100644 --- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UrlEncodedFormResource.java +++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UrlEncodedFormResource.java @@ -13,6 +13,7 @@ package org.apache.juneau.examples.rest; import static org.apache.juneau.dto.html5.HtmlBuilder.*; +import static org.apache.juneau.http.HttpMethodName.*; import java.util.*; @@ -54,7 +55,7 @@ public class UrlEncodedFormResource extends Resource { /** GET request handler */ @RestMethod( - name="GET", + name=GET, path="/", htmldoc=@HtmlDoc( script={ @@ -69,7 +70,7 @@ public class UrlEncodedFormResource extends Resource { ) public Div doGet(RestRequest req) { return div( - form().id("form").action("servlet:/").method("POST").target("buff").children( + form().id("form").action("servlet:/").method(POST).target("buff").children( table( tr( th(req.getMessage("aString")), @@ -97,7 +98,7 @@ public class UrlEncodedFormResource extends Resource { } /** POST request handler */ - @RestMethod(name="POST", path="/") + @RestMethod(name=POST, path="/") public Object doPost(@Body FormInputBean input) throws Exception { // Just mirror back the request return input; http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java index 8776322..fac02f4 100644 --- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java +++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java @@ -16,6 +16,7 @@ import static javax.servlet.http.HttpServletResponse.*; import static org.apache.juneau.html.HtmlDocSerializerContext.*; import static org.apache.juneau.jena.RdfCommonContext.*; import static org.apache.juneau.jena.RdfSerializerContext.*; +import static org.apache.juneau.http.HttpMethodName.*; import java.util.*; @@ -141,7 +142,7 @@ public class AddressBookResource extends ResourceJena { * [GET /] * Get root page. */ - @RestMethod(name="GET", path="/") + @RestMethod(name=GET, path="/") public Link[] getRoot() throws Exception { return new Link[] { new Link("people", "people"), @@ -155,7 +156,7 @@ public class AddressBookResource extends ResourceJena { * Traversable filtering enabled to allow nodes in returned POJO tree to be addressed. * Introspectable filtering enabled to allow public methods on the returned object to be invoked. */ - @RestMethod(name="GET", path="/people/*", + @RestMethod(name=GET, path="/people/*", converters={Traversable.class,Queryable.class,Introspectable.class}, htmldoc=@HtmlDoc( links={ @@ -174,7 +175,7 @@ public class AddressBookResource extends ResourceJena { * Traversable filtering enabled to allow nodes in returned POJO tree to be addressed. * Introspectable filtering enabled to allow public methods on the returned object to be invoked. */ - @RestMethod(name="GET", path="/people/{id}/*", + @RestMethod(name=GET, path="/people/{id}/*", converters={Traversable.class,Introspectable.class} ) public Person getPerson(@Path int id) throws Exception { @@ -185,7 +186,7 @@ public class AddressBookResource extends ResourceJena { * [GET /addresses/*] * Get all addresses in the address book. */ - @RestMethod(name="GET", path="/addresses/*", + @RestMethod(name=GET, path="/addresses/*", converters={Traversable.class,Queryable.class}, htmldoc=@HtmlDoc( links={ @@ -202,7 +203,7 @@ public class AddressBookResource extends ResourceJena { * [GET /addresses/{id}/*] * Get a single address by ID. */ - @RestMethod(name="GET", path="/addresses/{id}/*", + @RestMethod(name=GET, path="/addresses/{id}/*", converters={Traversable.class} ) public Address getAddress(@Path int id) throws Exception { @@ -213,7 +214,7 @@ public class AddressBookResource extends ResourceJena { * [POST /people] * Create a new Person bean. */ - @RestMethod(name="POST", path="/people", + @RestMethod(name=POST, path="/people", guards=AdminGuard.class ) public Redirect createPerson(@Body CreatePerson cp) throws Exception { @@ -225,7 +226,7 @@ public class AddressBookResource extends ResourceJena { * [POST /people/{id}/addresses] * Create a new Address bean. */ - @RestMethod(name="POST", path="/people/{id}/addresses", + @RestMethod(name=POST, path="/people/{id}/addresses", guards=AdminGuard.class ) public Redirect createAddress(@Path int id, @Body CreateAddress ca) throws Exception { @@ -238,7 +239,7 @@ public class AddressBookResource extends ResourceJena { * [DELETE /people/{id}] * Delete a Person bean. */ - @RestMethod(name="DELETE", path="/people/{id}", + @RestMethod(name=DELETE, path="/people/{id}", guards=AdminGuard.class ) public String deletePerson(@Path int id) throws Exception { @@ -250,7 +251,7 @@ public class AddressBookResource extends ResourceJena { * [DELETE /addresses/{id}] * Delete an Address bean. */ - @RestMethod(name="DELETE", path="/addresses/{id}", + @RestMethod(name=DELETE, path="/addresses/{id}", guards=AdminGuard.class ) public String deleteAddress(@Path int addressId) throws Exception { @@ -266,7 +267,7 @@ public class AddressBookResource extends ResourceJena { * [PUT /people/{id}/*] * Change property on Person bean. */ - @RestMethod(name="PUT", path="/people/{id}/*", + @RestMethod(name=PUT, path="/people/{id}/*", guards=AdminGuard.class ) public String updatePerson(RequestBody body, @Path int id, @PathRemainder String remainder) throws Exception { @@ -286,7 +287,7 @@ public class AddressBookResource extends ResourceJena { * [PUT /addresses/{id}/*] * Change property on Address bean. */ - @RestMethod(name="PUT", path="/addresses/{id}/*", + @RestMethod(name=PUT, path="/addresses/{id}/*", guards=AdminGuard.class ) public String updateAddress(RestRequest req, @Path int id, @PathRemainder String remainder) throws Exception { @@ -318,7 +319,7 @@ public class AddressBookResource extends ResourceJena { * [GET /cognos] * Get data in Cognos/XML format */ - @RestMethod(name="GET", path="/cognos") + @RestMethod(name=GET, path="/cognos") public DataSet getCognosData() throws Exception { // The Cognos metadata @@ -343,7 +344,7 @@ public class AddressBookResource extends ResourceJena { * [PROXY /*] * Return a proxy interface to IAddressBook. */ - @RestMethod(name="PROXY", path="/proxy/*") + @RestMethod(name=PROXY, path="/proxy/*") public IAddressBook getProxy() { return addressBook; } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/package.html ---------------------------------------------------------------------- diff --git a/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/package.html b/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/package.html index 2b29358..a97f1a3 100755 --- a/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/package.html +++ b/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/package.html @@ -747,13 +747,13 @@ <jk>public class</jk> MyHelloResource <jk>extends</jk> Resource { <jd>/** Standard hello message. */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/{person}"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/{person}"</js>) <jk>public</jk> String sayHello(RestRequest req) { <jk>return</jk> req.getConfig().getString(<js>"MyHelloResource/greeting"</js>); } <jd>/** Hello message in users language. */</jd> - <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/localized/{person}"</js>) + <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/localized/{person}"</js>) <jk>public</jk> String sayLocalizedHello(RestRequest req) { <jk>return</jk> req.getConfig().getString(<js>"MyHelloResource/localizedGreeting"</js>); } @@ -866,7 +866,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>; } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java ---------------------------------------------------------------------- diff --git a/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java b/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java index 9f0abb0..3a67695 100755 --- a/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java +++ b/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java @@ -14,6 +14,7 @@ package org.apache.juneau.microservice.resources; import static javax.servlet.http.HttpServletResponse.*; import static org.apache.juneau.dto.html5.HtmlBuilder.*; +import static org.apache.juneau.http.HttpMethodName.*; import java.io.*; import java.util.Map; @@ -50,7 +51,7 @@ public class ConfigResource extends Resource { * @return The config file. * @throws Exception */ - @RestMethod(name="GET", path="/", description="Show contents of config file.") + @RestMethod(name=GET, path="/", description="Show contents of config file.") public ConfigFile getConfigContents() throws Exception { return getServletConfig().getConfigFile(); } @@ -62,7 +63,7 @@ public class ConfigResource extends Resource { * @return The config file as a reader resource. * @throws Exception */ - @RestMethod(name="GET", path="/edit", description="Edit config file.") + @RestMethod(name=GET, path="/edit", description="Edit config file.") public Form getConfigEditForm(RestRequest req) throws Exception { return form().id("form").action("servlet:/").method("POST").enctype("application/x-www-form-urlencoded").children( div()._class("data").children( @@ -85,7 +86,7 @@ public class ConfigResource extends Resource { * @return The config file section. * @throws Exception */ - @RestMethod(name="GET", path="/{section}", + @RestMethod(name=GET, path="/{section}", description="Show config file section.", swagger=@MethodSwagger( parameters={ @@ -105,7 +106,7 @@ public class ConfigResource extends Resource { * @return The value of the config file entry. * @throws Exception */ - @RestMethod(name="GET", path="/{section}/{key}", + @RestMethod(name=GET, path="/{section}/{key}", description="Show config file entry.", swagger=@MethodSwagger( parameters={ @@ -125,7 +126,7 @@ public class ConfigResource extends Resource { * @return The new config file contents. * @throws Exception */ - @RestMethod(name="POST", path="/", + @RestMethod(name=POST, path="/", description="Sets contents of config file from a FORM post.", swagger=@MethodSwagger( parameters={ @@ -144,7 +145,7 @@ public class ConfigResource extends Resource { * @return The new config file contents. * @throws Exception */ - @RestMethod(name="PUT", path="/", + @RestMethod(name=PUT, path="/", description="Sets contents of config file.", swagger=@MethodSwagger( parameters={ @@ -165,7 +166,7 @@ public class ConfigResource extends Resource { * @return The new section. * @throws Exception */ - @RestMethod(name="PUT", path="/{section}", + @RestMethod(name=PUT, path="/{section}", description="Add or overwrite a config file section.", swagger=@MethodSwagger( parameters={ @@ -188,7 +189,7 @@ public class ConfigResource extends Resource { * @return The new value. * @throws Exception */ - @RestMethod(name="PUT", path="/{section}/{key}", + @RestMethod(name=PUT, path="/{section}/{key}", description="Add or overwrite a config file entry.", swagger=@MethodSwagger( parameters={ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39cecfc7/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/DebugResource.java ---------------------------------------------------------------------- diff --git a/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/DebugResource.java b/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/DebugResource.java index 8051a72..0ab3364 100644 --- a/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/DebugResource.java +++ b/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/DebugResource.java @@ -12,6 +12,8 @@ // *************************************************************************************************************************** package org.apache.juneau.microservice.resources; +import static org.apache.juneau.http.HttpMethodName.*; + import java.io.*; import org.apache.juneau.internal.*; @@ -46,7 +48,7 @@ public class DebugResource extends Resource { * @return Child utility links. * @throws Exception */ - @RestMethod(name="GET", path="/", description="Show contents of config file.") + @RestMethod(name=GET, path="/", description="Show contents of config file.") public ResourceDescription[] getChildren() throws Exception { return new ResourceDescription[] { new ResourceDescription("jetty/dump", "Jetty thread dump") @@ -56,7 +58,7 @@ public class DebugResource extends Resource { /** * [GET /jetty/dump] - Generates and retrieves the jetty thread dump. */ - @RestMethod(name="GET", path="/jetty/dump", description="Generates and retrieves the jetty thread dump.") + @RestMethod(name=GET, path="/jetty/dump", description="Generates and retrieves the jetty thread dump.") public Reader getJettyDump(RestRequest req, RestResponse res) { res.setContentType("text/plain"); return new StringReader(RestMicroservice.getInstance().getServer().dump()); @@ -65,7 +67,7 @@ public class DebugResource extends Resource { /** * [POST /jetty/dump] - Generates and saves the jetty thread dump file to jetty-thread-dump.log. */ - @RestMethod(name="POST", path="/jetty/dump", description="Generates and saves the jetty thread dump file to jetty-thread-dump.log.") + @RestMethod(name=POST, path="/jetty/dump", description="Generates and saves the jetty thread dump file to jetty-thread-dump.log.") public String createJettyDump(RestRequest req, RestResponse res) throws Exception { String dump = RestMicroservice.getInstance().getServer().dump(); IOUtils.pipe(dump, new FileWriter(req.getConfigFile().getString("Logging/logDir") + "/jetty-thread-dump.log"));
