【问题标题】:HTTP/1.1 500 Internal Server Error Get while webpage works JavaHTTP/1.1 500 Internal Server Error Get while web works Java
【发布时间】:2015-11-25 17:51:22
【问题描述】:

我正在努力合作

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

【问题讨论】:

    标签: java xmlhttprequest httpclient httpresponse


    【解决方案1】:

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

    【讨论】:

    • 添加更多关于 chrome 的信息 - 在打开网页后显示有效的 json 内容。但在 chrome 开发工具中 - 我也收到错误 500 (Type Document)
    • 您是否打开了 Devtool 并尝试请求该网页以查看来自网络选项卡的请求标头?
    • 请查看添加的图片
    • 这真的很奇怪。你能在这里发布完整的回复吗?您可以单击网络选项卡中的请求并查看响应和响应标头
    • 会不会是授权?它在您登录时使用 cookie/会话状态,并且通过使用 httpclient 请求它没有权限因此生成异常?
    猜你喜欢
    • 1970-01-01
    • 2022-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-07
    • 1970-01-01
    • 2023-03-30
    相关资源
    最近更新 更多