Reputation: 716
What is the best way of save data using Restful web service without using Ajax? As a example I need to add a new Customer to the database using submit button. What is the best way of transfer data format (text,json,xml) ? How to read POST or GET data from HttpRequest object?
If you can please give me a example in java .
Thank you
Upvotes: 0
Views: 499
Reputation: 31012
It's very definitely worth your time to carefully study Richardson and Ruby's RESTful Web Services to learn the REST architectural style. In addition to @ach_l's recommendation to use Jersey, take a look at the Restlet Java framework, which is completely wonderful.
Upvotes: 0
Reputation: 7349
I think you need to separate the concepts a bit. A "Restful Web Service" is a web service designed using REST principals, whereas AJAX is a set of technologies used often on the client side for asynchronous requests to multiple resources (without fully reloading the page). The web service really shouldn't care how the HTTP request is generated, just the contents of the HTTP request.
Now if you're concerned about writing a rest service in Java, I would highly recommend looking into JAX-RS and the reference implementation Jersey. There are lots of examples of how to get up and running. You can use MessageBodyReader implementations are to convert data from the HTTP request entity into Java objects.
Obviously this is not the only way to get started with writing a Restful web service in Java, but is one way.
Upvotes: 1