0

I have created a Project in Java which helps generate HTML's from an Excel Sheet & a template file. I am trying to understand, if I want external users to use this facility from an external service, then what should be the thought process to choose an infrastructure for setting up this service. By infrastructure I mean that, which one of the below things should I do:

  • Setup a Server (Apache). Expose service as an API using POST request & Servlets.
  • Convert this into a Java Script Based library and use client side processing power to generate the HTML's from the browser. (This will save the hassle of maintaining my own server)

In short, just trying to understand if its right to choose a frontend technology for doing stuff which would primitively have been done in the background.

Thanks...

GauravEdekar
  • 249
  • 1
  • 8
  • Possible duplicate of [Why is Javascript used in MongoDB and CouchDB instead of other languages such as Java, C++?](http://programmers.stackexchange.com/questions/121411/why-is-javascript-used-in-mongodb-and-couchdb-instead-of-other-languages-such-as) – gnat Aug 29 '16 at 10:00
  • ...see also [Can JavaScript be used as a general scripting language?](http://programmers.stackexchange.com/questions/131933/can-javascript-be-used-as-a-general-scripting-language) – gnat Aug 29 '16 at 10:00
  • Try one of the more complicated things to process in Javascript. If it works, what is there to worry about? If a new feature causes a problem, build a service to handle it and anything else in the app if it makes it easier to run, build, deploy, etc. – JeffO Aug 29 '16 at 16:44

2 Answers2

1

Maybe the java solution is easily adaptable for Vaadin, which under the hood does a java-to-javascript conversion.

However if you have a well-defined and working Java project, a conversion to JavaScript is feasible, and could be nicer. I would try to do the entire thing in the client and restrict the server communication, say using AJAX calls. That will be difficult enough.

JavaScript and HTML DOM is cumbersome, so develop using small prototypes, and then integrate things in an entire application. Version control is life-saving.

You did not give us any idea to the complexity of your application, or whether it lends itself to JavaScript.

Personally I would go for java hosting, to ascertain delivering in time without sudden problems. In a second stage a pure JavaScript solution can be considered. Pluses for JS (=arguments you then need): less server load, better responsiveness, better GUI.

Joop Eggen
  • 2,011
  • 12
  • 10
  • Hey, thanks for the advice. Yes, I think translating it to javascript would not be a huge challenge. The application is pretty simple, I have shared it on github https://github.com/gavarava/convertify.IO . Asked this question as I wanted to avoid setting up a server model for hosting this as a service. – GauravEdekar Sep 01 '16 at 11:22
0

You don't have to maintain a server to create a web service - you could host it on a cloud service like Microsoft'S Azure or Amazon'S AWS. I don't know if it would be free or not.

You could also choose to make it a java library and share it via something like github.