Jersey Client 过来 ROBOTS 响应

Jersey Client to over come ROBOTS response

我正在使用以下代码从服务器获取响应。当我使用 POSTMAN 时,它给出了不同的明确响应,当我使用 jersey 客户端使用 java 代码时,它会给出机器人响应,假设我的请求是恶意的。我正在使用 jersey 1.9 版本。

提问:如何克服这个机器人

 ObjectMapper mapper = new ObjectMapper();Client CLIENT = Client.create();
    CLIENT.addFilter(new LoggingFilter(System.out));
    WebResource webResource = null;
    webResource = CLIENT.resource(url);
    ClientResponse response = null;
    response = webResource
                                .header("Cache-Control", "no-cache")
                                .header("Cookies", false)
                                .accept(MediaType.APPLICATION_JSON)
                        .get(ClientResponse.class)
                ;

以下是来自 POSTMAN 的 header 信息。 Session 在 POSTMAN 中将 id 设置为 true。

   Accept-Ranges →bytes
    Age →1
    Cache-Control →public, max-age=0, must-revalidate, no-transform
    Content-Encoding →gzip
    Content-Length →5533
    Content-Security-Policy →default-src 'self' https://www.xxxx.xxxx https://*.cwp.xxxx.xxxx 
    Content-Type →application/json
    Content-language →en-US
    Pragma →no-cache
    Server →ngccc
    Set-Cookie →SECSESSID=2aprjner5fomn8vrk4sfhbn464; expires=Tue, 23-Jan-2018 18:35:09 GMT; Max-Age=3600; path=/; secure; HttpOnly
    Set-Cookie →SECSESSID=2aprjner5fomn8vrk4sfhbn464; expires=Tue, 23-Jan-2018 18:35:09 GMT; Max-Age=3600; path=/; secure; httponly
    Set-Cookie →SECSESSID_2=asdasdasdxxsdsdxx; expires=Tue, 23-Jan-2018 17:59:09 GMT; Max-Age=1440; path=/; secure; httponly
    Set-Cookie →incap_ses_899_110069=+lYvxV259l1WSI2o+LzxVsA==; path=/; Domain=.www.xxxx.xxxx
    Strict-Transport-Security →max-age=31536000
    Vary →Accept-Encoding
    Via →1.1 varnish-v4, HTTPS/1.1 localhost.localdomain
    X-CDN →Incapsula
    X-Content-Type-Options →nosniff
    X-Frame-Options →SAMEORIGIN
    X-UA-Compatible →IE=edge
    X-Varnish →436830982
    X-XSS-Protection →1; mode=block

以下是代码的响应:

<html>
<head>
<META NAME="robots" CONTENT="noindex,nofollow">
<script src="/_Incapsula_Resource?SWJIYLWA=2977">
</script>
<script>
(function() { 
var z="";var b="7472797B766172207868723B7661";for (var i=0;i<b.length;i+=2){z=z+parseInt(b.substring(i, i+2), 16)+",";}z = z.substring(0,z.length-1); eval(eval('String.fromCharCode('+z+')'));})();
</script></head>
<body>
<iframe style="display:none;visibility:hidden;" 
</body></html>

以下是 POSTMAN 的回复:

{
    "query": {
        "offset": 0,
        "count": 20,
        "total": 379
    }
}

通过在其中添加与 SSL 连接相关的代码来解决此问题。因此它识别并验证了此请求并以有效响应响应。