001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.remoteable;
014
015import static java.lang.annotation.ElementType.*;
016import static java.lang.annotation.RetentionPolicy.*;
017
018import java.io.*;
019import java.lang.annotation.*;
020
021/**
022 * @deprecated Use <code>org.apache.juneau.client.remote.RemoteMethod</code>
023 */
024@Deprecated
025@Documented
026@Target(METHOD)
027@Retention(RUNTIME)
028@Inherited
029public @interface RemoteMethod {
030
031   /**
032    * The path to the REST service for this Java method relative to the parent proxy interface URL.
033    *
034    * <p>
035    * The default value is the Java method name (e.g. <js>"http://localhost/root-url/org.foo.MyInterface/myMethod"</js>)
036    * if {@link Remoteable#methodPaths() @Remoteable.methodPaths()} is <js>"NAME"</js>, or the Java method signature
037    * (e.g. <js>"http://localhost/root-url/org.foo.MyInterface/myMethod(int,boolean,java.lang.String)"</js>) if
038    * it's <js>"SIGNATURE"</js>.
039    */
040   String path() default "";
041
042   /**
043    * Defines the HTTP method to use for REST calls.
044    *
045    * <p>
046    * Possible values:
047    * <ul>
048    *    <li><jsf>POST</jsf> (default) - Parameters are serialized using the serializer registered with the RestClient.
049    *    <li><jsf>GET</jsf> - Parameters are serialized using the UrlEncodingSerializer registered with the RestClient.
050    * </ul>
051    *
052    * <p>
053    * The default value is <js>"POST"</js>.
054    */
055   String httpMethod() default "POST";
056
057   /**
058    * The value the remoteable method returns.
059    *
060    * <p>
061    * Possible values:
062    * <ul>
063    *    <li>
064    *       {@link ReturnValue#BODY} (default) - The body of the HTTP response converted to a POJO.
065    *       <br>The return type on the Java method can be any of the following:
066    *       <ul>
067    *          <li><jk>void</jk> - Don't parse any response.  Note that the method will still throw an exception if an
068    *                error HTTP status is returned.
069    *          <li>Any parsable POJO - The body of the response will be converted to the POJO using the parser defined
070    *                on the <code>RestClient</code>.
071    *          <li><code>HttpResponse</code> - Returns the raw <code>HttpResponse</code> returned by the inner
072    *                <code>HttpClient</code>.
073    *          <li>{@link Reader} - Returns access to the raw reader of the response.
074    *          <li>{@link InputStream} - Returns access to the raw input stream of the response.
075    *       </ul>
076    *    <li>
077    *       {@link ReturnValue#HTTP_STATUS} - The HTTP status code on the response.
078    *       <br>The return type on the Java method can be any of the following:
079    *       <ul>
080    *          <li><jk>int</jk>/<code>Integer</code> - The HTTP response code.
081    *          <li><jk>boolean</jk>/<code>Boolean</code> - <jk>true</jk> if the response code is <code>&lt;400</code>
082    *       </ul>
083    * </ul>
084    */
085   ReturnValue returns() default ReturnValue.BODY;
086}