* [GH-1319] Add Support for Path Style Parameter Expansion
Fixes#1319
This change adds limited Path Style support to Feign URI template-style
templates. Variable expressions that start with a semi-colon `;`
are now expanded in accordance to [RFC 6570 Section 3.2.7](https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.7)
with the following modifications:
* Maps and Lists are expanded by default.
* Only Single variable templates are supported.
Examples:
```
{;who} ;who=fred
{;half} ;half=50%25
{;empty} ;empty
{;list} ;list=red;list=green;list=blue
{;keys} ;semi=%3B;dot=.;comma=%2C
```
* Export Path Style Expression as an Expander for use with custom contracts
* Added example to ReadMe
* Additional Test Cases.
* Provide a way to exclude headers from logs
* Make header filters optional (nullable), update README
* Mistyping: sing -> sign
* New implementation with overriding of filter methods
* Fix javadocs, update README
* Update README, fix removed newline
JEP 118 introduced javac option `-parameters` that adds to bytecode
method parameter names, so if code is compiled with that option
and @Param value is empty we can get that template parameter name
from method parameter name.
Fixes#1297.
* Add support for Dropwizard Metrics 4.1.x
Dropwizard Metrics 5.x is currently unmaintained, so there should be the option
to use the currently maintained Dropwizard Metrics version.
* Reformat code
* Add dropwizard-metrics4 to README.md
Fixes#1156
Collection Format was encoding query string values unnecessarily
due to changes introduced in #1138 and #1139 that encode template
values before appending them to the query string.
In addition, `decodeSlash` flags that were accidentally removed,
have been restored in QueryTemplate.
* Restoring decodeSlash in QueryTemplate
* Correcting Readme with regards to decodeSlash usage
Fixes#929
Documentation around when to use a Request Interceptor or a custom
Target when dealing with specific situations such as setting headers
per method or target.
Fixes#1131
Updating documentation around slashes to reflect that now encoding
is consistent across all areas and that `decodeSlash` is required
in all cases.
Fixes#985
* JavaLogger(String name) added. Workaround for JavaLogger() provided
* JavaLogger() marked as deprecated. Workaround for JavaLogger() removed
* Little fix for note in README
* One more little fix for note in README
* JavaLogger(Class<?>) constructor added
* Add Roadmap to Readme
Propsed roadmap is now included in the readme.
* Make clear which changes are breaking
Added additional context to Retry and Async tasks to indicate
that these features will be breaking changes.
Fixes#872
Previously, all unresolved query template expressions resolved
to empty strings, which then indcate that the entire query parameter
should be removed. This violates RFC 6570 in that only undefined
values should be removed. This change updates Query Template to
check the provided `variables` map for an entry expression. If
no value is provided, the entry is explicitly marked `UNDEF` and
removed.
This brings us in line with the specification. The following is
now how parameters are resolved:
*Empty String*
```java
public void test() {
Map<String, Object> parameters = new LinkedHashMap<>();
parameters.put("param", "");
this.demoClient.test(parameters);
}
```
Result
```
http://localhost:8080/test?param=
```
*Missing*
```java
public void test() {
Map<String, Object> parameters = new LinkedHashMap<>();
this.demoClient.test(parameters);
}
```
Result
```
http://localhost:8080/test
```
*Undefined*
```java
public void test() {
Map<String, Object> parameters = new LinkedHashMap<>();
parameters.put("param", null);
this.demoClient.test(parameters);
}
```
Result
```
http://localhost:8080/test
```
* Adding additional test case for explicit null parameter value
* Additional Test case for the explict `null` case. Updates to the
documentation.
* Adding URI segment specific encoding
Fixes#879
URI encoding introduced in Feign 10.x was refactored to be more in line
with URI and URI Template specifications respectively. One change was to
ensure that certain reserved characters were not encoded incorrectly.
The result was that path segment specific reserved characters were being
preserved on the query string as well. This change updates the `UriTemplate`
and `Expression` classes to recognize the segment of the URI that is being processed
and apply the segment specific encoding correctly.
One important change regarding the `+` sign. Per the URI specification, a `+` sign
is allowed in both the path and query segments of a URI, however, handling of
the symbol on the query can be inconsistent. In some legacy systems, the `+` is
equivalent to the a space. Feign takes the approach of modern systems, where a
`+` symbol should not reprsent a space and is explicitly encoded as `%2B` when
found on a query string.
If you wish to use `+` as a space, then use the literal ` ` character or encode
the value directly as `%20`
* Throw cause of RetryableExceptions
* Allow propogation of underlying exceptions
Add configuration to Feign.Builder and support in SynchronousMethodHandler
to make it propagate the cause of RetryableExceptions
* Retab SMH
* Add note about propagation in readme
* Use enum for exception propagation policy
* changed default query encoder result from POJO field to getter property
* changed default query encoder result from POJO field to getter property
* reset mistakenly deleted file
* Create PropertyQueryMapEncoder and extract QueryMapEncoder.Default to FieldQueryMapEncoder
* rename PropertyQueryMapEncoder to BeanQueryMapEncoder and add README
* fix README
* add comments to QueryMapEncoder and remove deprecation on Default
* rename test name
* rename package name queryMap to querymap
* format code
* Refactoring RequestTemplate to RFC6570
This change refactors `RequestTemplate` in an attempt to
adhere to the [RFC-6570 - URI Template](https://tools.ietf.org/html/rfc6570)
specification more closely. The reason for this is to
reduce the amount of inconsistency between `@Param`, `@QueryMap`,
`@Header`, `@HeaderMap`, and `@Body` template expansion.
First, `RequestTemplate` now delegates uri, header, query, and
body template parsing to `UriTemplate`, `HeaderTemplate`,
`QueryTemplate`, and `BodyTemplate` respectively. These components
are all variations on a `Template`.
`UriTemplate` adheres to RFC 6570 explicitly and supports Level 1
(Simple String) variable expansion. Unresolved variables are ignored
and removed from the uri. This includes query parameter pairs. All
literal and expanded variables are pct-encoded according to the Charset
provided in the `RequestTemplate`.
`HeaderTemplate` supports Level 1 (Simple String) variable expansion.
Unresolved variables are ignored. Empty headers are removed. No
encoding is performed.
`QueryTemplate` is a subset of a `UriTemplate` and reacts in the same
way. Unresolved pairs are ignored and not present on the final
template. All literals and expanded variables are pct-encoded
according to the Charset provided.
`BodyTemplate` supports Level 1 (Simple String) variable expansion.
Unresolved variables produce empty strings. Values are not encoded.
All remaining customizations, including custom encoders, collection format
expansion and charset encoding are still supportted and made backward
compatible.
Finally, a number of inconsistent methods on `RequestTemplate` have
been deprecated for public use and all deprecated usage throughout
the library has been replaced.
Closes#719
This change adds the original Request Method to `RetryableException`,
allowing implementers to determine if a retry should occur based on
method and exception type.
To support this, `Response` objects now require that the original
`Request` be present. Test Cases, benchmarks, and documentation have
been added.
* Refactored Request Method Attribute on Requests
* Added `HttpMethod` enum that represents the supported HTTP methods
replacing String handling.
* Deprecated `Request#method()` in favor of `Request#httpMethod()`
* Added support for custom param encoding
* Added ability to inherit @CustomParam annotation
* Updated class cast style to match rest of code
* Updated to use QueryMap for custom pojo query parameters
* Clarification in README of QueryMap POJO usage
* Removed unused line
* Updated custom POJO QueryMap test to prove that private fields can be used
* Removed no-longer-valid test endpoint
* Renamed tests to more accurately reflect their contents
* More test cleanup
* Modified QueryMap POJO encoding to use specified QueryMapEncoder (default implementation provided)
* Corrected typo in README.md
* Fixed merge conflict and typo in test name