All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.juneau.remoteable.RemoteMethod Maven / Gradle / Ivy

There is a newer version: 9.0.1
Show newest version
// ***************************************************************************************************************************
// * 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.remoteable;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;

import java.io.*;
import java.lang.annotation.*;

/**
 * Annotation applied to Java methods on interface proxy classes.
 *
 * 

* The return type on the Java method can be any of the following: *

    *
  • void - Don't parse any response. Note that the method will still throw an exception if an error * HTTP status is returned. *
  • Any parsable POJO - The body of the response will be converted to the POJO using the parser defined on the * RestClient. *
  • HttpResponse - Returns the raw HttpResponse returned by the inner * HttpClient. *
  • {@link Reader} - Returns access to the raw reader of the response. *
  • {@link InputStream} - Returns access to the raw input stream of the response. *
* *
Additional Information
* */ @Documented @Target(METHOD) @Retention(RUNTIME) @Inherited public @interface RemoteMethod { /** * The path to the REST service for this Java method relative to the parent proxy interface URL. * *

* The default value is the Java method name (e.g. "http://localhost/root-url/org.foo.MyInterface/myMethod") * if {@link Remoteable#methodPaths() @Remoteable.methodPaths()} is "NAME", or the Java method signature * (e.g. "http://localhost/root-url/org.foo.MyInterface/myMethod(int,boolean,java.lang.String)") if * it's "SIGNATURE". */ String path() default ""; /** * Defines the HTTP method to use for REST calls. * *

* Possible values: *

    *
  • POST (default) - Parameters are serialized using the serializer registered with the RestClient. *
  • GET - Parameters are serialized using the UrlEncodingSerializer registered with the RestClient. *
* *

* The default value is "POST". */ String httpMethod() default "POST"; /** * The value the remoteable method returns. * *

* Possible values: *

    *
  • * {@link ReturnValue#BODY} (default) - The body of the HTTP response converted to a POJO. *
    The return type on the Java method can be any of the following: *
      *
    • void - Don't parse any response. Note that the method will still throw an exception if an * error HTTP status is returned. *
    • Any parsable POJO - The body of the response will be converted to the POJO using the parser defined * on the RestClient. *
    • HttpResponse - Returns the raw HttpResponse returned by the inner * HttpClient. *
    • {@link Reader} - Returns access to the raw reader of the response. *
    • {@link InputStream} - Returns access to the raw input stream of the response. *
    *
  • * {@link ReturnValue#HTTP_STATUS} - The HTTP status code on the response. *
    The return type on the Java method can be any of the following: *
      *
    • int/Integer - The HTTP response code. *
    • boolean/Boolean - true if the response code is <400 *
    *
*/ ReturnValue returns() default ReturnValue.BODY; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy