HTTP / 1.1 500内部服务器错误获取网页工作时的Java

时间:2015-11-25 08:42:56

标签: java xmlhttprequest httpclient httpresponse

enter image description here我想与

合作
HttpResponse httpResponse = httpClient.execute(method, context);

并收到此错误

HttpResponseProxy{HTTP/1.1 500 Internal Server Error [Date: Mon, 23 Nov 2015 08:30:11 GMT, 
Server: Apache/2.2.20 (Ubuntu), X-Powered-By: PHP/5.3.6-13ubuntu3.8, Set-Cookie: 
PHPSESSID=gtr71sg82bm9gd9987qeu9gp50; path=/, Expires: Thu, 19 Nov 1981 08:52:00 GMT, 
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, 
pre-check=0, Pragma: no-cache, Keep-Alive: timeout=5, max=100, 
Connection: Keep-Alive, Transfer-Encoding: chunked, Content-Type: application/json; charset=utf-8]}

网页显示为文本网页浏览器并显示有效的Json文本(全部在一行中) 但是在使用(f12)后我也会收到错误500.

我无法检查服务器错误,因为它不是我的。

我搜索了之前的错误,就像我的一样,发现:thisthisthat one以及更多

所有这些都提供更改标题 尝试更改标题 - 但它没有解决我的问题。

我如何知道我需要哪个标题? 我还能尝试修复它吗?

更多细节

Response Headers
view source
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:Keep-Alive
Content-Type:application/json; charset=utf-8
Date:Wed, 25 Nov 2015 09:46:41 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:timeout=5, max=100
Pragma:no-cache
Server:Apache/2.2.20 (Ubuntu)
Transfer-Encoding:chunked
X-Powered-By:PHP/5.3.6-13ubuntu3.8

Request Headers
view source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Cookie:PHPSESSID=gb9n33a3qbnlqfdnn6kretsgr3
Host:cc.avidtrak.com
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36

1 个答案:

答案 0 :(得分:1)

这不是一个真正的答案,因为我无法评论,但您可以尝试开放开发工具(Chrome中的f12)并打开网络标签,请求到网址并查看请求标头(因为您说它适用于浏览器请求) ,并与您从Java提出的请求进行比较