Annotation Type Get


@Target(METHOD)
@Retention(RUNTIME)
public @interface Get
Marks a method that handles HTTP GET requests.


   @Get("{id}")
   Customer get(long id) {

     ...
   }

 

Example

Path parameters are matched by name - "status" in the example below.

Method parameters that do not match a path parameter default to being a query parameter - "since" is a query parameter in the example below.



   @Get("/status/{status}")
   List<Customer> getByStatus(String status, LocalDate since) {

     ...
   }

 

Example - Multiple path parameters



   @Get("/status/{status}/{parentId}")
   List<Customer> getByStatus(String status, long parentId, LocalDate since) {

     ...
   }

 
  • Optional Element Summary

    Optional Elements
    Modifier and Type Optional Element Description
    String value