当前位置: 首页 > news >正文

建网站如何收费工商局企业信息查询系统

建网站如何收费,工商局企业信息查询系统,中国软件是外包公司吗,辽宁建设工程信息网内容Spring Cloud Gateway官网:Spring Cloud Gateway 局域网中就有网关这个概念#xff0c;局域网接收数据或发送数据都要通过网关#xff0c;比如使用VMware虚拟机软件搭建虚拟机集群的时候#xff0c;往往我们需要选择IP段中的⼀个IP作为网关地址,网关可以对请求进行控制,提升…         Spring Cloud Gateway官网:Spring Cloud Gateway         局域网中就有网关这个概念局域网接收数据或发送数据都要通过网关比如使用VMware虚拟机软件搭建虚拟机集群的时候往往我们需要选择IP段中的⼀个IP作为网关地址,网关可以对请求进行控制,提升我们系统的安全性         Spring Cloud Gateway是Spring Cloud的一个全新项目目标是取代Netflix公司的Zuul网关它基于 Spring 5 SpringBoot2.0 WebFlux(等同于Spring MVC) 基于高性能的Reactor模式响应式通信框架Netty异步非阻塞模型等技术构建性能高于Zuul网关官方测试Gateway是Zuul性能的1.6倍旨在为微服务架构提供一种简单有效的统一的API路由管理方式。         Spring Cloud Gateway不仅提供统一的路由方式反向代理并且基于Filter定义过滤器对请求过滤完成一些功能链的方式提供了网关基本的功能。例如鉴权、流量控制、熔断、路径重写、日志监控等 Gateway核心概念         底层是基于Reactor模型(同步非阻塞的I/O多路复用机制),一个请求到达网关后,可以设置条件,来控制请求是否能通过,也可以进行一些比较具体的控制(限流,日志,黑白名单)         路由(route):在vue中路由决定了请求的去向,在网关中每一个路由有一个ID,一个目标地址(URL),也可以有Predicates断言(匹配条件判断)和Filter过滤器(精细化控制)         断言(predicates):匹配判断条件         过滤器(filter),一个标准的Spring Web Filter,使用过滤器可以在请求之前或者之后执行业务逻辑     工作流程图(可以到官网查看)                               客户端向Spring Cloud Gateway发出请求然后在Gateway Handler Mapping中找到与请求相匹配的路由将其发送到Gateway Web Handler;Handler再通过指定的过滤器链来将请求发送到我们实际的服务执行业务逻辑然后返回。过滤器之间用虚线分开是因为过滤器可能会在发送代理请求之前pre或者之后post执行业务逻辑。         Filter在pre类型过滤器中可以做参数校验、权限校验、流量监控、日志输出、协议转换等在post类型的过滤器中可以做响应内容、响应头的修改、日志的输出、流量监控等。 在Spring Cloud整合Gateway         1.创建cloud的微服务项目            2..引入yom文件 !-- Spring Boot父启动器依赖 --parentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion2.1.6.RELEASE/versionrelativePath//parentdependenciesdependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-commons/artifactId/dependencydependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-netflix-eureka-client/artifactId/dependency!-- 1Gateway网关 --dependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-gateway/artifactId/dependency!-- 2引入WebFlux --dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-webflux/artifactId/dependency!-- 日志依赖 --dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-logging/artifactId/dependency!-- 测试依赖 --dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-test/artifactIdscopetest/scope/dependency!-- Lombok工具 --dependencygroupIdorg.projectlombok/groupIdartifactIdlombok/artifactIdversion1.18.4/versionscopeprovided/scope/dependency!-- 引入Jaxb开始 --dependencygroupIdcom.sun.xml.bind/groupIdartifactIdjaxb-core/artifactIdversion2.2.11/version/dependencydependencygroupIdjavax.xml.bind/groupIdartifactIdjaxb-api/artifactId/dependencydependencygroupIdcom.sun.xml.bind/groupIdartifactIdjaxb-impl/artifactIdversion2.2.11/version/dependencydependencygroupIdorg.glassfish.jaxb/groupIdartifactIdjaxb-runtime/artifactIdversion2.2.10-b140310.1920/version/dependencydependencygroupIdjavax.activation/groupIdartifactIdactivation/artifactIdversion1.1.1/version/dependency!-- 引入Jaxb结束 --!-- Actuator可以帮助你监控和管理Spring Boot应用 --dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-actuator/artifactId/dependency!-- 热部署 --dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-devtools/artifactIdoptionaltrue/optional/dependency!-- 链路追踪 --dependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-sleuth/artifactId/dependencydependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-zipkin/artifactId/dependency/dependenciesdependencyManagement!-- Spring Cloud依赖版本管理 --dependenciesdependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-dependencies/artifactIdversionGreenwich.RELEASE/versiontypepom/typescopeimport/scope/dependency/dependencies/dependencyManagementbuildplugins!-- 编译插件 --plugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-compiler-plugin/artifactIdconfigurationsource1.8/sourcetarget1.8/targetencodingutf-8/encoding/configuration/plugin!-- 打包插件 --plugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactId/plugin/plugins/build         3.创建项目启动类 import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;EnableDiscoveryClient SpringBootApplication public class CloudApplilcation9300 {public static void main(String[] args) {SpringApplication.run(CloudApplilcation9300.class,args);} }4.编写配置文件         application.properties server.port9300 eureka.client.service-url.defaultZone http://LEQCloudEurekaServerA:9200/eureka,http://LEQCloudEurekaServerB:9201/eureka eureka.instance.prefer-ip-addresstrue eureka.instance.instance-id${spring.cloud.client.ipaddress}:${spring.application.name}:${server.port}:project.versionspring.application.nameleq-cloud-gatewayapplication.yml spring:cloud:gateway: # gateway网关配置routes: # 配置路由- id: service-page-router# 动态路由从(消费)注册中⼼获取对应服务的实例uri: http://127.0.0.1:9100predicates: # 当断言匹配成功后则将请求转发给某个微服务- Path/page/**- id: service-product-routeruri: http://127.0.0.1:9000predicates:# http://127.0.0.1:9300/product/query/1 - /query/1 - 商品微服务- Path/product/**filters:# 访问uri时会过滤掉uri中Path取值匹配上的前一部分uri中第二部分才是目标访问路径- StripPrefix1             5.重启整个微服务的项目,先启动两个服务注册中心,剩下的在服务中心之后即可,访问生产者的端口需要我们多加一个路径,因为我们配置了会将path路径的上一部分过滤掉 http://localhost:9300/page/getPort http://localhost:9300/page/query/1 http://localhost:9300/product/product/findById/1 http://localhost:9300/product/server/getPort                  6.动态路由(从注册中心获取对应服务的实例)                 lb://注册中心服务名 uri: lb://leq-service-page          重启cloud服务我们刚刚的接口都还可以正常访问 过滤器         生命周期                 pre:这种过滤器在请求被路由之前调用。我们可利用这种过滤器实现身份验证、在集群中选择请求的微服务、记录调试信息等                 post:这种过滤器在路由到微服务以后执行。这种过滤器可用来为响应添加标准的HTTP Header、收集统计信息和指标、将响应从微服务发送给客户端等         类型                 GatewayFilter:应用到单个路由上                 GlobalFilter:应用到所有的路由上          过滤器的使用:         1.创建filter的配置类,来拦截消息并判断是否放行 import lombok.extern.slf4j.Slf4j; import org.springframework.cloud.gateway.filter.GatewayFilterChain; import org.springframework.cloud.gateway.filter.GlobalFilter; import org.springframework.core.Ordered; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.http.HttpStatus; import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.http.server.reactive.ServerHttpResponse; import org.springframework.stereotype.Component; import org.springframework.web.server.ServerWebExchange; import reactor.core.publisher.Mono;import java.util.ArrayList; import java.util.List;//定义全局过滤器,会对所有路由生效 Slf4j Component public class BlacklistGlobalFilter implements GlobalFilter, Ordered {//创建黑名单集合private static ListString blacklist new ArrayList();//添加黑名单static{blacklist.add(127.0.0.1);blacklist.add(10.48.185.7);}Override//编写过滤规则 exchange 封装了request和response对象 chain网关过滤器链(全局过滤器,单路由过滤器) Mono对象public MonoVoid filter(ServerWebExchange exchange, GatewayFilterChain chain) {//获取请求和响应对象ServerHttpRequest request exchange.getRequest();ServerHttpResponse response exchange.getResponse();//通过request对象获取ipString clientIP request.getRemoteAddress().getHostString();System.out.println(ip:clientIP);if(blacklist.contains(clientIP)){// 状态码response.setStatusCode(HttpStatus.UNAUTHORIZED);DataBuffer wrap response.bufferFactory().wrap(Request be denined!.getBytes());//拒绝访问,返回执行的结果数据return response.writeWith(Mono.just(wrap));}//合法请求放行return chain.filter(exchange);}Override//返回值表示当前过滤器过滤的顺序,数字越小越靠前public int getOrder() {return 0;} }         2.重启cloud服务器          可以看到我们配置放心的可以正常访问,被拦截的就返回的是我们自定义的返回值 高可用                 配置多个Gateway实例 upstream gateway {server 127.0.0.1:9300;server 127.0.0.1:9301; } location / {proxy_pass http://gateway; }          启动多个Gateway实例来实现高可用在Gateway的上游使用Nginx等负载均衡设 备进行负载转发以达到高可用的目的
http://wiki.neutronadmin.com/news/283604/

