-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* #71 add post-execute-condition * #71 add post-execute-condition * #71 add post-execute-condition reduce code duplication for tests (not optimal but it improves maintainability) * #71 add post-execute-condition prepare snapshot release * #71 add post-execute-condition fix wrong directory for general-tests * #71 add post-execute-condition * github actions test report * #71 add post-execute-condition minor refactoring add empty response body test * #71 add post-execute-condition tests: - change response status code - additional response headers * #71 add post-execute-condition tests: - skip condition * #71 add post-execute-condition tests: - execute condition
- bucket4j-spring-boot-starter-parent-0.12.8
- bucket4j-spring-boot-starter-parent-0.12.7
- bucket4j-spring-boot-starter-parent-0.12.6
- bucket4j-spring-boot-starter-parent-0.12.5
- bucket4j-spring-boot-starter-parent-0.12.4
- bucket4j-spring-boot-starter-parent-0.12.3
- bucket4j-spring-boot-starter-parent-0.12.2
- bucket4j-spring-boot-starter-parent-0.12.1
- bucket4j-spring-boot-starter-parent-0.12.0
- bucket4j-spring-boot-starter-parent-0.11.0
1 parent
545c8af
commit 9bf6cd0
Showing
108 changed files
with
2,563 additions
and
2,358 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
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 |
---|---|---|
|
@@ -6,4 +6,5 @@ | |
*.iml | ||
.factorypath | ||
.apt_generated | ||
.springBeans | ||
.springBeans | ||
.flattened-pom.xml |
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
24 changes: 0 additions & 24 deletions
24
...rc/main/java/com/giffing/bucket4j/spring/boot/starter/context/ConsumptionProbeHolder.java
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
...xt/src/main/java/com/giffing/bucket4j/spring/boot/starter/context/PostRateLimitCheck.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,20 @@ | ||
package com.giffing.bucket4j.spring.boot.starter.context; | ||
|
||
|
||
|
||
/** | ||
* Used to check if the rate limit should be performed independently from the servlet|webflux|gateway request filter | ||
* | ||
*/ | ||
@FunctionalInterface | ||
public interface PostRateLimitCheck<R, P> { | ||
|
||
/** | ||
* @param request the request information object | ||
* @param response the response information object | ||
* | ||
* @return null if no rate limit should be performed. (maybe skipped or shouldn't be executed). | ||
*/ | ||
RateLimitResultWrapper rateLimit(R request, P response); | ||
|
||
} |
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
25 changes: 25 additions & 0 deletions
25
...ntext/src/main/java/com/giffing/bucket4j/spring/boot/starter/context/RateLimitResult.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,25 @@ | ||
package com.giffing.bucket4j.spring.boot.starter.context; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NonNull; | ||
|
||
@Data | ||
@Builder | ||
public class RateLimitResult { | ||
|
||
@NonNull | ||
private final boolean estimation; | ||
|
||
@NonNull | ||
private final boolean consumed; | ||
|
||
@NonNull | ||
private final long remainingTokens; | ||
|
||
@NonNull | ||
private final long nanosToWaitForRefill; | ||
|
||
@NonNull | ||
private final long nanosToWaitForReset; | ||
} |
23 changes: 23 additions & 0 deletions
23
...rc/main/java/com/giffing/bucket4j/spring/boot/starter/context/RateLimitResultWrapper.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,23 @@ | ||
package com.giffing.bucket4j.spring.boot.starter.context; | ||
|
||
import lombok.Data; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
|
||
@Data | ||
public class RateLimitResultWrapper { | ||
|
||
private RateLimitResult rateLimitResult; | ||
|
||
private CompletableFuture<RateLimitResult> rateLimitResultCompletableFuture; | ||
|
||
public RateLimitResultWrapper(RateLimitResult rateLimitResult) { | ||
this.rateLimitResult = rateLimitResult; | ||
} | ||
|
||
public RateLimitResultWrapper(CompletableFuture<RateLimitResult> rateLimitResultCompletableFuture) { | ||
this.rateLimitResultCompletableFuture = rateLimitResultCompletableFuture; | ||
} | ||
|
||
} |
15 changes: 5 additions & 10 deletions
15
.../src/main/java/com/giffing/bucket4j/spring/boot/starter/context/properties/BandWidth.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
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
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
15 changes: 15 additions & 0 deletions
15
...ext/src/main/java/com/giffing/bucket4j/spring/boot/starter/context/qualifier/Gateway.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,15 @@ | ||
package com.giffing.bucket4j.spring.boot.starter.context.qualifier; | ||
|
||
import org.springframework.beans.factory.annotation.Qualifier; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Qualifier(Gateway.VALUE) | ||
public @interface Gateway { | ||
String VALUE = "GATEWAY"; | ||
} |
15 changes: 15 additions & 0 deletions
15
...ext/src/main/java/com/giffing/bucket4j/spring/boot/starter/context/qualifier/Servlet.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,15 @@ | ||
package com.giffing.bucket4j.spring.boot.starter.context.qualifier; | ||
|
||
import org.springframework.beans.factory.annotation.Qualifier; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Qualifier(Servlet.VALUE) | ||
public @interface Servlet { | ||
String VALUE = "SERVLET"; | ||
} |
15 changes: 15 additions & 0 deletions
15
...ext/src/main/java/com/giffing/bucket4j/spring/boot/starter/context/qualifier/Webflux.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,15 @@ | ||
package com.giffing.bucket4j.spring.boot.starter.context.qualifier; | ||
|
||
import org.springframework.beans.factory.annotation.Qualifier; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Qualifier(Webflux.VALUE) | ||
public @interface Webflux { | ||
String VALUE = "WEBFLUX"; | ||
} |
Oops, something went wrong.