1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

polish #761 update pkg name & maven coordinate for Greenwich

This commit is contained in:
fangjian0423
2019-07-23 11:03:04 +08:00
parent 3998ea23f7
commit 883c66f251
599 changed files with 4993 additions and 4526 deletions

View File

@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.springframework.cloud</groupId>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<version>0.9.1.BUILD-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
@@ -19,7 +19,7 @@
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
@@ -39,7 +39,7 @@
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-sentinel-gateway</artifactId>
</dependency>

View File

@@ -14,18 +14,19 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.cloud.examples;
package com.alibaba.cloud.examples;
import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.BlockRequestHandler;
import static org.springframework.web.reactive.function.BodyInserters.fromObject;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.ServerResponse;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
import static org.springframework.web.reactive.function.BodyInserters.fromObject;
import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.BlockRequestHandler;
import reactor.core.publisher.Mono;
/**
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
@@ -33,16 +34,17 @@ import static org.springframework.web.reactive.function.BodyInserters.fromObject
@Configuration
public class MySCGConfiguration {
@Bean
public BlockRequestHandler blockRequestHandler() {
return new BlockRequestHandler() {
@Override
public Mono<ServerResponse> handleRequest(ServerWebExchange exchange, Throwable t) {
return ServerResponse.status(444)
.contentType(MediaType.APPLICATION_JSON_UTF8)
.body(fromObject("SCS Sentinel block"));
}
};
}
@Bean
public BlockRequestHandler blockRequestHandler() {
return new BlockRequestHandler() {
@Override
public Mono<ServerResponse> handleRequest(ServerWebExchange exchange,
Throwable t) {
return ServerResponse.status(444)
.contentType(MediaType.APPLICATION_JSON_UTF8)
.body(fromObject("SCS Sentinel block"));
}
};
}
}

View File

@@ -14,11 +14,14 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.cloud.examples;
package com.alibaba.cloud.examples;
import java.util.List;
import java.util.Set;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.csp.sentinel.adapter.gateway.common.api.ApiDefinition;
import com.alibaba.csp.sentinel.adapter.gateway.common.api.GatewayApiDefinitionManager;
import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayFlowRule;
@@ -26,8 +29,6 @@ import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayRuleManager;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;
/**
@@ -36,19 +37,19 @@ import reactor.core.publisher.Mono;
@RestController
public class RulesWebFluxController {
@GetMapping("/api")
public Mono<Set<ApiDefinition>> apiRules() {
return Mono.just(GatewayApiDefinitionManager.getApiDefinitions());
}
@GetMapping("/api")
public Mono<Set<ApiDefinition>> apiRules() {
return Mono.just(GatewayApiDefinitionManager.getApiDefinitions());
}
@GetMapping("/gateway")
public Mono<Set<GatewayFlowRule>> apiGateway() {
return Mono.just(GatewayRuleManager.getRules());
}
@GetMapping("/gateway")
public Mono<Set<GatewayFlowRule>> apiGateway() {
return Mono.just(GatewayRuleManager.getRules());
}
@GetMapping("/flow")
public Mono<List<FlowRule>> apiFlow() {
return Mono.just(FlowRuleManager.getRules());
}
@GetMapping("/flow")
public Mono<List<FlowRule>> apiFlow() {
return Mono.just(FlowRuleManager.getRules());
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.cloud.examples;
package com.alibaba.cloud.examples;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -25,9 +25,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SentinelSpringCloudGatewayApplication {
public static void main(String[] args) {
//GatewayCallbackManager.setRequestOriginParser(s -> "123");
SpringApplication.run(SentinelSpringCloudGatewayApplication.class, args);
}
public static void main(String[] args) {
// GatewayCallbackManager.setRequestOriginParser(s -> "123");
SpringApplication.run(SentinelSpringCloudGatewayApplication.class, args);
}
}