[undertow-dev] HTTP/2 Response Header in Java

Jason Greene jason.greene at redhat.com
Wed Nov 11 12:12:48 EST 2015


> On Nov 11, 2015, at 11:09 AM, jorge lima <jorge.ayala2012 at gmail.com> wrote:
> 
> Hi,
> 
> now I think I'm almost there, when I run my project, it appears this message on console:
> 
> nov 11, 2015 1:48:07 PM com.squareup.okhttp.internal.Platform$JdkWithJettyBootPlatform getSelectedProtocol
> 
> INFO: ALPN callback dropped: SPDY and HTTP/2 are disabled. Is alpn-boot on the boot class path?
> 
> I've tryed to enable the alpn-boot using the command shown on eclipse jetty website:
> 
> 
> java -Xbootclasspath/p:<path_to_alpn_boot_jar> ...
> 
> 
> Then I goes to my cmd, used the command 'cd <path>' to go to my Java Project and used the following:
> 
>  java -Xbootclasspath/p:/libs/alpn-boot-8.1.6.v20151105.jar ... 
> 
> So it always print a help list, doesn't execute nothing for real, then I've tried this:
> 
>   java -Xbootclasspath/p:/libs/alpn-boot-8.1.6.v20151105.jar Test.class

The … means “insert your normal JVM arguments here”

Assuming that Test.class is in the default package, and  in your current directory you would do:

 java -Xbootclasspath/p:/libs/alpn-boot-8.1.6.v20151105.jar Test


> 
> Where this class have a main method and prints: 'Error: Could not find or load main class Test.class'
> 
> I've tested some things that took me hours to have nothing. Why they put this '...' on their command if they even explain very well how to do, I'm lost here, sadly.
> 
> Do you have some clear example how I have to do to activate the alpn-boot on my boot class path? I would thank you so much man...
> 
> 2015-11-10 16:06 GMT-03:00 Jason Greene <jason.greene at redhat.com <mailto:jason.greene at redhat.com>>:
> The ALPN jars are on maven central here:
> 
> https://repo1.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/ <https://repo1.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/>
> 
> You have to match the specific version for the JDK version that you use, which is documented on the alpa-chapter you linked.
> 
>> On Nov 10, 2015, at 11:52 AM, jorge lima <jorge.ayala2012 at gmail.com <mailto:jorge.ayala2012 at gmail.com>> wrote:
>> 
>> Hi,
>> 
>> thanks for the answer again, I'm using now this okhttp and looks very good for me, the problem is that I need to know how to set the proper ALPN boot jar in the bootclasspath (Jetty), I'm having troubles: 
>> 
>> java -Xbootclasspath/p:<path_to_alpn_boot_jar> ...
>> 
>> How I'm gonna put a path to alpn boot jar if I don't have any?
>> 
>> Here is the link:
>> 
>> https://www.eclipse.org/jetty/documentation/current/alpn-chapter.html <https://www.eclipse.org/jetty/documentation/current/alpn-chapter.html>
>> 
>> If you could help me I would appreciate.
>> 
>> 
>> 
>> 2015-11-10 7:34 GMT-03:00 Tomaž Cerar <tomaz.cerar at gmail.com <mailto:tomaz.cerar at gmail.com>>:
>> First you will need client api that knows how to handle HTTP2.
>> 
>> java's URL/URI currently don't support http2 at all.
>> There is JEP http://openjdk.java.net/jeps/110 <http://openjdk.java.net/jeps/110> to add support for it in JDK 9.
>> 
>> AFAK at the moment only https://github.com/square/okhttp <https://github.com/square/okhttp> client properly supports http2.
>> But there is lots of development going on around this topic, best to look the internet 
>> for solution that suits you best.
>> 
>> --
>> tomaz
>> 
>> 
>> 
>> On Mon, Nov 9, 2015 at 9:12 PM, jorge lima <jorge.ayala2012 at gmail.com <mailto:jorge.ayala2012 at gmail.com>> wrote:
>> 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/ <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 at gmail.com <mailto:tomaz.cerar at 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 <https://developer.jboss.org/message/929048>
>> http://undertow.io/blog/2015/03/26/HTTP2-In-Wildfly.html <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 at gmail.com <mailto:jorge.ayala2012 at 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 at lists.jboss.org <mailto:undertow-dev at lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/undertow-dev <https://lists.jboss.org/mailman/listinfo/undertow-dev>
>> 
>> 
>> 
>> 
>> _______________________________________________
>> undertow-dev mailing list
>> undertow-dev at lists.jboss.org <mailto:undertow-dev at lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/undertow-dev <https://lists.jboss.org/mailman/listinfo/undertow-dev>
> --
> Jason T. Greene
> WildFly Lead / JBoss EAP Platform Architect
> JBoss, a division of Red Hat
> 
> 

--
Jason T. Greene
WildFly Lead / JBoss EAP Platform Architect
JBoss, a division of Red Hat

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20151111/774dc28b/attachment-0001.html 


More information about the undertow-dev mailing list