- // 检索WebContent中的图片和附件
 - Document doc = Jsoup.parse(info.getWebc().getWebContent());
 - // 当前页中的图片
 - Elements srcLinks = doc.select("img[src]");
 - String imagesPath = "";
 - for (Element link : srcLinks) {
 - // 剔除标签,只剩链接路径
 - String imagesPaths = link.attr("src");
 - String ht = imagesPaths.substring(0, 4);
 - String htt = imagesPaths.substring(0, 1);
 - if (!ht.equals("http") && htt.equals("/")) {
 - imagesPath = imagesPaths.trim().replaceAll(ContextPath, "");
 - imagesPath = imagesPath.substring(imagesPath.lastIndexOf("/") + 1);
 - } else {
 - imagesPath = "";
 - }
 - //System.out.println("---导入WebContent中的图片---" + imagesPath);
 - if (!imagesPath.equals("")) {
 - importCopy("/html/"+strSiteID+"/"+strColumnID+"/"+keyID+"/"+imagesPath, path, strInfoID,"/html/"+strSiteID+"/"+strColumnID+"/"+keyID+"/");
 - }
 - }
 - // 提取所有的href连接
 - String filePaths = "";
 - Elements linehrefs = doc.select("a[href]");
 - for (Element link : linehrefs) {
 - filePaths = link.attr("href").trim().replaceAll(ContextPath, "");
 - filePaths = filePaths.substring(filePaths.lastIndexOf("/") + 1);
 - //System.out.println("---导入WebContent中的文件---" + filePaths);
 - if (!filePaths.equals("")) {
 - importCopy("/html/"+strSiteID+"/"+strColumnID+"/"+keyID+"/"+filePaths, path, strInfoID,"/html/"+strSiteID+"/"+strColumnID+"/"+keyID+"/");
 - }
 - }
 
【本文是专栏作者张勇波的原创文章,转载请通过获取作者授权】

创新互联-专业网站定制、快速模板网站建设、高性价比洮北网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式洮北网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖洮北地区。费用合理售后完善,10年实体公司更值得信赖。
                新闻标题:Jsuop进行链接提取
                
                URL分享:http://www.csdahua.cn/qtweb/news29/213279.html
            
网站建设、网络推广公司-快上网,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 快上网