@Override public Boolean skip(final ServerWebExchange exchange) { final RequestDTO body = exchange.getAttribute(Constants.REQUESTDTO); return Objects.equals(Objects.requireNonNull(body).getRpcType(), RpcTypeEnum.DUBBO.getName()); }
/** * acquire operator supports. * * @return operator support. */ public static List<RpcTypeEnum> acquireSupports() { return Arrays.stream(RpcTypeEnum.values()) .filter(e -> e.support).collect(Collectors.toList()); }
.collect(Collectors.toList()); List<EnumVO> rpcTypeEnums = RpcTypeEnum.acquireSupports().stream() .map(rpcTypeEnum -> new EnumVO(null, rpcTypeEnum.getName(), rpcTypeEnum.getSupport())) .collect(Collectors.toList());
private Boolean verify(final RequestDTO requestDTO, final ServerWebExchange exchange) { if (Objects.isNull(requestDTO) || StringUtils.isBlank(requestDTO.getModule()) || StringUtils.isBlank(requestDTO.getMethod())) { return false; } final RpcTypeEnum rpcTypeEnum = RpcTypeEnum.acquireByName(requestDTO.getRpcType()); if (Objects.isNull(rpcTypeEnum)) { return false; } //if rpcType is dubbo if (Objects.equals(rpcTypeEnum.getName(), RpcTypeEnum.DUBBO.getName())) { final String dubboParams = requestDTO.getDubboParams(); if (StringUtils.isBlank(dubboParams)) { return false; } final Map<String, Object> paramMap = GSONUtils.getInstance().toObjectMap(dubboParams); if (paramMap.containsKey(DubboParamConstants.INTERFACE_NAME) && paramMap.containsKey(DubboParamConstants.METHOD)) { exchange.getAttributes().put(Constants.DUBBO_PARAMS, paramMap); return true; } else { return false; } } else { return !StringUtils.isBlank(requestDTO.getHttpMethod()) && !Objects.isNull(HttpMethodEnum.acquireByName(requestDTO.getHttpMethod())); } }
/** * plugin is execute. * * @param exchange the current server exchange * @return default false. */ @Override public Boolean skip(final ServerWebExchange exchange) { final RequestDTO body = exchange.getAttribute(Constants.REQUESTDTO); return !Objects.equals(Objects.requireNonNull(body).getRpcType(), RpcTypeEnum.SPRING_CLOUD.getName()); } }
/** * acquireByName. * * @param name this is rpc type * @return RpcTypeEnum */ public static RpcTypeEnum acquireByName(final String name) { return Arrays.stream(RpcTypeEnum.values()) .filter(e -> e.support && e.name.equals(name)).findFirst() .orElseThrow(() -> new SoulException(" this rpc type can not support!")); } }
/** * plugin is execute. * * @return default false. */ @Override public Boolean skip(final ServerWebExchange exchange) { final RequestDTO body = exchange.getAttribute(Constants.REQUESTDTO); return !Objects.equals(Objects.requireNonNull(body).getRpcType(), RpcTypeEnum.HTTP.getName()); }
/** * plugin is execute. * * @param exchange the current server exchange * @return default false. */ @Override public Boolean skip(final ServerWebExchange exchange) { final RequestDTO body = exchange.getAttribute(Constants.REQUESTDTO); assert body != null; return !Objects.equals(body.getRpcType(), RpcTypeEnum.DUBBO.getName()); }
if (requestDTO.getRpcType().equals(RpcTypeEnum.DUBBO.getName())) {