Page 1 of 1

REST API call from oxygen plugin using org.springframework.web.client.RestTemplate

Posted: Wed Feb 10, 2021 2:52 pm
by vishwavaranasi
Hello Team ,

We have a oxygen Plugin , where We have a REST API to be called , used the client org.springframework.web.client.RestTemplate

String RestEndpoint ="http://servername:8080/RestAPI/names";
RestTemplate restTemplate = new RestTemplate();

List<Name> allNames=Arrays.stream(restTemplate.getForObject(RestEndpoint, Name[].class)).collect(Collectors.toList());

and we have POM.xml dependency
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.0.1.RELEASE</version>
</dependency>


the standalone call from Eclipse works fine , where when we have our plugin jar under oxygen plugin , nothing is happening , the rest call not even throwing any exception.

would be great if any inputs here.

Thanks,
vishwa

Re: REST API call from oxygen plugin using org.springframework.web.client.RestTemplate

Posted: Wed Feb 10, 2021 4:11 pm
by Radu
Hi,

So you have a plugin for Oxygen XML Editor (or Author) standalone right?
Have you added System.out logging to your plugin to see if your code is called? You can start Oxygen using the "oxygen.bat" executable from the Oxygen installation folder if you want to see the logging in the Windows Command Prompt window.
If your code is called but it does not seem to do anything, Oxygen uses for HTTP connections the Apache HTTP client libraries which may have a different behavior than the regular Java HTTP connection libraries.
We have a plugin extension which allows you to take control over the HTTP connection created by Oxygen and use the base "sun.net.www.protocol.http.Handler" handler instead of the Apache HTTP Component libraries:

https://www.oxygenxml.com/doc/versions/ ... lugin.html

Regards,
Radu

Re: REST API call from oxygen plugin using org.springframework.web.client.RestTemplate

Posted: Mon Mar 29, 2021 8:54 am
by vishwavaranasi
Thanks Radu , this debug tip "You can start Oxygen using the "oxygen.bat" executable from the Oxygen installation folder if you want to see the logging in the Windows Command Prompt window" helped me to know the errors.

it's nothing to do with Oxygen , i have fixed with using some other 3rd party jar to get the rest call output.

thanks for your help.


Thanks,
vishwa