A Gateway built on Spring Framework and Spring Boot providing routing and more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
3.7 KiB

MVC Gateway Server (#2949) * Initial support for Gateway Server MVC Includes: - FilterFunctions - HandlerFunctions - TestRestClient Fixes gh-36 * Adds ProxyExchange abstraction and RestTemplate impl. Also formatting and polish * Migrates from RestTemplateProxyExchange to ClientHttpRequestFactoryProxyExchange Also implements GatewayServerResponse that is mutable. * Removes RestTemplateProxyExchange.javaˆ * Allows resolving uri by request attribute * formattingˆ * Moved beans to GatewayServerMvcAutoConfiguration * Removes unneeded GatewayServerRequestBuilder.javaˆ * Adds addRequestParameter filter * Adds FilterFunctions.setPath() * Moves FilterFunctions.addResponseHeader() * Adds FilterFunctions.stripPrefix() * Moves ProxyExchangeHandlerFunction to bean. This allows easier autoconfiguration. * Adds HttpHeadersFilter and RemoveHopByHopR*HeadersFilter * removes unused imports * Initial local configuration compatibility with webflux server. Borrows Operation framework from Spring Boot Actuator. Discoverable predicates and filters are found via spring.factories. Currently only static methods are supported. Shortcut configuration is not yet supported. * Organized classes into individual packages * Copy request body to proxy exchange client request body * Changes getApplicationContext() to user RequestContextUtils rather than relying on the DispatcherServlet attribute. * Moves content to MvcUtils.java * Allows for multiple predicates and filters with the same name. * a get only route is to0 broad and causes a request loop * Save the anded predicate, whoops. Adds some trace logging as well. * Adds initial support for load balancing * Moves TestRestClient to client package * Moves handler related classes to handler package * Creates HandlerDiscoverer to dynamically load HandlerFunctions * polish * polish * Extracts findOperation()ˆ * Extracts invokeOperation() * Adds support for config uri type lb://serviceId * Adds uri template variable support. Adds supporting methods to MvcUtils.java. Expands uri templates in existing filters. * Adds support for host predicate * Adds support for circuit breaker filter * Adds initial support for retry filter * Adds initial support for Bucket4j rateLimit filter * Removes separate *Supplier classes if not needed. * Adds header request predicate * Fixes accept() methods to better values. * Adds support for cookie predicate * Adds support for after, before and between time predicates * Adds support for FilterFunctions.rewritePath() * Adds support for shortcut configuration. Adds Shortcut annotation to provide hints. Extracts OperationMethod into an interface with DefaultOperationMethod the impl. Adds NormalizedOperationMethod which uses the Shortcut annotation to normalize the arguments and give them the right keys. All Shortcut logic is here. * Format comments * Adds support for Forwarded and X-Forwarded-* Headers * Moves TestLoadBalancerConfig to top level to shareˆ * Uses JdkClientHttpRequestFactory. * Adds routeId to RouterFunction.withAttribute() * Adds toString()ˆ * Shows sample of combining java dsl * Implements refresh of config based routes. * Adds support for proxying multipart form data. * removes unneeded multipart propertyˆ * Adds support for RestClientProxyExchange Not yet the default. Waiting for a change that will eliminate reflection in RestClientProxyExchange Created ProxyExchange.DefaultRequestBuilder as the code was duplicated in the two implementations. * polishes ProxyExchangeHandlerFunction * Adds ProxyExchange.ResponseConsumer Adds ProxyExchange.Response and migrates away from ResponseHeadersFilter on the request to something more generic. * Closes clientHttpResponse appropriately. * Closes clientHttpResponse appropriately. * Updates to use new WriteFunction interface * Removes unused apache httpclient5 dependency * Uses new RestClientCustomizer to add ClientHttpRequestFactory. Changes constructor of RestClientProxyExchange to take a RestClient.
1 year ago
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2013-2023 the original author or authors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ https://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gateway</artifactId>
<version>4.1.0-SNAPSHOT</version>
<relativePath>..</relativePath> <!-- lookup parent from repository -->
</parent>
<artifactId>spring-cloud-gateway-server-mvc</artifactId>
<packaging>jar</packaging>
<name>Spring Cloud Gateway Server MVC</name>
<description>Spring Cloud Gateway Server MVC</description>
<properties>
<main.basedir>${basedir}/..</main.basedir>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-circuitbreaker-reactor-resilience4j</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-loadbalancer</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.bucket4j</groupId>
<artifactId>bucket4j-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.bucket4j</groupId>
<artifactId>bucket4j-caffeine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
MVC Gateway Server (#2949) * Initial support for Gateway Server MVC Includes: - FilterFunctions - HandlerFunctions - TestRestClient Fixes gh-36 * Adds ProxyExchange abstraction and RestTemplate impl. Also formatting and polish * Migrates from RestTemplateProxyExchange to ClientHttpRequestFactoryProxyExchange Also implements GatewayServerResponse that is mutable. * Removes RestTemplateProxyExchange.javaˆ * Allows resolving uri by request attribute * formattingˆ * Moved beans to GatewayServerMvcAutoConfiguration * Removes unneeded GatewayServerRequestBuilder.javaˆ * Adds addRequestParameter filter * Adds FilterFunctions.setPath() * Moves FilterFunctions.addResponseHeader() * Adds FilterFunctions.stripPrefix() * Moves ProxyExchangeHandlerFunction to bean. This allows easier autoconfiguration. * Adds HttpHeadersFilter and RemoveHopByHopR*HeadersFilter * removes unused imports * Initial local configuration compatibility with webflux server. Borrows Operation framework from Spring Boot Actuator. Discoverable predicates and filters are found via spring.factories. Currently only static methods are supported. Shortcut configuration is not yet supported. * Organized classes into individual packages * Copy request body to proxy exchange client request body * Changes getApplicationContext() to user RequestContextUtils rather than relying on the DispatcherServlet attribute. * Moves content to MvcUtils.java * Allows for multiple predicates and filters with the same name. * a get only route is to0 broad and causes a request loop * Save the anded predicate, whoops. Adds some trace logging as well. * Adds initial support for load balancing * Moves TestRestClient to client package * Moves handler related classes to handler package * Creates HandlerDiscoverer to dynamically load HandlerFunctions * polish * polish * Extracts findOperation()ˆ * Extracts invokeOperation() * Adds support for config uri type lb://serviceId * Adds uri template variable support. Adds supporting methods to MvcUtils.java. Expands uri templates in existing filters. * Adds support for host predicate * Adds support for circuit breaker filter * Adds initial support for retry filter * Adds initial support for Bucket4j rateLimit filter * Removes separate *Supplier classes if not needed. * Adds header request predicate * Fixes accept() methods to better values. * Adds support for cookie predicate * Adds support for after, before and between time predicates * Adds support for FilterFunctions.rewritePath() * Adds support for shortcut configuration. Adds Shortcut annotation to provide hints. Extracts OperationMethod into an interface with DefaultOperationMethod the impl. Adds NormalizedOperationMethod which uses the Shortcut annotation to normalize the arguments and give them the right keys. All Shortcut logic is here. * Format comments * Adds support for Forwarded and X-Forwarded-* Headers * Moves TestLoadBalancerConfig to top level to shareˆ * Uses JdkClientHttpRequestFactory. * Adds routeId to RouterFunction.withAttribute() * Adds toString()ˆ * Shows sample of combining java dsl * Implements refresh of config based routes. * Adds support for proxying multipart form data. * removes unneeded multipart propertyˆ * Adds support for RestClientProxyExchange Not yet the default. Waiting for a change that will eliminate reflection in RestClientProxyExchange Created ProxyExchange.DefaultRequestBuilder as the code was duplicated in the two implementations. * polishes ProxyExchangeHandlerFunction * Adds ProxyExchange.ResponseConsumer Adds ProxyExchange.Response and migrates away from ResponseHeadersFilter on the request to something more generic. * Closes clientHttpResponse appropriately. * Closes clientHttpResponse appropriately. * Updates to use new WriteFunction interface * Removes unused apache httpclient5 dependency * Uses new RestClientCustomizer to add ClientHttpRequestFactory. Changes constructor of RestClientProxyExchange to take a RestClient.
1 year ago
</dependencies>
</project>