Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@
@ConditionalOnProperty(name = MICROSPHERE_GATEWAY_ENABLED_PROPERTY_NAME,
havingValue = DEFAULT_MICROSPHERE_GATEWAY_ENABLED, matchIfMissing = true)
public @interface ConditionalOnMicrosphereGatewayEnabled {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@
@ConditionalOnProperty(name = MICROSPHERE_WEB_ENDPOINT_MAPPING_ENABLED_PROPERTY_NAME,
havingValue = DEFAULT_MICROSPHERE_GATEWAY_ENABLED, matchIfMissing = true)
public @interface ConditionalOnMicrosphereWebEndpointMappingEnabled {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ public void onFinish(ConfigurationPropertyName name, Bindable<?> target, BindCon
public void setEnvironment(Environment environment) {
this.environment = environment;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ public interface CommonConstants {
* The URI template variable name for application name
*/
String APPLICATION_NAME_URI_TEMPLATE_VARIABLE_NAME = "application";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ public interface CommonsPropertyConstants {
source = APPLICATION_SOURCE
)
String MICROSPHERE_WEB_ENDPOINT_MAPPING_ENABLED_PROPERTY_NAME = MICROSPHERE_WEB_ENDPOINT_MAPPING_PROPERTY_NAME_PREFIX + ENABLED_PROPERTY_NAME;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ public interface RouteConstants {
* The attribute name of Web Endpoint rewrite path
*/
String WEB_ENDPOINT_REWRITE_PATH_ATTRIBUTE_NAME = "msgw-we-rewrite-path";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package io.microsphere.spring.cloud.gateway.commons.config;


import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.env.YamlPropertySourceLoader;
Expand Down Expand Up @@ -130,4 +129,4 @@ static void assertWebEndpointConfig(WebEndpointConfig config) {
assertArrayEquals(ofArray("application/json"), exclude.getConsumes());
assertArrayEquals(ofArray("plain/text"), exclude.getProduces());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package io.microsphere.spring.cloud.gateway.commons.config;


import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.context.properties.bind.BindHandler;
Expand Down Expand Up @@ -70,4 +69,4 @@ void testApply() {
binder.bind("spring.cloud.gateway.routes[2].metadata", bindable);
binder.bind("spring.cloud", bindable);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package io.microsphere.spring.cloud.gateway.commons.constants;


import org.junit.jupiter.api.Test;

import static io.microsphere.spring.cloud.gateway.commons.constants.CommonConstants.APPLICATION_NAME_URI_TEMPLATE_VARIABLE_NAME;
Expand All @@ -36,4 +35,4 @@ class CommonConstantsTest {
void testConstants() {
assertEquals("application", APPLICATION_NAME_URI_TEMPLATE_VARIABLE_NAME);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package io.microsphere.spring.cloud.gateway.commons.constants;


import org.junit.jupiter.api.Test;

import static io.microsphere.spring.cloud.gateway.commons.constants.CommonsPropertyConstants.DEFAULT_MICROSPHERE_GATEWAY_ENABLED;
Expand All @@ -44,4 +43,4 @@ void testConstants() {
assertEquals("microsphere.spring.cloud.web-endpoint-mapping.", MICROSPHERE_WEB_ENDPOINT_MAPPING_PROPERTY_NAME_PREFIX);
assertEquals("microsphere.spring.cloud.web-endpoint-mapping.enabled", MICROSPHERE_WEB_ENDPOINT_MAPPING_ENABLED_PROPERTY_NAME);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package io.microsphere.spring.cloud.gateway.commons.constants;


import org.junit.jupiter.api.Test;

import static io.microsphere.spring.cloud.gateway.commons.constants.RouteConstants.ALL_SERVICES;
Expand Down Expand Up @@ -46,4 +45,4 @@ void testConstants() {
assertEquals("web-endpoint", WEB_ENDPOINT_KEY);
assertEquals("msgw-we-rewrite-path", WEB_ENDPOINT_REWRITE_PATH_ATTRIBUTE_NAME);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
@Documented
@ConditionalOnProperty(name = GATEWAY_ENABLED_PROPERTY_NAME, matchIfMissing = true)
public @interface ConditionalOnGatewayEnabled {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@
FilteringWebHandlerBeanDefinitionRegistryPostProcessor.class
})
public class GatewayAutoConfiguration {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ public WebEndpointMappingGlobalFilter webEndpointMappingGlobalFilter(ReactiveDis
GatewayProperties gatewayProperties) {
return new WebEndpointMappingGlobalFilter(reactiveDiscoveryClient, loadBalancerClientFactory, gatewayProperties);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ public interface GatewayPropertyConstants {
* @see GatewayProperties#getRoutes()
*/
String GATEWAY_ROUTES_PROPERTY_NAME_PREFIX = PREFIX + DOT + "routes";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ public void initialize(ConfigurableApplicationContext context) {
registerBeanDefinition(registry, BEAN_NAME,
WebEndpointConfigurationPropertiesBindHandlerAdvisor.class, GATEWAY_ROUTES_PROPERTY_NAME_PREFIX);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ public void intercept(ApplicationListener<?> applicationListener, ApplicationEve
private boolean matchesHeartbeatEvent(Class<?> eventClass) {
return HeartbeatEvent.class.equals(eventClass) || ParentHeartbeatEvent.class.equals(eventClass);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ private boolean containsGatewayPropertyName(Set<String> keys) {
private boolean isGatewayPropertyName(String key) {
return startsWith(key, PREFIX);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ public Mono<Void> filter(ServerWebExchange exchange) {
}
return empty();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ RequestMappingContext getMatchingRequestMappingContext(String applicationName, S
RequestPath requestPath = request.getPath();
String path = requestPath.value();


String rewritePath = substringAfter(path, SLASH_CHAR + applicationName);
exchange.getAttributes().put(WEB_ENDPOINT_REWRITE_PATH_ATTRIBUTE_NAME, rewritePath);
ServerHttpRequest newRequest = request.mutate().path(rewritePath).build();
Expand Down Expand Up @@ -403,7 +402,6 @@ private List<RouteDefinition> getWebEndpointRoutes() {
return webEndpointRoutes;
}


Collection<String> getSubscribedServices(URI routeUri) {
String host = routeUri.getHost();
if (ALL_SERVICES.equals(host)) {
Expand Down Expand Up @@ -487,4 +485,4 @@ static void clear(Map<?, ?> map) {
map.clear();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ private boolean matchesEvent(RefreshRoutesResultEvent event) {
private List<GatewayFilter> globalFilters() {
return getFieldValue(this, "globalFilters");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
registerBeanDefinition(registry, beanName, CachingFilteringWebHandler.class);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package io.microsphere.spring.cloud.gateway.server.webflux.autoconfigure;


import io.microsphere.spring.cloud.gateway.server.webflux.filter.DefaultGatewayFilterChain;
import io.microsphere.spring.cloud.gateway.server.webflux.filter.NoOpGatewayFilter;
import io.microsphere.spring.cloud.gateway.server.webflux.filter.WebEndpointMappingGlobalFilter;
Expand Down Expand Up @@ -92,4 +91,4 @@ MockServerWebExchange createServerWebbExchange(String path) {
MockServerHttpRequest request = get(path).build();
return from(request);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package io.microsphere.spring.cloud.gateway.server.webflux.constants;


import org.junit.jupiter.api.Test;

import static io.microsphere.constants.PropertyConstants.ENABLED_PROPERTY_NAME;
Expand All @@ -41,4 +40,4 @@ void testConstants() {
assertEquals(PREFIX + DOT + ENABLED_PROPERTY_NAME, GATEWAY_ENABLED_PROPERTY_NAME);
assertEquals(PREFIX + DOT + "routes", GATEWAY_ROUTES_PROPERTY_NAME_PREFIX);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package io.microsphere.spring.cloud.gateway.server.webflux.event;


import io.microsphere.spring.context.event.EnableEventExtension;
import io.microsphere.util.ValueHolder;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -69,4 +68,4 @@ void testIntercept() {
Object payload = testValueHolder.getValue();
assertSame(value, payload);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package io.microsphere.spring.cloud.gateway.server.webflux.event;


import io.microsphere.spring.context.event.EnableEventExtension;
import io.microsphere.util.ValueHolder;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -80,4 +79,4 @@ void testOnApplicationEventWithoutGatewayProperties() {

assertNull(testValueHolder.getValue());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package io.microsphere.spring.cloud.gateway.server.webflux.filter;


import org.junit.jupiter.api.Test;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.mock.http.server.reactive.MockServerHttpRequest;
Expand Down Expand Up @@ -61,4 +60,4 @@ void testFilter() {
chain = new DefaultGatewayFilterChain(new NoOpGatewayFilter(), new NoOpGatewayFilter(), new NoOpGatewayFilter());
assertNotNull(chain.filter(serverWebExchange));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ private ServiceInstance createServiceInstance() {
serviceInstance.setPort(8080);
return serviceInstance;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package io.microsphere.spring.cloud.gateway.server.webflux.filter;


import io.microsphere.spring.cloud.client.event.ServiceInstancesChangedEvent;
import io.microsphere.spring.cloud.client.service.registry.DefaultRegistration;
import io.microsphere.spring.cloud.client.service.registry.event.RegistrationPreRegisteredEvent;
Expand Down Expand Up @@ -213,4 +212,4 @@ void testHelloWorldEndpoint() {
.expectBody(String.class)
.isEqualTo(testController.helloWorld());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ void testOnRefreshRoutesResultEvent(Throwable throwable) {
RefreshRoutesResultEvent event = new RefreshRoutesResultEvent(routeLocator, throwable);
this.webHandler.onRefreshRoutesResultEvent(event);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package io.microsphere.spring.cloud.gateway.server.webflux.util;


import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.env.YamlPropertySourceLoader;
Expand Down Expand Up @@ -100,4 +99,4 @@ void testIsSuccessRouteLocatorEvent() {
assertTrue(isSuccessRouteLocatorEvent(new RefreshRoutesResultEvent(routeLocator)));
assertFalse(isSuccessRouteLocatorEvent(new RefreshRoutesResultEvent(routeLocator, new Exception("For testing"))));
}
}
}
Loading