Package org.teiid.spring.annotations
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. SeeJsonTable
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, DELETEboolean
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:
- ""
-
-
-
bodyBean
String bodyBean
Define the bean name that supplies for the payload for REST based calls. This bean MUST be of typeInputStreamFactory
.- Returns:
- body
- Default:
- ""
-
-