Annotation Type RestConfiguration


  • @Target(TYPE)
    @Retention(RUNTIME)
    public @interface RestConfiguration
    Defines configuration, like HTTP verbs and headers etc for REST based connection. See method javadoc for more details. Alternatively, instead of configuring values with this annotation, you define a bean name instead of literal endpoint to make the REST call as user defined. See JsonTable For example:
     
     @Entity
     @JsonTable(source=rest, endpoint="http://my.serviceprovider.com/service")
     @RestConfiguration(method="GET", headersBean="myHeaders")
     public class Person {
        @Id
        private int id;
    
        @Column(name="FirstName")
        private String firstName;
    
        @Column(name="LastName")
        private String lastName;
    
        @Column(name="Age")
        private int age;
        ...
     }
     
     
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      String bodyBean
      Define the bean name that supplies for the payload for REST based calls.
      String headersBean
      Bean name which defines the HTTP Headers to be sent to the REST invocation.
      String method
      HTTP Verb GET, PUT, PATCH, DELETE
      boolean stream
      use streaming, i.e.
    • Element Detail

      • method

        String method
        HTTP Verb GET, PUT, PATCH, DELETE
        Returns:
        String
        Default:
        "GET"
      • headersBean

        String headersBean
        Bean name which defines the HTTP Headers to be sent to the REST invocation. For example when you want to handle HTTP Basic Authentication, you can do like.
         
         @Configuration
         public class MyConfigClass {
        @Bean(name="myHeaders") private HttpHeaders createHttpHeaders() { String notEncoded = "user:password"; String encodedAuth = Base64.getEncoder().encodeToString(notEncoded.getBytes()); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.add("Authorization", "Basic " + encodedAuth); return headers; }
        }
        Returns:
        beanName
        Default:
        ""
      • stream

        boolean stream
        use streaming, i.e. the the read data will not copied, can only read once
        Returns:
        default true
        Default:
        true
      • bodyBean

        String bodyBean
        Define the bean name that supplies for the payload for REST based calls. This bean MUST be of type InputStreamFactory.
        Returns:
        body
        Default:
        ""