相关文章:

  • 湛江建设局网站镇江外贸型网站建设
  • 腾讯云网站托管互联网外包公司有哪些
  • 网站前台功能模块设计网站管理系统 手机
  • 做网站如何使用数据库可以加速网页的加速器
  • 保定网站建设苗木wordpress 生成 app
  • 大连商城网站制作网站商务通登陆不上
  • wordpress视频站模板网站服务器上线后要怎么做
  • 网站托管费做网络调查的网站赚钱
  • 丹阳高铁站对面的规划做进口产品的网站
  • cms网站搭建好了再怎么做网络广告类型
  • 网站页面html静态化哪个网站可以卖自己做的模型
  • 北京做网站建设的公司哪家好北京做网站报价
  • 软件开发模型的v模型图成都百度推广和seo优化
  • 网站建设的背景有哪些asp最新版本
  • 在线模版下载网站短视频营销的特点
  • wordpress 导入数据seo快速优化软件网站
  • 响应式网站适合用什么框架做网页制作教程赵丰年
  • 国内做优秀的农业信息网站自己做影视网站怎么找代理商
  • 网站开发的常见编程语言有哪些合肥网站建设设计外包
  • 企业对网站建设的发展如何制作个人网页兼职主页
  • 江苏首天建设集团网站程序外包平台
  • 企业网站怎么收录网站开发与网站制作
  • 云南大永高速公路建设指挥部网站上海网站制作科技公司
  • 做网站最重要的是什么注册安全工程师
  • 泰州市做网站连云港网站开发公司
  • 商城顺德网站建设网站服务器模式
  • 浙江人工智能建站系统软件运城seo招聘
  • 软件通网站建设ios 常用网站
  • 企业网站建设的建议对于网站建设的调查问卷
  • 用网站做自我介绍ppt大连建站系统模板