Reputation: 3823
I was asked to make a web application which should be able to order some words. For example, colors.
I think the best way is to send colors by url and send that url (url.php?listColors...) to the server (and server orders them).
Or send them by json file and return a json file with colors ordered.
But I was asked also to do it with a restul service. I have read something about them and I think it would be a little bit difficult because I just find info about get or post resources. But nothing about send a list of "things" and make something with that. I should make web service in java.
I think it is too heavy if I have to include all words in the web service.
With JSP I can send all words and make a method for ordering them...
What do you think? I would want to have other opinion and ideas to make it the best way possible.
Upvotes: 0
Views: 7193
Reputation: 218
RESTful handles all object types so you could just make a method like:
@POST
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public List<String> orderWords(List<String> words);
If you have a performance criteria just use the gzip compression.
Good luck!
Upvotes: 1
Reputation: 17893
Restful web services and JSP are two sides of the same coin. You use JSP when the client is typically a web browser which needs to display the contents in HTML. You use Restful WS when the client is some other application which needs data. The other application can be a javascript in browser.
Restful support all the data ( via GET/POST/PUT) including list of items etc. So this should not be the criteria of selecting whether to use JSP or Restful.
To answer your other question, as I mentioned, you could use either of Restful or JSP. It depends whats the use case is.
Upvotes: 4