|
30 | 30 | @Retention(RUNTIME) |
31 | 31 | public @interface RequestLine { |
32 | 32 |
|
| 33 | + /** |
| 34 | + * The HTTP request line, including the method and an optional URI template. |
| 35 | + * <p> |
| 36 | + * The string must begin with a valid {@linkplain feign.Request.HttpMethod HTTP method name} (e.g. |
| 37 | + * {@linkplain feign.Request.HttpMethod#GET GET}, {@linkplain feign.Request.HttpMethod#POST POST}, |
| 38 | + * {@linkplain feign.Request.HttpMethod#PUT PUT}), followed by a space and a URI template. If only |
| 39 | + * the HTTP method is specified (e.g. {@code "DELETE"}), the request will use the base URL defined |
| 40 | + * for the client. |
| 41 | + * |
| 42 | + * <p> |
| 43 | + * Example: |
| 44 | + * |
| 45 | + * <pre>{@code @RequestLine("GET /repos/{owner}/{repo}") |
| 46 | + * Repo getRepo(@Param("owner") String owner, @Param("repo") String repo); |
| 47 | + * }</pre> |
| 48 | + * |
| 49 | + * @return the HTTP method and optional URI template for the request. |
| 50 | + * @see feign.template.UriTemplate |
| 51 | + */ |
33 | 52 | String value(); |
34 | 53 |
|
| 54 | + /** |
| 55 | + * Controls whether percent-encoded forward slashes ({@code %2F}) in expanded path variables are |
| 56 | + * decoded back to {@code '/'} before sending the request. |
| 57 | + * |
| 58 | + * <p> |
| 59 | + * When {@code true} (the default), any {@code %2F} sequences produced during URI template |
| 60 | + * expansion will be replaced with literal slashes, meaning that path variables containing slashes |
| 61 | + * will be interpreted as multiple path segments. |
| 62 | + * |
| 63 | + * <p> |
| 64 | + * When {@code false}, percent-encoded slashes ({@code %2F}) are preserved in the final URL. This |
| 65 | + * is useful when a path variable intentionally includes a slash as part of its value (for |
| 66 | + * example, an encoded identifier such as {@code "foo%2Fbar"}). |
| 67 | + * |
| 68 | + * <p> |
| 69 | + * Example: |
| 70 | + * |
| 71 | + * <pre>{@code @RequestLine(value = "GET /projects/{id}", decodeSlash = false) |
| 72 | + * Project getProject(@Param("id") String encodedId); |
| 73 | + * }</pre> |
| 74 | + * |
| 75 | + * @return {@code true} if encoded slashes should be decoded (default behavior); {@code false} to |
| 76 | + * preserve {@code %2F} sequences in the URL. |
| 77 | + */ |
35 | 78 | boolean decodeSlash() default true; |
36 | 79 |
|
| 80 | + /** |
| 81 | + * Specifies how collections (e.g. {@link java.util.List List} or arrays) are serialized when |
| 82 | + * expanded into the URI template. |
| 83 | + * <p> |
| 84 | + * Determines whether values are represented as exploded parameters (repeated keys) or as a single |
| 85 | + * comma-separated value, depending on the chosen {@link feign.CollectionFormat}. |
| 86 | + * |
| 87 | + * <p> |
| 88 | + * Example: |
| 89 | + * <ul> |
| 90 | + * <li>{@linkplain CollectionFormat#EXPLODED EXPLODED}: {@code /items?id=1&id=2&id=3}</li> |
| 91 | + * <li>{@linkplain CollectionFormat#CSV CSV}: {@code /items?id=1,2,3}</li> |
| 92 | + * </ul> |
| 93 | + * |
| 94 | + * @return the collection serialization format to use when expanding templates. |
| 95 | + * @see CollectionFormat |
| 96 | + */ |
37 | 97 | CollectionFormat collectionFormat() default CollectionFormat.EXPLODED; |
38 | 98 | } |
0 commit comments