小编Tom*_*sen的帖子

如何在Java中处理419 http响应

我试图解析一个特定的网站,当我的 java 代码调用它时,我得到了 419 的 HTTP 响应代码。我需要解析响应以查找内容,但我陷入了响应代码。

我尝试使用 apache http 客户端(版本 4.5.6)编写一个 Java 程序来调用我需要解析的网站。我得到的http响应代码是419。

try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
    HttpGet httpGet = new HttpGet("http://www.website.com");
    try (CloseableHttpResponse response1 = httpclient.execute(httpGet)) {
        System.out.println(response1.getStatusLine());
        HttpEntity entity1 = response1.getEntity();
        EntityUtils.consume(entity1);
    }
}
Run Code Online (Sandbox Code Playgroud)

它打印出来的结果是这样的:

try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
    HttpGet httpGet = new HttpGet("http://www.website.com");
    try (CloseableHttpResponse response1 = httpclient.execute(httpGet)) {
        System.out.println(response1.getStatusLine());
        HttpEntity entity1 = response1.getEntity();
        EntityUtils.consume(entity1);
    }
}
Run Code Online (Sandbox Code Playgroud)

我期待200

HTTP/1.1 419 status code 419
Run Code Online (Sandbox Code Playgroud)

当我将网站更改为谷歌或其他网站时,我得到了这一点。

java apache-httpclient-4.x

5
推荐指数
1
解决办法
1194
查看次数

java.io.NotSerializableException

我们在群集QA环境中收到以下错误.我们在linux上运行Weblogic 10.3.3.0.

####<Mar 29, 2011 3:59:54 PM CDT> <Error> <Cluster> <app2.qa.server.com> <qa_app2j> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <1301432394933> <BEA-000126> <All session objects should be serializable to replicate. Check the objects in your session. Failed to replicate non-serializable object.
java.rmi.MarshalException: failed to marshal update(Lweblogic.cluster.replication.ROID;ILjava.io.Serializable;Ljava.lang.Object;); nested exception is:
java.io.NotSerializableException: com.tjf.admin.virtualFair.Job$1
at weblogic.rjvm.BasicOutboundRequest.marshalArgs(BasicOutboundRequest.java:92)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:221)
at weblogic.cluster.replication.ReplicationManager_1033_WLStub.update(Unknown Source)
at sun.reflect.GeneratedMethodAccessor15419.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.cluster.replication.SecureReplicationInvocationHandler$ReplicationServicesInvocationAction.run(SecureReplicationInvocationHandler.java:184)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.cluster.replication.SecureReplicationInvocationHandler.invoke(SecureReplicationInvocationHandler.java:154)
at $Proxy98.update(Unknown Source)
at weblogic.cluster.replication.ReplicationManager.updateSecondary(ReplicationManager.java:535)
at weblogic.servlet.internal.session.ReplicatedSessionData.syncSession(ReplicatedSessionData.java:594) …
Run Code Online (Sandbox Code Playgroud)

java weblogic weblogic11g

2
推荐指数
1
解决办法
6973
查看次数