armeria-0.65.0
New features
-
Added
ServerBuilder.channelOption()andchildChannelOption()so that a user can specify NettyChannelOptions. #1009 #1189ServerBuilder sb = new ServerBuilder(); sb.channelOption(ChannelOption.SO_BACKLOG, true); sb.channelOption(ChannelOption.SO_REUSEADDR, true); sb.childChannelOption(ChannelOption.SO_RCVBUF, 1048576); sb.childChannelOption(ChannelOption.SO_SNDBUF, 1048576);
-
Added
ServiceRequestContext.additionalResponseHeaders()andClientRequestContext.additionalRequestHeaders()so that a user can specify the additional HTTP headers to send when writing a request or a response. This feature is useful especially for RPC services such asTHttpService. #992 #1225public class MyThriftServiceImpl implements MyThriftService.AsyncIface { @Override public void someServiceMethod(MyThriftRequest req, AsyncMethodCallback<MyThriftResponse> callback) { final ServiceRequestContext ctx = RequestContext.current(); ctx.setAdditionalResponseHeader(HttpHeaderNames.of("my-custom-header"), "my-custom-value"); ... } }
-
You can inject multi-value HTTP headers into a
Listor similar parameter in annotated services. #1025 #1191public class MyAnnotatedService { @Post("/post") public void post(@Header("item-id") List<Integer> itemIds) { ... } // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ }
-
You can nest
@RequestObjectannotation in annotated services. #1175 #1191public class MyAnnotatedService { @Post("/post") public void post(@RequestObject MyBean bean) { ... } // ^^^^^^^^^^^^^^^^^^^^^^^^^^ } public class MyBean { public MyBean(@Param Integer foo, @Header String bar, @RequestObject MyNestedBean nestedBean) { ... } // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ } public class MyNestedBean { ... }
-
You can inject HTTP cookies into a new dedicated type
Cookiesin annotated services. #1222public class MyAnnotatedService { @Post("/post") public void post(Cookies cookies) { // ^^^^^^^^^^^^^^^ for (Cookie c : cookies) { System.err.println(c.name() + " = " + c.value()); } } }
-
Added various default
ResponseConverterFunctionimplementations for convenient JSON, text and binary response generation in annotated services. #1221public class MyAnnotatedService { @Get("/json") @ProducesJson // Shortcut of @Produces("application/json; charset=utf-8") public MyBean getJson() { /* ... MyBean will be converted into a JSON document by Jackson ... */ } }
- We also added
@Produces,@Consumesand their various shortcut annotations such as@ProducesJsonand@ConsumesJsonfor convenient media type negotication, consumption and production. See Media type negotiation for more information.
- We also added
Improvements
- We changed the default
DistributionStatisticConfigso that MicrometerTimers andDistributionSummarys to have sensible settings. We increased the precision of the percentile values and made the histogram buckets are rotated every minute rather than every 40 seconds. #1226
Bug fixes
- Fixed a bug where
DynamicEndpointGroupand its subtypes notify their listeners even when theEndpointlist did not change. We also now sort theEndpointlist. #1216 #1220 - Fixed a packaging issue where the
armeria-tomcat8.5JAR did not contain any files. #1218
Deprecations
ClientFactoryBuilder.socketOption()has been deprecated in favor ofchannelOption(), so that its naming is consistent withServerBuilder.channelOption(). #1228@ProduceTypeand@ConsumeTypehave been deprecated in favor of@Producesand@Consumes. #1221
Breaking changes
- The
statustag produced by the function returned byMeterIdPrefixFunction.ofDefault()has been renamed tohttpStatusfor clarity. #1215 #1219 ClientRequestContext.HTTP_HEADERSattribute has been removed. UseClientRequestContext.additionalRequestHeaders#1225
Dependencies
- Brave 4.19.2 -> 5.0.0
- fastutil 8.1.1 -> 8.2.1
- Guava 25.0 -> 25.1
- RxJava 2.1.13 -> 2.1.14