Java Code Examples for org.apache.dubbo.common.utils.StringUtils#isEmpty()

The following examples show how to use org.apache.dubbo.common.utils.StringUtils#isEmpty() . 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: LegacyBlockFilter.java    From dubbo-samples with Apache License 2.0 6 votes vote down vote up
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
    RpcContext context = RpcContext.getContext();
    String filters = (String) context.getAttachment("filters");
    if (StringUtils.isEmpty(filters)) {
        filters = "";
    }
    filters += " legacy-block-filter";
    context.setAttachment("filters", filters);

    Result result = invoker.invoke(invocation);

    logger.info("This is the default return value: " + result.getValue());

    if (result.hasException()) {
        System.out.println("LegacyBlockFilter: This will only happen when the real exception returns: " + result.getException());
        logger.warn("This will only happen when the real exception returns", result.getException());
    }

    logger.info("LegacyBlockFilter: This msg should not be blocked.");
    return result;
}
 
Example 2
Source File: LegacyListenableFilter.java    From dubbo-samples with Apache License 2.0 5 votes vote down vote up
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
    RpcContext context = RpcContext.getContext();
    String filters = (String) context.getAttachment("filters");
    if (StringUtils.isEmpty(filters)) {
        filters = "";
    }
    filters += " legacy-block-filter";
    context.setAttachment("filters", filters);

    return invoker.invoke(invocation);
}
 
Example 3
Source File: AsyncPostprocessFilter.java    From dubbo-samples with Apache License 2.0 5 votes vote down vote up
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
    RpcContext context = RpcContext.getContext();
    String filters = (String) context.getAttachment("filters");
    if (StringUtils.isEmpty(filters)) {
        filters = "";
    }
    filters += " async-post-process-filter";
    context.setAttachment("filters", filters);

    return invoker.invoke(invocation);
}
 
Example 4
Source File: ZKTools.java    From dubbo-samples with Apache License 2.0 4 votes vote down vote up
private static String pathToKey(String path) {
    if (StringUtils.isEmpty(path)) {
        return path;
    }
    return path.replace("/dubbo/config/", "").replaceAll("/", ".");
}
 
Example 5
Source File: ZKTools.java    From dubbo-samples with Apache License 2.0 4 votes vote down vote up
private static String pathToKey(String path) {
    if (StringUtils.isEmpty(path)) {
        return path;
    }
    return path.replace("/dubbo/config/", "").replaceAll("/", ".");
}
 
Example 6
Source File: ZKTools.java    From dubbo-samples with Apache License 2.0 4 votes vote down vote up
private static String pathToKey(String path) {
    if (StringUtils.isEmpty(path)) {
        return path;
    }
    return path.replace("/dubbo/config/", "").replaceAll("/", ".");
}
 
Example 7
Source File: ZKTools.java    From dubbo-samples with Apache License 2.0 4 votes vote down vote up
private static String pathToKey(String path) {
    if (StringUtils.isEmpty(path)) {
        return path;
    }
    return path.replace("/dubbo/config/", "").replaceAll("/", ".");
}
 
Example 8
Source File: ZKTools.java    From dubbo-samples with Apache License 2.0 4 votes vote down vote up
private static String pathToKey(String path) {
    if (StringUtils.isEmpty(path)) {
        return path;
    }
    return path.replace("/dubbo/config/", "").replaceAll("/", ".");
}
 
Example 9
Source File: ZKTools.java    From dubbo-samples with Apache License 2.0 4 votes vote down vote up
private static String pathToKey(String path) {
    if (StringUtils.isEmpty(path)) {
        return path;
    }
    return path.replace("/dubbo/config/", "").replaceAll("/", ".");
}
 
Example 10
Source File: ZKTools.java    From dubbo-samples with Apache License 2.0 4 votes vote down vote up
private static String pathToKey(String path) {
    if (StringUtils.isEmpty(path)) {
        return path;
    }
    return path.replace("/dubbo/config/", "").replaceAll("/", ".");
}
 
Example 11
Source File: RuleUtil.java    From dubbo-samples with Apache License 2.0 4 votes vote down vote up
private static String pathToKey(String path) {
    if (StringUtils.isEmpty(path)) {
        return path;
    }
    return path.replace("/dubbo/config/", "").replaceAll("/", ".");
}