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

Post here questions and problems related to oXygen frameworks/document types.
vishwavaranasi
Posts: 140
Joined: Fri Feb 28, 2020 4:02 pm

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

Post 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
Thanks,
vishwa
Radu
Posts: 8992
Joined: Fri Jul 09, 2004 5:18 pm

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

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
vishwavaranasi
Posts: 140
Joined: Fri Feb 28, 2020 4:02 pm

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

Post 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
Thanks,
vishwa
Post Reply