Skip to content

Commit 716ad91

Browse files
docs(feign): add detailed javadoc for RequestLine annotation parameters
1 parent c605723 commit 716ad91

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

core/src/main/java/feign/RequestLine.java

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,69 @@
3030
@Retention(RUNTIME)
3131
public @interface RequestLine {
3232

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+
*/
3352
String value();
3453

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+
*/
3578
boolean decodeSlash() default true;
3679

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+
*/
3797
CollectionFormat collectionFormat() default CollectionFormat.EXPLODED;
3898
}

0 commit comments

Comments
 (0)