Search in sources :

Example 1 with FilterRouteDO

use of io.github.tesla.filter.domain.FilterRouteDO in project tesla by linking12.

the class HttpFiltersAdapter method dynamicsRouting.

// dynamics route
public void dynamicsRouting(HttpRequest httpRequest) {
    String actorPath = httpRequest.uri();
    int index = actorPath.indexOf("?");
    if (index > -1) {
        actorPath = actorPath.substring(0, index);
    }
    FilterRouteDO route = dynamicsRouteCache.getRoute(actorPath);
    if (route != null) {
        String targetPath = route.getToPath();
        String targetHostAndPort = route.getToHostport();
        if (targetHostAndPort != null)
            httpRequest.headers().set(HttpHeaderNames.HOST, targetHostAndPort);
        if (targetPath != null)
            httpRequest.setUri(targetPath);
    }
}
Also used : FilterRouteDO(io.github.tesla.filter.domain.FilterRouteDO)

Example 2 with FilterRouteDO

use of io.github.tesla.filter.domain.FilterRouteDO in project tesla by linking12.

the class FilterRouteDto method buildRoute.

public FilterRouteDO buildRoute() {
    FilterRouteDO routeDo = new FilterRouteDO();
    if (this.routeId != null && this.routeId != 0) {
        routeDo.setId(this.routeId);
    }
    routeDo.setFromPath(this.fromPath);
    routeDo.setServiceId(this.serviceId);
    routeDo.setToHostport(this.toHostport);
    routeDo.setToPath(this.toPath);
    routeDo.setRpc(this.rpc);
    return routeDo;
}
Also used : FilterRouteDO(io.github.tesla.filter.domain.FilterRouteDO)

Example 3 with FilterRouteDO

use of io.github.tesla.filter.domain.FilterRouteDO in project tesla by linking12.

the class FilterRouteServiceImpl method list.

@Override
public List<FilterRouteDto> list(Map<String, Object> map) {
    List<FilterRouteDO> routes = routeDao.list(map);
    List<FilterRouteDto> routeDtos = Lists.newArrayList();
    for (FilterRouteDO route : routes) {
        FilterRpcDO rpc = rpcDao.get(route.getId());
        FilterRouteDto routeDto = FilterRouteDto.buildRouteDto(route, rpc);
        routeDtos.add(routeDto);
    }
    return routeDtos;
}
Also used : FilterRouteDO(io.github.tesla.filter.domain.FilterRouteDO) FilterRouteDto(io.github.tesla.ops.filter.dto.FilterRouteDto) FilterRpcDO(io.github.tesla.filter.domain.FilterRpcDO)

Example 4 with FilterRouteDO

use of io.github.tesla.filter.domain.FilterRouteDO in project tesla by linking12.

the class FilterRouteServiceImpl method update.

@Override
public int update(FilterRouteDto routeDto) {
    FilterRouteDO routeDo = routeDto.buildRoute();
    FilterRpcDO rpcDo = routeDto.buildRpc();
    int success2 = routeDao.update(routeDo);
    if (routeDo.getRpc()) {
        int success1 = rpcDao.update(rpcDo);
        if (success1 > 0 && success2 > 0) {
            return CommonResponse.SUCCESS;
        } else {
            return CommonResponse.ERROR;
        }
    }
    return success2;
}
Also used : FilterRouteDO(io.github.tesla.filter.domain.FilterRouteDO) FilterRpcDO(io.github.tesla.filter.domain.FilterRpcDO)

Example 5 with FilterRouteDO

use of io.github.tesla.filter.domain.FilterRouteDO in project tesla by linking12.

the class FilterRouteServiceImpl method get.

@Override
public FilterRouteDto get(Long routeId) {
    FilterRouteDO route = routeDao.get(routeId);
    FilterRpcDO rpc = rpcDao.get(routeId);
    FilterRouteDto routeDto = FilterRouteDto.buildRouteDto(route, rpc);
    return routeDto;
}
Also used : FilterRouteDO(io.github.tesla.filter.domain.FilterRouteDO) FilterRouteDto(io.github.tesla.ops.filter.dto.FilterRouteDto) FilterRpcDO(io.github.tesla.filter.domain.FilterRpcDO)

Aggregations

FilterRouteDO (io.github.tesla.filter.domain.FilterRouteDO)8 FilterRpcDO (io.github.tesla.filter.domain.FilterRpcDO)6 FilterRouteDto (io.github.tesla.ops.filter.dto.FilterRouteDto)3 PageDO (io.github.tesla.ops.system.domain.PageDO)1