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
021import org.apache.juneau.serializer.*;
022
023/**
024 * Annotation applied to Java method arguments of interface proxies to denote that they are the HTTP body of the request.
025 * 
026 * <h5 class='section'>Example:</h5>
027 * <p class='bcode'>
028 *    <ja>@Remoteable</ja>(path=<js>"/myproxy"</js>)
029 *    <jk>public interface</jk> MyProxy {
030 * 
031 *       <ja>@RemoteMethod</ja>(path=<js>"/mymethod"</js>)
032 *       String myProxyMethod(<ja>@Body</ja> MyPojo pojo);
033 *    }
034 * </p>
035 * 
036 * <p>
037 * The argument can be any of the following types:
038 * <ul class='spaced-list'>
039 *    <li>
040 *       Any serializable POJO - Converted to text using the {@link Serializer} registered with the
041 *       <code>RestClient</code>.
042 *    <li>
043 *       {@link Reader} - Raw contents of {@code Reader} will be serialized to remote resource.
044 *    <li>
045 *       {@link InputStream} - Raw contents of {@code InputStream} will be serialized to remote resource.
046 *    <li>
047 *       <code>HttpEntity</code> - Bypass Juneau serialization and pass HttpEntity directly to HttpClient.
048 *    <li>
049 *       <code>NameValuePairs</code> - Converted to a URL-encoded FORM post.
050 * </ul>
051 * 
052 * <p>
053 * The annotation can also be applied to a bean property field or getter when the argument is annotated with
054 * {@link RequestBean @RequestBean}:
055 * 
056 * <h5 class='section'>Example:</h5>
057 * <p class='bcode'>
058 *    <ja>@Remoteable</ja>(path=<js>"/myproxy"</js>)
059 *    <jk>public interface</jk> MyProxy {
060 * 
061 *       <ja>@RemoteMethod</ja>(path=<js>"/mymethod"</js>)
062 *       String myProxyMethod(<ja>@RequestBean</ja> MyRequestBean bean);
063 *    }
064 * 
065 *    <jk>public interface</jk> MyRequestBean {
066 *       <ja>@Body</ja>
067 *       MyPojo getMyPojo();
068 *    }
069 * </p>
070 * 
071 * <h5 class='section'>See Also:</h5>
072 * <ul class='doctree'>
073 *    <li class='link'><a class='doclink' href='../../../../overview-summary.html#juneau-rest-client.3rdPartyProxies'>Overview &gt; juneau-rest-client &gt; Interface Proxies Against 3rd-party REST Interfaces</a>
074 * </ul>
075 */
076@Documented
077@Target({PARAMETER,FIELD,METHOD})
078@Retention(RUNTIME)
079@Inherited
080public @interface Body {}