I've been trying to hack up an annotated Spring MVC web app (have some experience with Spring but also rusty and not a super programmer) but it's proving pretty hard to call a URL of my web app which fires a request to a remote API (UK Police data) and recieves a reply which I can then return as JSON. I've been trying to use Spring's RestTemplate.

The odd JavaScript example that I've glanced at does seem to be suited to that task a lot better and more simplistic than a full blown servlet. Is that an opinion that you also share and can back up with a good, clear simple example?

I may be making an over-engineering mistake as this is only a proof of concept item. JavaScript does seem to provide a good platform for this kind of task.

Or, in other words, is it simpler to create a "web-app" with JavaScript that does some REST calls and renders the response than trying to do it with Spring?

Sorry if this question doesn't follow the stack-exchange rules. Happy to take advice on how I could ask this question in a better manner for stack-exchange/research better.

share|improve this question
Is the question whether you should do the UK Police-rest call from the web browser or from the server (acting as a proxy for the browser), or are you talking about replacing your Java servlet with something like node.js? – Martin Wickman Mar 12 at 10:11
Martin I'm open to an answer focusing on either or both of those questions. I'd like to know opinions about what JavaScript and node can do for me instead of trying to stumble through Spring's RestTemplate. That's why I wondered about the format of the question because it might leave an open question of strength's/weaknesses of JavaScript v Spring – Crowie Mar 12 at 10:22

1 Answer

up vote 0 down vote accepted

Javascript and JSON do go hand in hand (JSON == JavaScript Object Notation after all).

You can use Javascript on the server side and it's becoming increasingly popular, (e.g. Frameworks like node.js are being used). However, Javascript has not been a long term proven technology in this space (let the howls of outrage begin), so it's a case of let the buyer beware.

Using Spring MVC, Java, .NET, PHP, Python etc on the server side to process JSON request/response should be fairly easy in 2013 (although sometimes much confusing documentation is lying around as the state of play has changed so much).

I'd post a question on stackoverflow with your specific Spring MVC issue - I suspect you'll get some good answers quickly there. Make sure you specify what type of request (GET/POST etc) and what version Spring MVC you are using.

share|improve this answer

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.