简体   繁体   English

从angular / javascript应用程序进行http2 ajax调用

[英]making http2 ajax call from angular/javascript application

I'm trying to make http2 implementation of my service. 我正在努力使http2实现我的服务。 I used Jetty 9 with ALPN jar and I made the code as per the documentations. 我使用了Jetty 9和ALPN jar,我根据文档制作了代码。 The server got started and I can access the url http://localhost:8443/myurl from chrome version 51. I'm using a chrome extension HTTP2/ SPDY Indicator to see the HTTP2 request and it indicate the request is http2. 服务器启动了,我可以从chrome版本51访问URL http:// localhost:8443 / myurl 。我使用chrome扩展名HTTP2 / SPDY Indicator来查看HTTP2请求,它表明请求是http2。 When I tried to make call a service using Ajax through angularjs I can't see the extension report that HTTP2 call is made. 当我尝试通过angularjs使用Ajax调用服务时,我看不到HTTP2调用的扩展报告。

Is it the problem with the extension to unable to detect Ajax call. 是扩展程序无法检测Ajax调用的问题。 Or do I manually need to set any HTTP2 specific headers for http2 call to get activated. 或者我是否需要手动设置HTTP2调用的任何HTTP2特定标头才能激活。

Any help appreciated. 任何帮助赞赏。

Thanks in advance. 提前致谢。

The Chrome HTTP/2 Indicator extension reports whether the top level document has been downloaded using HTTP/2. Chrome HTTP / 2指标扩展程序报告是否已使用HTTP / 2下载顶级文档。

XHR calls are not reported by that extension. 该扩展程序不会报告XHR调用。

If you browse chrome://net-internals/#http2 in your Chrome browser, you will see the HTTP/2 connections that are alive, and click on the one for your domain will give additional information, included XHR calls. 如果您在Chrome浏览器中浏览chrome:// net-internals /#http2,您将看到有效的HTTP / 2连接,点击您所在域的连接将提供其他信息,包括XHR呼叫。

Alternatively, you can enable the server-side DEBUG logging for HTTP/2 by enabling the org.eclipse.jetty.http2 category to DEBUG, and you will see the XHR calls arriving to the server. 或者,您可以通过将org.eclipse.jetty.http2类别设置为DEBUG来启用HTTP / 2的服务器端DEBUG日志记录,您将看到XHR调用到达服务器。

You don't need to do anything special or add any HTTP/2 headers on your XHR calls (or those that Angular makes for you): the browser knows if it can use HTTP/2, and if it can it will use it. 您不需要做任何特殊的事情或在XHR调用上添加任何HTTP / 2标头(或者Angular为您提供的那些):浏览器知道它是否可以使用HTTP / 2,如果它可以使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM