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);
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations