The following table summarizes the annotations, their purpose and provides an example:

    When a value is not specified to any binding annotation then the parameter name is used. In other words the following two methods are equivalent and both bind from a cookie called myCookie:

    1. @Get("/cookieName")
    2. String cookieName(@CookieValue("myCookie") String myCookie) {
    3. }
    4. @Get("/cookieInferred")
    5. String cookieInferred(@CookieValue String myCookie) {
    6. // ...
    1. @Get("/headerName")
    2. public String headerName(@Header("Content-Type") String contentType) {
    3. // ...
    4. }
    5. public String headerInferred(@Header String contentType) {
    6. // ...
    1. @Get("/headerName")
    2. fun headerName(@Header("Content-Type") contentType: String): String {
    3. // ...
    4. }
    5. @Get("/headerInferred")
    6. fun headerInferred(@Header contentType: String): String {
    7. // ...