Java Code Examples for com.alibaba.dubbo.registry.common.util.Tool#getIP()

The following examples show how to use com.alibaba.dubbo.registry.common.util.Tool#getIP() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Routes.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
 * 路由模块首页
 * @param context
 */
public void index(Map<String, Object> context) {
    String service = (String) context.get("service");
    String address = (String) context.get("address");
    address = Tool.getIP(address);
    List<Route> routes;
    if (service != null && service.length() > 0
    		&& address != null && address.length() > 0) {
        routes = routeService.findByServiceAndAddress(service, address);
    } else if (service != null && service.length() > 0) {
        routes = routeService.findByService(service);
    } else if (address != null && address.length() > 0) {
        routes = routeService.findByAddress(address);
    } else {
        routes = routeService.findAll();
    }
    context.put("routes", routes);
}
 
Example 2
Source File: Routes.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
/**
 * 路由模块首页
 * @param context
 */
public void index(Map<String, Object> context) {
    String service = (String) context.get("service");
    String address = (String) context.get("address");
    address = Tool.getIP(address);
    List<Route> routes;
    if (service != null && service.length() > 0
    		&& address != null && address.length() > 0) {
        routes = routeService.findByServiceAndAddress(service, address);
    } else if (service != null && service.length() > 0) {
        routes = routeService.findByService(service);
    } else if (address != null && address.length() > 0) {
        routes = routeService.findByAddress(address);
    } else {
        routes = routeService.findAll();
    }
    context.put("routes", routes);
}
 
Example 3
Source File: Routes.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
/**
 * 路由模块首页
 * @param context
 */
public void index(Map<String, Object> context) {
    String service = (String) context.get("service");
    String address = (String) context.get("address");
    address = Tool.getIP(address);
    List<Route> routes;
    if (service != null && service.length() > 0
    		&& address != null && address.length() > 0) {
        routes = routeService.findByServiceAndAddress(service, address);
    } else if (service != null && service.length() > 0) {
        routes = routeService.findByService(service);
    } else if (address != null && address.length() > 0) {
        routes = routeService.findByAddress(address);
    } else {
        routes = routeService.findAll();
    }
    context.put("routes", routes);
}
 
Example 4
Source File: Routes.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
 * 路由模块首页
 * @param context
 */
public void index(Map<String, Object> context) {
    String service = (String) context.get("service");
    String address = (String) context.get("address");
    address = Tool.getIP(address);
    List<Route> routes;
    if (service != null && service.length() > 0
    		&& address != null && address.length() > 0) {
        routes = routeService.findByServiceAndAddress(service, address);
    } else if (service != null && service.length() > 0) {
        routes = routeService.findByService(service);
    } else if (address != null && address.length() > 0) {
        routes = routeService.findByAddress(address);
    } else {
        routes = routeService.findAll();
    }
    context.put("routes", routes);
}
 
Example 5
Source File: Routes.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
 * 路由模块首页
 * @param context
 */
public void index(Map<String, Object> context) {
    String service = (String) context.get("service");
    String address = (String) context.get("address");
    address = Tool.getIP(address);
    List<Route> routes;
    if (service != null && service.length() > 0
    		&& address != null && address.length() > 0) {
        routes = routeService.findByServiceAndAddress(service, address);
    } else if (service != null && service.length() > 0) {
        routes = routeService.findByService(service);
    } else if (address != null && address.length() > 0) {
        routes = routeService.findByAddress(address);
    } else {
        routes = routeService.findAll();
    }
    context.put("routes", routes);
}
 
Example 6
Source File: Weights.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void index(Map<String, Object> context) {
    final String service = StringUtils.trimToNull((String) context.get("service"));
    String address = (String) context.get("address");
    address = Tool.getIP(address);
    List<Weight> weights;
    if (service != null && service.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByService(service));
    } else if (address != null && address.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByAddress(address));
    } else {
        weights = OverrideUtils.overridesToWeights(overrideService.findAll());
    }
    context.put("weights", weights);
}
 
Example 7
Source File: Weights.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public void index(Map<String, Object> context) {
    final String service = StringUtils.trimToNull((String) context.get("service"));
    String address = (String) context.get("address");
    address = Tool.getIP(address);
    List<Weight> weights;
    if (service != null && service.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByService(service));
    } else if (address != null && address.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByAddress(address));
    } else {
        weights = OverrideUtils.overridesToWeights(overrideService.findAll());
    }
    context.put("weights", weights);
}
 
Example 8
Source File: Weights.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
public void index(Map<String, Object> context) {
    final String service = StringUtils.trimToNull((String) context.get("service"));
    String address = (String) context.get("address");
    address = Tool.getIP(address);
    List<Weight> weights;
    if (service != null && service.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByService(service));
    } else if (address != null && address.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByAddress(address));
    } else {
        weights = OverrideUtils.overridesToWeights(overrideService.findAll());
    }
    context.put("weights", weights);
}
 
Example 9
Source File: Weights.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void index(Map<String, Object> context) {
    final String service = StringUtils.trimToNull((String) context.get("service"));
    String address = (String) context.get("address");
    address = Tool.getIP(address);
    List<Weight> weights;
    if (service != null && service.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByService(service));
    } else if (address != null && address.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByAddress(address));
    } else {
        weights = OverrideUtils.overridesToWeights(overrideService.findAll());
    }
    context.put("weights", weights);
}
 
Example 10
Source File: Weights.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void index(Map<String, Object> context) {
    final String service = StringUtils.trimToNull((String) context.get("service"));
    String address = (String) context.get("address");
    address = Tool.getIP(address);
    List<Weight> weights;
    if (service != null && service.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByService(service));
    } else if (address != null && address.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByAddress(address));
    } else {
        weights = OverrideUtils.overridesToWeights(overrideService.findAll());
    }
    context.put("weights", weights);
}