• 大小: 50KB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-06-17
  • 语言: Java
  • 标签: java  

资源简介

文档指纹Java实现文档指纹Java实现文档指纹Java实现文档指纹Java实现

资源截图

代码片段和文件信息

package datapark;

import com.sun.net.httpserver.HttpServer;
import datapark.SimHashSample3.DuplicateJudge;
import datapark.SimHashSample3.DuplicateRemoversFactory;
import datapark.test.SimHasher;
import datapark.utils.PropertiesUtil;
import net.sf.json.JSONobject;
import org.apache.log4j.Logger;
import org.glassfish.jersey.jdkhttp.JdkHttpServerFactory;
import org.glassfish.jersey.server.ResourceConfig;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.net.URI;
import java.util.Map;


/**
 * Created by datapark-2 on 2015/11/25.
 */
@Path(“/duplicateJudge“)
public class SimhashServer {


    public static final Logger log = Logger.getLogger(SimhashServer.class.getName());
    private static Map configProperties = PropertiesUtil.getPropertyMap();

    @Path(“charts“)
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String processDatas() {//��������

        String s = “{\n“ +
                “\t\n“ +
                “\t\“kpivalue\“:\“all\“\n“ +
                “\t\“starttime\“:\“2015-01-01\“\n“ +
                “\t\“charttype\“:\“line\“\n“ +
                “\t\“metricunit\“:\“month\“\n“ +
                “\t\“endtime\“:\“2015-06-30\“\n“ +
                “\t\“size\“:10\n“ +
                “\t\“term\“:\“material\“\n“ +
                “\t\“category\“:\“women\“\n“ +
                “\t\“options\“:[{\“brand_alias\“:\“大众品牌\“\“src_name\“:\“京东\“}]\n“ +
                “}“;
        log.info(“test-processDatas“);
        return s;
    }
    @POST
    @Path(“simhash“)
    @Produces({“application/json;charset=utf-8“})
    public String getMsg(String requestStr) {
        long start = System.currentTimeMillis();
        String responseStr = ““;
        JSONobject requestStrObj = JSONobject.fromString(requestStr);
        String func = (String)requestStrObj.get(“func“);
        JSONobject requestDataObj = (JSONobject)requestStrObj.get(“requestData“);
        DuplicateJudge simHashJudge = DuplicateRemoversFactory.factory(func);
        responseStr = simHashJudge.duplicate(requestDataObj);
        log.info(“func url is : “+requestDataObj.get(“url“) + “ all time is “ +(System.currentTimeMillis() -start));
        return responseStr;
    }

    public static void main(String[] args) throws Exception {

        ResourceConfig rc = new ResourceConfig(SimhashServer.class);
        try {
            URI serveruri = new URI(“http://localhost:8080/“);//192.168.31.111 192.168.31.176
            HttpServer server = JdkHttpServerFactory.createHttpServer(serveruri rc);
            System.out.println(“start“);
            //HttpServer server = HttpServerFactory.create(“http://192.168.31.177:8080/“);
//            server.start();
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-01-03 07:54  simhash-master\
     文件          55  2017-01-03 07:54  simhash-master\.gitignore
     目录           0  2017-01-03 07:54  simhash-master\ConfigFiles\
     文件          18  2017-01-03 07:54  simhash-master\ConfigFiles\config.properties
     文件       11357  2017-01-03 07:54  simhash-master\LICENSE
     文件         154  2017-01-03 07:54  simhash-master\README.md
     文件        4747  2017-01-03 07:54  simhash-master\SIMHASHServer.iml
     文件        2343  2017-01-03 07:54  simhash-master\pom.xml
     目录           0  2017-01-03 07:54  simhash-master\src\
     目录           0  2017-01-03 07:54  simhash-master\src\main\
     目录           0  2017-01-03 07:54  simhash-master\src\main\datapark\
     目录           0  2017-01-03 07:54  simhash-master\src\main\datapark\SimHashSample3\
     文件         247  2017-01-03 07:54  simhash-master\src\main\datapark\SimHashSample3\DuplicateJudge.java
     文件         640  2017-01-03 07:54  simhash-master\src\main\datapark\SimHashSample3\DuplicateRemoversFactory.java
     文件       68797  2017-01-03 07:54  simhash-master\src\main\datapark\SimHashSample3\SimHashJudge.java
     文件        2800  2017-01-03 07:54  simhash-master\src\main\datapark\SimhashServer.java
     目录           0  2017-01-03 07:54  simhash-master\src\main\datapark\apiapplication\
     文件         320  2017-01-03 07:54  simhash-master\src\main\datapark\apiapplication\Application.java
     目录           0  2017-01-03 07:54  simhash-master\src\main\datapark\test\
     文件         391  2017-01-03 07:54  simhash-master\src\main\datapark\test\CallerClassA.java
     文件        1437  2017-01-03 07:54  simhash-master\src\main\datapark\test\ClassloaderUtil.java
     文件        1674  2017-01-03 07:54  simhash-master\src\main\datapark\test\FNVHash.java
     文件         632  2017-01-03 07:54  simhash-master\src\main\datapark\test\NoClassDefFoundErrorSimulator.java
     文件         597  2017-01-03 07:54  simhash-master\src\main\datapark\test\ReferencingClassA.java
     文件        3976  2017-01-03 07:54  simhash-master\src\main\datapark\test\SimHasher.java
     文件        1086  2017-01-03 07:54  simhash-master\src\main\datapark\test\Testa.java
     目录           0  2017-01-03 07:54  simhash-master\src\main\datapark\utils\
     文件        3359  2017-01-03 07:54  simhash-master\src\main\datapark\utils\HashUtils.java
     文件        1057  2017-01-03 07:54  simhash-master\src\main\datapark\utils\PropertiesUtil.java
     文件        1458  2017-01-03 07:54  simhash-master\src\main\datapark\utils\RedisUtils.java
     目录           0  2017-01-03 07:54  simhash-master\src\main\resources\
............此处省略1个文件信息

评论

共有 条评论