当前位置:网站首页>Forest v1.5.22 release! Kotlin support

Forest v1.5.22 release! Kotlin support

2022-06-11 02:55:00 Dromara open source organization

Forest Introduce

Forest It's an open source Java HTTP Client Framework , It will be able to HTTP All request information for ( Include URL、Header as well as Body Etc ) Bind to your custom Interface On the way , Can be sent by calling local interface methods HTTP request

Forest How to use

Forest You don't need to write specific HTTP Call the process , You just need to define an interface , And then through Forest The annotation will HTTP The requested information can be added to the method of the interface . The request sender can automatically send the request and accept the response of the request by calling the interface you define

Forest How it works

Forest It will generate a concrete implementation class through the dynamic proxy of your defined interface , And then organize 、 verification HTTP Request information , Bind dynamic data , Convert data form ,SSL Verify the signature , Call back end HTTP API(httpclient etc. API) Execute the actual request , Waiting response , Failure to retry , Convert response data to Java The dirty work such as type is packaged by the implementation class of the dynamic agent . When requesting the sender to call this interface , It's actually calling this dirty implementation class

Winning awards

2021 year OSC China open source project selection 「 The most popular project 」

Related links : https://www.oschina.net/project/top_cn_2021

Key updates

Unified connection pool

No more separate definitions OkHttp and Httpclient Connection pool , There is no need to worry about the fact that asynchronous requests and synchronous requests are not in the same connection pool

This time, the unified connection pool is updated , Can pass max-connections and max-route-connections Unified attribute management OkHttp and HttpClient The maximum number of requests for all back-end requests and the maximum number of requests per route , At the same time, asynchronous requests can be restricted together

Parameter defines the return type

When an interface method returns a generic type of an unknown parameter , You can use the new @Return Parameter annotation , To identify a parameter as a return type

    //  adopt  Class  Type parameter to identify the return type     @Get("/user/info")    <T> T getGenericClass(@Return Class<T> clazz);    //  adopt  Type  Type parameter to identify the return type     @Get("/user/info")    <T> T getGenericType(@Return Type type);    //  adopt  TypeReference  Type parameter to identify the return type     @Get("/user/info")    <T> T getGenericTypeReference(@Return TypeReference<T> typeReference);

Official website and warehouse address

Official website address :

http://forest.dtflyx.com

Gitee Warehouse address :

https://gitee.com/dromara/forest

Github Warehouse address :

https://github.com/dromara/forest

This update

New features

  • feat: Unified connection pool (#I5APJA)
  • feat: Configurable asynchronous request thread pool queue size (#I5B78X)
  • feat: It supports defining return types through parameters (#I5ANZL)

Fix the problem

  • fix: spring 5.1 The following lower versions failed to start
  • fix: The request address contains # Characters will be escaped and the resource will not be found (#I59O7M)
  • fix: To configure BaseRequest Of baseURL After attribute , The default port number in the full request path will be overwritten , Cause the request to fail (#I4YBDV)
  • fix: Solve when @body After the annotation is identified on the object ,char&Character The attribute of type cannot be transferred from client to server
  • fix: kotlin Project startup exception (#I50PDZ)
  • fix: RetryWhen The retry condition interface will execute twice after the last retry (#I599BT)

Other changes

  • update: #I5ANZR Delete... From the unit test code Log4j2 rely on

Thank you very much

The small partners participating in this update

  • @xiao4852

This article belongs to dromara Owned by open source organizations (https://dromara.org/)

原网站

版权声明
本文为[Dromara open source organization]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206110150132545.html