-
1. Re: Documentation Teiid Spring Boot annotations
shawkins May 31, 2019 1:15 PM (in response to dieman.one)> Could someone please kindly post a link to documentation for all Teiid Spring boot annotations?
There are only a handful of Teiid Spring Boot annotations. Everything else is simply Spring Boot. See teiid-spring-boot/Reference.adoc at master · teiid/teiid-spring-boot · GitHub
-
2. Re: Documentation Teiid Spring Boot annotations
rareddy May 31, 2019 2:23 PM (in response to dieman.one)Also Teiid specific annotations have detailed java doc on them. Also in examples there possibly is an example on it on its use.
For spring boot specific or jpa specific we don't have anything in documents
Ramesh..
-
3. Re: Documentation Teiid Spring Boot annotations
dieman.one May 31, 2019 3:20 PM (in response to shawkins)Hi,
Saw that link and was happy for a second! It does mention @RestConfiguration annotation, but all it says about it is this:
@RestConfiguration
When working with REST based sources with entities like @JsonTable or @TextTable, to configure http verbs or headers use this annotation to configure those properties. If used on any non REST based sources it will not have any effect.
I need to understand: how do I use this annotation to add a header to my wed service call? With the information above I cannot guess it. The annotation text a String parameter "HeaderBean", which is I guess what I need. But how to use it? What should I set this string too? Do I need to define a separate HeaderBean class?.. The pass its name?.. It would be really great to get a bit more info.
Thanks again,
Dmitry
-
4. Re: Documentation Teiid Spring Boot annotations
rareddy May 31, 2019 4:38 PM (in response to dieman.one)1 of 1 people found this helpfulFrom Java Doc
@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; ... }
and for "headersBean" on the method's Javadoc
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; }
In th above example if you are looking for "Person" entity, it will use "GET" method on endpoint with given headers to grab the content, and parse using the Person class and provide you with an entity. You can also use JDBCTemplate and issue any calls like "select * from Person", which will also do the same but returns the resultset. Hopefully, that is clear?