You can do:
if(exchange.getConnection().getTransportProtocol().equals("h2")) {
}
You also need to test for h2c if you are using cleartext HTTP2.
Stuart
----- Original Message -----
From: "jorge lima" <jorge.ayala2012(a)gmail.com>
To: "Tomaž Cerar" <tomaz.cerar(a)gmail.com>
Cc: undertow-dev(a)lists.jboss.org
Sent: Tuesday, 10 November, 2015 7:12:35 AM
Subject: Re: [undertow-dev] HTTP/2 Response Header in Java
Hi,
thanks for the answer. But what I really need to know is to discover if some
website uses HTTP/2 or not, like how we use in URLConnection with Java:
URL url = new URL("
https://developer.jboss.org/ ");
Map<String, List<String>> map = new HashMap<>();
URL obj = new URL(url.toString());
URLConnection conn = obj.openConnection();
map = conn.getHeaderFields();
...
Thanks again!
2015-11-09 16:51 GMT-03:00 Tomaž Cerar < tomaz.cerar(a)gmail.com > :
It is not just http/2 header :)
but yes, undertow supports it, to enable it you will need to upgrade to Java
8 and do some additional setup.
see
https://developer.jboss.org/message/929048
http://undertow.io/blog/2015/03/26/HTTP2-In-Wildfly.html
for how to setup it.
--
tomaz
On Mon, Nov 9, 2015 at 6:15 PM, jorge lima < jorge.ayala2012(a)gmail.com >
wrote:
Hi,
Is there already a way to get the HTTP/2 response header in Java using
Undertow? I really need to know. I'm using JDK 7 on my Java Project. Thank
you very much!
_______________________________________________
undertow-dev mailing list
undertow-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/undertow-dev
_______________________________________________
undertow-dev mailing list
undertow-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/undertow-dev