English 中文(简体)
HttpClient WARNING: Cookie 反对: 非法领域归属
原标题:HttpClient WARNING: Cookie rejected: Illegal domain attribute

I m using HttpClient latest version (4.x). And right now I m trying to do A GET Request. I just posting a Get request.

This is my Code;

public class Poster {

    static boolean routing1 = true, routing2 = true;
    static int counter1 = 0, counter2 = 0;
    DefaultHttpClient oHtp = null;
    HttpGet oHGet = null;
    HttpResponse oHRes = null;


    private void test(String fullAddress) throws Exception {
        oHtp = new DefaultHttpClient();
        oHGet = new HttpGet(fullAddress);

        HttpResponse response = oHtp.execute(oHGet);
        System.out.print(response.getStatusLine());

        HttpEntity entity = response.getEntity();
        if (entity != null) {
            entity = new BufferedHttpEntity(entity);
            //  System.out.println(EntityUtils.toString(entity));
            System.out.print("	 entity is retrieved... ");
        }


        oHtp.getConnectionManager().shutdown();
    }
}

I just execute it nicely. First is

new Poster().test("http://123.xl.co.id/profile.php");

and second is

 new Poster().test("http://goklik.co.id/");

页: 1 我拿这个错误信息。

Sep 18, 2011 10:11:30 AM org.apache.http.client.protocol.ResponseProcessCookies processCookies WARNING: Cookie rejected: "[version: 0][name: CookiePst][value: 0149=xwGHF7HYDHLHQ84Isp/eSy9vu+Xq6cT12wxg1A==][domain: .mcore.com][path: /][expiry: Sun Sep 18 10:38:59 ICT 2011]". Illegal domain attribute "mcore.com". Domain of origin: "goklik.co.id"

我认识到,库克群岛参加了这次会议。 但我不理解警告意味着什么。 我也不知道如何解决该问题(Cookie没有被拒绝)。 希望能从你的角度来表达我的想法。

最佳回答

你们可以“固定”。 该网站正试图安装一个无法安装的厨师,而你使用的海滩客户图书馆正在告诉你。

它试图为<代码>m分.com建立一个 co。 域名goklik.co.id

问题回答

>,同一页的回答

4.3. 持久性有机污染物似乎已发生许多变化,其编码将发挥作用:

RequestConfig customizedRequestConfig = RequestConfig.custom().setCookieSpec(CookieSpecs.BROWSER_COMPATIBILITY).build();
HttpClientBuilder customizedClientBuilder = HttpClients.custom().setDefaultRequestConfig(customizedRequestConfig);
CloseableHttpClient client = customizedClientBuilder.build(); // customized client,

我正在使用http://user4.5.2,这为容易解决我的问题树立了 co。 客户如何即时:

httpClient = HttpClients.custom()
                .setDefaultRequestConfig(RequestConfig.custom()
                        // Waiting for a connection from connection manager
                        .setConnectionRequestTimeout(10000)
                        // Waiting for connection to establish
                        .setConnectTimeout(5000)
                        .setExpectContinueEnabled(false)
                        // Waiting for data
                        .setSocketTimeout(5000)
                        .setCookieSpec("easy")
                        .build())
                .setMaxConnPerRoute(20)
                .setMaxConnTotal(100)
                .build();

下面是最简单的方式,可在v4.5.x(4.5.6 右边现在):

HttpClientBuilder clientBuilder = HttpClientBuilder.create();
clientBuilder.disableCookieManagement();
HttpClient httpClient = clientBuilder.build();

只是想改进埃丽卡的回答,因为它直接解决了我的情况,但将库克群岛的奇迹改变为签字人。 科纳克民委解决了我的问题。

RequestConfig customizedRequestConfig = RequestConfig.custom().setCookieSpec(CookieSpecs.IGNORE_COOKIES).build();
HttpClientBuilder customizedClientBuilder = 
HttpClients.custom().setDefaultRequestConfig(customizedRequestConfig);
CloseableHttpClient client = customizedClientBuilder.build(); // customized client,

由于在我版本的HttpClient 4.5 CookieSpecs.BROWSER_COMPATIBILITY已经折旧。

如果你不需要处理 co,那么,可以简单地加以区别,具体依据是:org.apache. http.impl.cookie.IgnoreSpecProviderorg.apache. http.impl.cookie.IgnoreSpec,视您使用何种亚普森特。 <disableCookieManagement (> on HttpClientBuilder是不够的。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签