对不起我的英语。 我试图加载swt包含http请求到我们的报表服务器。我做了一些研究,最后得到了类似的东西。
final String[] header = new String[] {
"Content-Type: application/x-www-form-urlencoded; charset=UTF-8",
"Cache-Control: no-cache",
"Accept: */*",
"Referer: http://<my_own_server>/ReportServer/Pages/ReportViewer.aspx?%2fInformesLogistica%2fDistribucion%2fAETOrdenDevolucionReclamable",
"Accept-Encoding: gzip,deflate,sdch",
"Accept-Language: es-ES,es;q=0.8",
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3" };
String url = "http://axprerps/ReportServer/Pages/ReportViewer.aspx?%2fInformesLogistica%2fDistribucion%2fAETOrdenDevolucionReclamable&rc:Parameters=False";
String filters = "pCentroCompra=1&pCampana=16";
Browser myBrowser = new Browser(main, SWT.NONE);
myBrowser.setUrl(url, filters, header);
它的工作非常好,但在某些计算机上因为Locale而失败。 如果我在我的机器上放了一些嗅探器,我可以看到它发送的标题:
Referer: http://axprerps/ReportServer/Pages/ReportViewer.aspx?%2fInformesLogistica%2fDistribucion%2fAETOrdenDevolucionReclamable\r\n
Accept-Language: es\r\n
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC LM 8; .NET4.0C; InfoPath.2; .NET4.0E)\r\n
Content-Type: application/x-www-form-urlencoded; charset=UTF-8\r\n
Cache-Control: no-cache\r\n
Accept: */*\r\n
Accept-Encoding: gzip, deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n
Host: axprerps\r\n
Content-Length: 8047\r\n
Connection: Keep-Alive\r\n
我的SO是Windows XP SP3,但行为在Windows 2003 Server SP 2中也是可重现的。我还没有在任何其他SO中测试它。
因此,Accept-Language的标头被忽略了。这是正常行为吗?
干杯。