Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Does "getResourceAsStream" alter thefiles content when it is used in a Web Service ?  RSS feed

 
Gaby TheYbag
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,

I'm currently writing a Java JAX-WS Web Service that generates some stuff by means of a Prolog Artificial Intelligence Engine.

To make its deployment easier for users, I try I to embed the Prolog source code in my web service as a resource and load it into in my Java class using the getResourceAsStream method. I first tried it inside a conventional Java application to check its correct functioning as follows

As everything was OK, I then tested the same code within my JAX-WS Web Service.

The problem is that, for the same bemPlanner.pl file, the desktop application returns me the correct answer while the web service one says that there is no solution. However, if I put the file on a web server and load it in my application by means of the method

it works correctly and returns the expected result.

Before posting here, I realized a series of tests, taking care to use same files, to confirm this strange problem. I also searched a lot on the web for a plausible explanation but I did not find anything relevant.

As Prolog is sensitive to indentation and carriage returns, my question is then to know if the getResourceAsStream method does not alter in some way the content of the loaded file when it is used in a web service.

I hope my question is clear and formatted in accordance with the conventions of your forum.

Thanks in advance for your help and advices !

Gaby
 
Gaby TheYbag
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I finally found the solution ... Now, everything works perfectly :-)
Here is how I use getResourceAsStream now


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!