当前位置: 首页>>代码示例>>Java>>正文


Java StringUtils.isNotEmpty方法代码示例

本文整理汇总了Java中com.alibaba.dubbo.common.utils.StringUtils.isNotEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.isNotEmpty方法的具体用法?Java StringUtils.isNotEmpty怎么用?Java StringUtils.isNotEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.dubbo.common.utils.StringUtils的用法示例。


在下文中一共展示了StringUtils.isNotEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: search

import com.alibaba.dubbo.common.utils.StringUtils; //导入方法依赖的package包/类
public void search(Map<String, Object> context) {
    index(context);
    
    Set<String> newList = new HashSet<String>();
    @SuppressWarnings("unchecked")
    Set<String> apps = (Set<String>)context.get("applications");
    String keyword = (String) context.get("keyword");
    if(StringUtils.isNotEmpty(keyword)){
        keyword = keyword.toLowerCase();
        for(String o : apps){
            if(o.toLowerCase().indexOf(keyword)!=-1){
                newList.add(o);
            }
        }
    }
    context.put("applications", newList);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:18,代码来源:Applications.java

示例2: search

import com.alibaba.dubbo.common.utils.StringUtils; //导入方法依赖的package包/类
public void search(Map<String, Object> context) {
    index(context);
    
    Set<String> newList = new HashSet<String>();
    @SuppressWarnings("unchecked")
    Set<String> list = (Set<String>)context.get("addresses");
    String keyword = (String) context.get("keyword");
    if(StringUtils.isNotEmpty(keyword)){
        keyword = keyword.toLowerCase();
        for(String o : list){
            if(o.toLowerCase().indexOf(keyword)!=-1){
                newList.add(o);
            }
        }
    }
    context.put("addresses", newList);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:18,代码来源:Addresses.java

示例3: index

import com.alibaba.dubbo.common.utils.StringUtils; //导入方法依赖的package包/类
public void index(Map<String, Object> context) {
    String service = (String) context.get("service");
    String application = (String) context.get("application");
    String address = (String) context.get("address");
    List<Override> overrides;
    if (StringUtils.isNotEmpty(service)) {
        overrides = overrideService.findByService(service);
    } else if(StringUtils.isNotEmpty(application)){
        overrides = overrideService.findByApplication(application);
    }else if(StringUtils.isNotEmpty(address)){
        overrides = overrideService.findByAddress(address);
    }
    else{
        overrides = overrideService.findAll();
    }
    context.put("overrides", overrides);
}
 
开发者ID:flychao88,项目名称:dubbocloud,代码行数:18,代码来源:Overrides.java

示例4: add

import com.alibaba.dubbo.common.utils.StringUtils; //导入方法依赖的package包/类
public void add(Map<String, Object> context){
    List<String> serviceList = new ArrayList<String>();
    List<String> applicationList = new ArrayList<String>();
    String service = (String) context.get("service");
    String application = (String) context.get("application");
    if(StringUtils.isNotEmpty(application)){
        serviceList.addAll(providerService.findServicesByApplication(application));
        serviceList.addAll(consumerService.findServicesByApplication(application));
        context.put("serviceList", serviceList);
    }else if(StringUtils.isNotEmpty(service)){
        applicationList.addAll(providerService.findApplicationsByServiceName(service));
        applicationList.addAll(consumerService.findApplicationsByServiceName(service));
        context.put("applicationList", applicationList);
    }else{
        serviceList.addAll(providerService.findServices());
        serviceList.addAll(consumerService.findServices());
        providerService.findServicesByApplication(application);
        consumerService.findServicesByApplication(application);
    }
    context.put("serviceList", serviceList);
    
    if (StringUtils.isNotEmpty(service) && !service.contains("*")) {
        context.put("methods", CollectionUtils.sort(new ArrayList<String>(providerService.findMethodsByService(service))));
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:26,代码来源:Overrides.java

示例5: globalDataTranster

import com.alibaba.dubbo.common.utils.StringUtils; //导入方法依赖的package包/类
private void globalDataTranster(HttpServletRequest request) {
    String traceIdValue = request.getHeader("traceId");
    String spanIdValue = request.getHeader("spanId");

    Map<String, String> globalMap = CallChainContext.getContext().get();
    if(globalMap == null){
    	globalMap = new ConcurrentHashMap<String, String>();
    }

    if(StringUtils.isNotEmpty(traceIdValue) && StringUtils.isNotEmpty(spanIdValue)){
        globalMap.put(CallChainContext.TRACEID, traceIdValue);
        globalMap.put(CallChainContext.SPANID, spanIdValue);
        globalMap.put(CallChainContext.CURRENTID, spanIdValue);
        CallChainContext.getContext().add(globalMap);
    }

}
 
开发者ID:flychao88,项目名称:dubbocloud,代码行数:18,代码来源:HessianProtocol.java

示例6: exeMockExceptionThrow

import com.alibaba.dubbo.common.utils.StringUtils; //导入方法依赖的package包/类
/**
 * 模拟异常抛出
 */
private void exeMockExceptionThrow(MockTestConfig mockTestConfig) {
    String exceptionPath = mockTestConfig.getExceptionClass();
    String exceptionMsg = mockTestConfig.getExceptionJson();

    if (StringUtils.isNotEmpty(exceptionPath)) {
        try {
            if (StringUtils.isEmpty(exceptionMsg)) {
                exceptionMsg = "Mock模拟Exception抛出 exceptionPath:" + exceptionPath;
            }
            Class exceptionClass = Class.forName(exceptionPath);
            Exception exceptionObj = (Exception) exceptionClass.newInstance();
            throw exceptionObj;
        } catch (ClassNotFoundException cnfe) {
            log.error( "异常类全路径没有找到 exceptionPath:" + exceptionPath);

        } catch (Exception e) {
            RpcException rpcException = new RpcException(exceptionMsg, e);
            rpcException.setStackTrace(e.getStackTrace());
            throw rpcException;
        }
    }
}
 
开发者ID:flychao88,项目名称:dubbocloud,代码行数:26,代码来源:MockTestFilter.java

示例7: search

import com.alibaba.dubbo.common.utils.StringUtils; //导入方法依赖的package包/类
public void search(Map<String, Object> context) {
    index(context);

    Set<String> newList = new HashSet<String>();
    @SuppressWarnings("unchecked")
    Set<String> apps = (Set<String>) context.get("applications");
    String keyword = (String) context.get("keyword");
    if (StringUtils.isNotEmpty(keyword)) {
        keyword = keyword.toLowerCase();
        for (String o : apps) {
            if (o.toLowerCase().indexOf(keyword) != -1) {
                newList.add(o);
            }
        }
    }
    context.put("applications", newList);
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:18,代码来源:Applications.java

示例8: search

import com.alibaba.dubbo.common.utils.StringUtils; //导入方法依赖的package包/类
public void search(Map<String, Object> context) {
    index(context);

    Set<String> newList = new HashSet<String>();
    @SuppressWarnings("unchecked")
    Set<String> list = (Set<String>) context.get("addresses");
    String keyword = (String) context.get("keyword");
    if (StringUtils.isNotEmpty(keyword)) {
        keyword = keyword.toLowerCase();
        for (String o : list) {
            if (o.toLowerCase().indexOf(keyword) != -1) {
                newList.add(o);
            }
        }
    }
    context.put("addresses", newList);
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:18,代码来源:Addresses.java

示例9: index

import com.alibaba.dubbo.common.utils.StringUtils; //导入方法依赖的package包/类
public void index(Map<String, Object> context) {
    String service = (String) context.get("service");
    String application = (String) context.get("application");
    String address = (String) context.get("address");
    List<Override> overrides;
    if (StringUtils.isNotEmpty(service)) {
        overrides = overrideService.findByService(service);
    } else if (StringUtils.isNotEmpty(application)) {
        overrides = overrideService.findByApplication(application);
    } else if (StringUtils.isNotEmpty(address)) {
        overrides = overrideService.findByAddress(address);
    } else {
        overrides = overrideService.findAll();
    }
    context.put("overrides", overrides);
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:17,代码来源:Overrides.java

示例10: add

import com.alibaba.dubbo.common.utils.StringUtils; //导入方法依赖的package包/类
public void add(Map<String, Object> context) {
    List<String> serviceList = new ArrayList<String>();
    List<String> applicationList = new ArrayList<String>();
    String service = (String) context.get("service");
    String application = (String) context.get("application");
    if (StringUtils.isNotEmpty(application)) {
        serviceList.addAll(providerService.findServicesByApplication(application));
        serviceList.addAll(consumerService.findServicesByApplication(application));
        context.put("serviceList", serviceList);
    } else if (StringUtils.isNotEmpty(service)) {
        applicationList.addAll(providerService.findApplicationsByServiceName(service));
        applicationList.addAll(consumerService.findApplicationsByServiceName(service));
        context.put("applicationList", applicationList);
    } else {
        serviceList.addAll(providerService.findServices());
        serviceList.addAll(consumerService.findServices());
        providerService.findServicesByApplication(application);
        consumerService.findServicesByApplication(application);
    }
    context.put("serviceList", serviceList);

    if (StringUtils.isNotEmpty(service) && !service.contains("*")) {
        context.put("methods", CollectionUtils.sort(new ArrayList<String>(providerService.findMethodsByService(service))));
    }
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:26,代码来源:Overrides.java

示例11: testDubboProtocolPortOverride

import com.alibaba.dubbo.common.utils.StringUtils; //导入方法依赖的package包/类
@Test
public void testDubboProtocolPortOverride() throws Exception {
    String dubboPort = System.getProperty("dubbo.protocol.dubbo.port");
    int port = 55555;
    System.setProperty("dubbo.protocol.dubbo.port", String.valueOf(port));
    ServiceConfig<DemoService> service = null;
    try {
        ApplicationConfig application = new ApplicationConfig();
        application.setName("dubbo-protocol-port-override");

        RegistryConfig registry = new RegistryConfig();
        registry.setAddress("N/A");

        ProtocolConfig protocol = new ProtocolConfig();

        service = new ServiceConfig<DemoService>();
        service.setInterface(DemoService.class);
        service.setRef(new DemoServiceImpl());
        service.setApplication(application);
        service.setRegistry(registry);
        service.setProtocol(protocol);
        service.export();

        Assert.assertEquals(port, service.getExportedUrls().get(0).getPort());
    } finally {
        if (StringUtils.isNotEmpty(dubboPort)) {
            System.setProperty("dubbo.protocol.dubbo.port", dubboPort);
        }
        if (service != null) {
            service.unexport();
        }
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:34,代码来源:ConfigTest.java

示例12: invoke

import com.alibaba.dubbo.common.utils.StringUtils; //导入方法依赖的package包/类
public void invoke(PipelineContext pipelineContext) throws Exception {
      if (logger.isInfoEnabled()) {
          logger.info("AuthorizationValve of uri: " + request.getRequestURI());
      }
      String uri = request.getRequestURI();
String contextPath = request.getContextPath();
if (contextPath != null && contextPath.length() > 0  && ! "/".equals(contextPath)) {
    uri = uri.substring(contextPath.length());
}
      if (uri.equals(logout)) {
    if (! isLogout()) {
        setLogout(true);
  		    showLoginForm();
    } else {
        setLogout(false);
        response.sendRedirect(contextPath == null || contextPath.length() == 0 ? "/" : contextPath);
    }
          return;
}
      //FIXME
      if(! uri.startsWith("/status/")){
      	User user = null;
          String authType = null;
          String authorization = request.getHeader("Authorization");
          if (authorization != null && authorization.length() > 0) {
              int i = authorization.indexOf(' ');
              if (i >= 0) {
                  authType = authorization.substring(0, i);
                  String authPrincipal = authorization.substring(i + 1);
                  if (BASIC_CHALLENGE.equalsIgnoreCase(authType)) {
                      user = loginByBase(authPrincipal);
                  } else if (DIGEST_CHALLENGE.equalsIgnoreCase(authType)) {
                      user = loginByDigest(authPrincipal);
                  }
              }
          }
          if (user == null || user.getUsername() == null || user.getUsername().length() == 0) {
              showLoginForm();
              pipelineContext.breakPipeline(1);
          }
          if (user != null && StringUtils.isNotEmpty(user.getUsername())) {
              request.getSession().setAttribute(WebConstants.CURRENT_USER_KEY, user);
              pipelineContext.invokeNext();
          }
      }else{
          pipelineContext.invokeNext();
      }
  }
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:49,代码来源:AuthorizationValve.java

示例13: setRequestvolume

import com.alibaba.dubbo.common.utils.StringUtils; //导入方法依赖的package包/类
public void setRequestvolume(String requestvolume) {
    if(StringUtils.isNotEmpty(requestvolume)) {
        this.requestvolume = requestvolume;
    }
}
 
开发者ID:flychao88,项目名称:dubbocloud,代码行数:6,代码来源:HystrixConfig.java

示例14: setThresholdswitch

import com.alibaba.dubbo.common.utils.StringUtils; //导入方法依赖的package包/类
public void setThresholdswitch(String thresholdswitch) {
    if(StringUtils.isNotEmpty(thresholdswitch)) {
        this.thresholdswitch = thresholdswitch;
    }
}
 
开发者ID:flychao88,项目名称:dubbocloud,代码行数:6,代码来源:HystrixConfig.java

示例15: invoke

import com.alibaba.dubbo.common.utils.StringUtils; //导入方法依赖的package包/类
public void invoke(PipelineContext pipelineContext) throws Exception {
    if (logger.isInfoEnabled()) {
        logger.info("AuthorizationValve of uri: " + request.getRequestURI());
    }
    String uri = request.getRequestURI();
    String contextPath = request.getContextPath();
    if (contextPath != null && contextPath.length() > 0 && !"/".equals(contextPath)) {
        uri = uri.substring(contextPath.length());
    }
    if (uri.equals(logout)) {
        if (!isLogout()) {
            setLogout(true);
            showLoginForm();
        } else {
            setLogout(false);
            response.sendRedirect(contextPath == null || contextPath.length() == 0 ? "/" : contextPath);
        }
        return;
    }
    //FIXME
    if (!uri.startsWith("/status/")) {
        User user = null;
        String authType = null;
        String authorization = request.getHeader("Authorization");
        if (authorization != null && authorization.length() > 0) {
            int i = authorization.indexOf(' ');
            if (i >= 0) {
                authType = authorization.substring(0, i);
                String authPrincipal = authorization.substring(i + 1);
                if (BASIC_CHALLENGE.equalsIgnoreCase(authType)) {
                    user = loginByBase(authPrincipal);
                } else if (DIGEST_CHALLENGE.equalsIgnoreCase(authType)) {
                    user = loginByDigest(authPrincipal);
                }
            }
        }
        if (user == null || user.getUsername() == null || user.getUsername().length() == 0) {
            showLoginForm();
            pipelineContext.breakPipeline(1);
        }
        if (user != null && StringUtils.isNotEmpty(user.getUsername())) {
            request.getSession().setAttribute(WebConstants.CURRENT_USER_KEY, user);
            pipelineContext.invokeNext();
        }
    } else {
        pipelineContext.invokeNext();
    }
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:49,代码来源:AuthorizationValve.java


注:本文中的com.alibaba.dubbo.common.utils.StringUtils.isNotEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。