-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82f1d39
commit 1847a16
Showing
154 changed files
with
7,483 additions
and
2,432 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
name: build | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '8' | ||
distribution: 'temurin' | ||
cache: maven | ||
- name: Install cloc | ||
run: sudo apt-get install -y cloc | ||
- name: Count lines of code | ||
run: cloc . | ||
- name: Build with Maven | ||
run: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v5 | ||
with: | ||
token: 25db9047-7c6d-461a-b63d-181a4749d6f2 | ||
slug: cowave5/http-client | ||
file: ${{ github.workspace }}/target/site/jacoco/jacoco.xml | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
[](https://github.com/cowave5/spring-feign/actions) | ||
 | ||
 | ||
[](https://github.com/cowave5/http-client/actions) | ||
 | ||
 | ||
[](https://codecov.io/github/cowave5/http-client?branch=master) | ||
[](http://www.apache.org/licenses/LICENSE-2.0.txt) | ||
|
||
## spring-feign | ||
## http-client | ||
|
||
一个Http调用客户端,依赖netflix feign实现,方便在spring中声明 | ||
HTTP客户端,参考Netflix Feign实现,使用的Apache Httpclient进行调用 | ||
|
||
- 依赖 | ||
|
||
```xml | ||
<dependency> | ||
<groupId>com.cowave.commons</groupId> | ||
<artifactId>spring-feign</artifactId> | ||
<version>2.7.4</version> | ||
<artifactId>http-client</artifactId> | ||
<version>2.7.5</version> | ||
</dependency> | ||
``` | ||
|
||
- 使用说明:[wiki](https://github.com/cowave5/spring-feign/wiki/%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E) | ||
- 问题建议:[issues](https://github.com/cowave5/spring-feign/issues) | ||
- 使用说明:[wiki](https://github.com/cowave5/http-client/wiki/%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E) | ||
- 问题建议:[issues](https://github.com/cowave5/http-client/issues) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.cowave.commons</groupId> | ||
<artifactId>spring-feign</artifactId> | ||
<version>2.7.4</version> | ||
<artifactId>http-client</artifactId> | ||
<version>2.7.5</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>spring-feign</name> | ||
<description>A simple http client, based on netflix feign</description> | ||
<url>https://github.com/cowave5/spring-feign</url> | ||
<name>http-client</name> | ||
<description>A simple http client</description> | ||
<url>https://github.com/cowave5/http-client</url> | ||
|
||
<licenses> | ||
<license> | ||
|
@@ -21,13 +21,13 @@ | |
|
||
<issueManagement> | ||
<system>github</system> | ||
<url>https://github.com/cowave5/spring-feign/issues</url> | ||
<url>https://github.com/cowave5/http-client/issues</url> | ||
</issueManagement> | ||
|
||
<scm> | ||
<url>[email protected]:cowave5/spring-feign.git</url> | ||
<connection>scm:[email protected]:cowave5/spring-feign.git</connection> | ||
<developerConnection>scm:[email protected]:cowave5/spring-feign.git</developerConnection> | ||
<url>[email protected]:cowave5/http-client.git</url> | ||
<connection>scm:[email protected]:cowave5/http-client.git</connection> | ||
<developerConnection>scm:[email protected]:cowave5/http-client.git</developerConnection> | ||
</scm> | ||
|
||
<developers> | ||
|
@@ -59,8 +59,8 @@ | |
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.1</version> | ||
<configuration> | ||
<source>17</source> | ||
<target>17</target> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
<encoding>UTF-8</encoding> | ||
</configuration> | ||
</plugin> | ||
|
@@ -81,6 +81,32 @@ | |
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jacoco</groupId> | ||
<artifactId>jacoco-maven-plugin</artifactId> | ||
<version>0.8.11</version> | ||
<executions> | ||
<execution> | ||
<id>prepare-agent</id> | ||
<goals> | ||
<goal>prepare-agent</goal> | ||
</goals> | ||
<phase>test-compile</phase> | ||
</execution> | ||
<execution> | ||
<id>report</id> | ||
<goals> | ||
<goal>report</goal> | ||
</goals> | ||
<phase>test</phase> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.22.2</version> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
|
@@ -145,48 +171,82 @@ | |
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.cowave.commons</groupId> | ||
<artifactId>commons-response</artifactId> | ||
<version>2.7.5</version> | ||
<groupId>org.reflections</groupId> | ||
<artifactId>reflections</artifactId> | ||
<version>0.9.10</version> | ||
</dependency> | ||
<!-- commons-lang3 --> | ||
<dependency> | ||
<groupId>com.netflix.feign</groupId> | ||
<artifactId>feign-core</artifactId> | ||
<version>8.18.0</version> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<version>3.12.0</version> | ||
</dependency> | ||
<!-- commons-io --> | ||
<dependency> | ||
<groupId>com.netflix.feign</groupId> | ||
<artifactId>feign-jackson</artifactId> | ||
<version>8.18.0</version> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
<version>2.14.0</version> | ||
</dependency> | ||
<!-- commons-collections4 --> | ||
<dependency> | ||
<groupId>org.reflections</groupId> | ||
<artifactId>reflections</artifactId> | ||
<version>0.9.10</version> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-collections4</artifactId> | ||
<version>4.4</version> | ||
</dependency> | ||
<!-- httpclient --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
<version>2.7.0</version> | ||
<scope>provided</scope> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
<artifactId>httpclient</artifactId> | ||
<version>4.5.13</version> | ||
</dependency> | ||
<!-- httpmime --> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.13.5</version> | ||
<scope>provided</scope> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
<artifactId>httpmime</artifactId> | ||
<version>4.5.13</version> | ||
</dependency> | ||
<!-- commons-text --> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>1.7.30</version> | ||
<scope>provided</scope> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-text</artifactId> | ||
<version>1.10.0</version> | ||
</dependency> | ||
<!-- transmittable-thread-local --> | ||
<dependency> | ||
<groupId>com.alibaba</groupId> | ||
<artifactId>transmittable-thread-local</artifactId> | ||
<version>2.14.2</version> | ||
</dependency> | ||
<!-- pagehelper --> | ||
<dependency> | ||
<groupId>com.github.pagehelper</groupId> | ||
<artifactId>pagehelper</artifactId> | ||
<version>6.1.0</version> | ||
</dependency> | ||
<!-- mybatis-plus --> | ||
<dependency> | ||
<groupId>com.baomidou</groupId> | ||
<artifactId>mybatis-plus-extension</artifactId> | ||
<version>3.5.4.1</version> | ||
</dependency> | ||
<!-- provided --> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>1.18.24</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
<version>2.7.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<version>2.7.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/cowave/commons/client/http/HttpConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.cowave.commons.client.http; | ||
|
||
import com.cowave.commons.client.http.annotation.EnableHttpClient; | ||
import com.cowave.commons.client.http.asserts.I18Messages; | ||
import org.springframework.context.MessageSource; | ||
|
||
import javax.annotation.Resource; | ||
|
||
/** | ||
* | ||
* @author shanhuiming | ||
* | ||
*/ | ||
@EnableHttpClient | ||
public class HttpConfiguration { | ||
|
||
@Resource | ||
public void setMessageSource(MessageSource messageSource) { | ||
I18Messages.setMessageSource(messageSource); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/cowave/commons/client/http/HttpExceptionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.cowave.commons.client.http; | ||
|
||
import com.cowave.commons.client.http.asserts.HttpException; | ||
|
||
/** | ||
* | ||
* @author shanhuiming | ||
* | ||
*/ | ||
public interface HttpExceptionHandler { | ||
|
||
void handle(HttpException e); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/cowave/commons/client/http/HttpInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.cowave.commons.client.http; | ||
|
||
import com.cowave.commons.client.http.request.HttpRequest; | ||
|
||
/** | ||
* | ||
* @author shanhuiming | ||
* | ||
*/ | ||
public interface HttpInterceptor { | ||
|
||
void apply(HttpRequest httpRequest); | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/cowave/commons/client/http/HttpServiceChooser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.cowave.commons.client.http; | ||
|
||
/** | ||
* | ||
* @author shanhuiming | ||
* | ||
*/ | ||
public interface HttpServiceChooser { | ||
|
||
String choose(String name); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.