zoukankan      html  css  js  c++  java
  • 废弃的java 爬虫代码

        protected static String getVersion(String filepath)
        {
            Properties system;
            String version="";
            try {
                system = PropertiesLoaderUtils.loadProperties(new ClassPathResource(filepath));
                version=StringUtils.toString(system.getProperty("crawlNode.version"));
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                logger.debug(e.toString());
            }
            return version;
        }
        protected static String buildCrawlParams() {
            // TODO Auto-generated method stub
            String result="";
            LinkedHashMap<String, String> params=new LinkedHashMap<String, String>();
            InetAddress inet;
            try {
                inet = InetAddress.getLocalHost();
                String ip=StringUtils.toString(inet.getHostAddress());
                params.put("ip", ip);
               
                String hostname=inet.getHostName();
                params.put("hostname", hostname);
               
                logger.debug("ip:{}",ip);
                logger.debug("hostname:{}",hostname);
                logger.debug("version:{}",getVersion("conf/system.properties"));
                ObjectMapper mapper=new ObjectMapper();
                result=mapper.writeValueAsString(params);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                logger.warn("获取抓取机环境参数出现错误");
            }
            logger.info("final crawlParams:{}",result);
            return result;

        }

  • 相关阅读:
    eclipse编码格式设置教程、如何为eclipse设置编码格式?
    Eclipse中使用SVN
    个人mysql配置命令
    MySQL新建用户,授权,删除用户,修改密码等命令
    MySQL修改root密码的多种方法
    MySQL 5.6 for Windows 解压缩版配置安装
    在windows下安装mysql5.6.24版本
    CS231n assignment2 Q3 Dropout
    CS231n assignment2 Q1 Fully-connected Neural Network
    CS231n assignment2 Q2 Batch Normalization
  • 原文地址:https://www.cnblogs.com/lexus/p/2407323.html
Copyright © 2011-2022 走看看