Explain @GET annotation with example

The @GET annotation is a request method designator and corresponds to the similarly named HTTP method. The Java method annotated with this request method designator will process HTTP GET requests. The behavior of a resource is determined by the HTTP method to which the resource is responding.

Now let us see this with an example:

public class Library {

   public String getBooks() {...}

In above example if request URI is http://example.com/library/books then resource will be mapped with getbooks method.

J2EE 12


Explore Tutu'rself