is there a way to write RESTful service automatically? means, i have a class with some functionality that i want to expose as a REST service as well as it should work with my regular web application request processing. i want to make this process automatic in such a way that i just add some annotation and it works as a web service, it should not require any web.xml entry or any other process which needs to be followed while creating new web service.
my second question is, what is the best way to write RESTful web service?
"Automatically" is an odd word in programming. If you mean, is there a tool to read your mind, then obviously not ... ;) However, for a very limited number of annotations, JAX-RS (the Java EE standard for creating REST services) will expose a REST interface on your service.