From sven at kubiak.me Thu Mar 2 14:15:37 2017 From: sven at kubiak.me (Sven Kubiak) Date: Thu, 2 Mar 2017 19:15:37 +0000 Subject: [undertow-dev] Same-Site Cookie Attribute Message-ID: <9fa35c94812147b698c60572a95e5b52@EXDAG10-1.EXCHANGE.INT> I have looked at the current Cookie Implementation in Undetow, and it seems like there is no support for the Same-Site Cookie Attribute. See: https://scotthelme.co.uk/csrf-is-dead/ I'll be happy to create a pull request, if someone could point me to the right classes (and test cases) where the response headers for the cookies are being set. Best regards, Sven -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170302/fe79a706/attachment.html From bill at dartalley.com Thu Mar 2 14:26:57 2017 From: bill at dartalley.com (Bill O'Neil) Date: Thu, 2 Mar 2017 14:26:57 -0500 Subject: [undertow-dev] Same-Site Cookie Attribute In-Reply-To: <9fa35c94812147b698c60572a95e5b52@EXDAG10-1.EXCHANGE.INT> References: <9fa35c94812147b698c60572a95e5b52@EXDAG10-1.EXCHANGE.INT> Message-ID: This should be a good starting point Cookie Interface and Impl https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/handlers/Cookie.java https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/handlers/CookieImpl.java CookieUtil https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/util/Cookies.java Setting a response cookie https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/HttpServerExchange.java#L1120 This was just a quick glance. I'm not sure exactly where the header is set but this should be a good start. Bill On Thu, Mar 2, 2017 at 2:15 PM, Sven Kubiak wrote: > I have looked at the current Cookie Implementation in Undetow, and it > seems like there is no support for the Same-Site Cookie Attribute. > > > > See: https://scotthelme.co.uk/csrf-is-dead/ > > > > I?ll be happy to create a pull request, if someone could point me to the > right classes (and test cases) where the response headers for the cookies > are being set. > > > > Best regards, > > Sven > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170302/25dfb466/attachment.html From masafumi0920 at gmail.com Thu Mar 2 18:30:10 2017 From: masafumi0920 at gmail.com (Masafumi Miura) Date: Fri, 3 Mar 2017 08:30:10 +0900 Subject: [undertow-dev] Same-Site Cookie Attribute In-Reply-To: References: <9fa35c94812147b698c60572a95e5b52@EXDAG10-1.EXCHANGE.INT> Message-ID: I think Set-Cookie string in the response header is constructed in the following code: https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/Connectors.java#L125-L206 As Bill already mentioned, a new attribute should be added in Cookie interface and Impl: https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/handlers/Cookie.java https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/handlers/CookieImpl.java In addition, it looks ServletCookieAdaptor also needs to be modifed because this class implements the above Cookie interface. However, Servlet API javax.servlet.http.Cookie does not have support for such SameSite attribute, so I think this one should not do anything: https://github.com/undertow-io/undertow/blob/master/servlet/src/main/java/io/undertow/servlet/spec/ServletCookieAdaptor.java I've just created a possible proposed patch to add SameSite Cookie support: https://github.com/undertow-io/undertow/compare/master...msfm:master_SameSite_Cookie With this, you can add SameSite attirubte like: Undertow server = Undertow.builder() .addHttpListener(8080, "localhost") .setHandler(new HttpHandler() { @Override public void handleRequest(final HttpServerExchange exchange) throws Exception { Cookie cookie = new CookieImpl("testCookie", "testValue").setSameSite(""); // Cookie cookie = new CookieImpl("testCookie", "testValue").setSameSite("Strict"); // Cookie cookie = new CookieImpl("testCookie", "testValue").setSameSite("Lax"); exchange.setResponseCookie(cookie); exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain"); exchange.getResponseSender().send("Hello World"); } }).build(); server.start(); Masafumi On Fri, Mar 3, 2017 at 4:26 AM, Bill O'Neil wrote: > This should be a good starting point > > Cookie Interface and Impl > https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/handlers/Cookie.java > https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/handlers/CookieImpl.java > > CookieUtil > https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/util/Cookies.java > > Setting a response cookie > https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/HttpServerExchange.java#L1120 > > This was just a quick glance. I'm not sure exactly where the header is set > but this should be a good start. > > Bill > > On Thu, Mar 2, 2017 at 2:15 PM, Sven Kubiak wrote: >> >> I have looked at the current Cookie Implementation in Undetow, and it >> seems like there is no support for the Same-Site Cookie Attribute. >> >> >> >> See: https://scotthelme.co.uk/csrf-is-dead/ >> >> >> >> I?ll be happy to create a pull request, if someone could point me to the >> right classes (and test cases) where the response headers for the cookies >> are being set. >> >> >> >> Best regards, >> >> Sven >> >> >> _______________________________________________ >> undertow-dev mailing list >> undertow-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/undertow-dev > > > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170303/923d9176/attachment-0001.html From msolnit at soasta.com Thu Mar 9 11:43:03 2017 From: msolnit at soasta.com (Matt Solnit) Date: Thu, 9 Mar 2017 08:43:03 -0800 Subject: [undertow-dev] Does record-request-start-time really impact performance? Message-ID: Hi everyone. I'd like to add request duration to our HTTP access log, and found the "record-request-start-time" setting in the documentation. The documentation says "This has a small but measurable performance impact." But is that really true? From what I can see in the code, all it's doing is calling System.nanoTime(). Chasing this led me to a lot of Google searching on nanoTime() itself, and its performance. There's a lot of out-dated information out there, especially with regard to Linux. From what I can see in the Java source, it's using clock_gettime(CLOCK_MONOTONIC), and various sources say this is plenty fast: https://upvoid.com/devblog/2014/05/linux-timers/ (note: this site has an expired certificate as of 2/20, so you'll get a browser complaint) http://stackoverflow.com/questions/38779763/linux-times-or-clock-gettimeclock-monotonic-which-one-is-faster#comment64948211_38779763 Has anyone measured this at the Undertow level, to see whether "record-request-start-time" really affects performance? -- Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170309/8a0d04cc/attachment.html From sdouglas at redhat.com Thu Mar 9 15:30:24 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Fri, 10 Mar 2017 07:30:24 +1100 Subject: [undertow-dev] Does record-request-start-time really impact performance? In-Reply-To: References: Message-ID: Last time I checked it did have a performance impact, especially for things like the tech empower benchmark where you are dealing with hundreds of thousands of requests per second (when you are doing enough requests a second everything has a cost, no matter how fast it supposedly is). In general most apps won't notice any difference, but we still turn it off by default as there is not really any need to use it unless you want to measure request time. Stuart On Fri, Mar 10, 2017 at 3:43 AM, Matt Solnit wrote: > Hi everyone. I'd like to add request duration to our HTTP access log, and > found the "record-request-start-time" setting in the documentation. > > The documentation says "This has a small but measurable performance impact." > But is that really true? From what I can see in the code, all it's doing is > calling System.nanoTime(). > > Chasing this led me to a lot of Google searching on nanoTime() itself, and > its performance. There's a lot of out-dated information out there, > especially with regard to Linux. From what I can see in the Java source, > it's using clock_gettime(CLOCK_MONOTONIC), and various sources say this is > plenty fast: > > https://upvoid.com/devblog/2014/05/linux-timers/ (note: this site has an > expired certificate as of 2/20, so you'll get a browser complaint) > http://stackoverflow.com/questions/38779763/linux-times-or-clock-gettimeclock-monotonic-which-one-is-faster#comment64948211_38779763 > > Has anyone measured this at the Undertow level, to see whether > "record-request-start-time" really affects performance? > > -- Matt > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From michael.hixson at gmail.com Wed Mar 15 17:58:42 2017 From: michael.hixson at gmail.com (Michael Hixson) Date: Wed, 15 Mar 2017 14:58:42 -0700 Subject: [undertow-dev] Undertow jboss logging redirect to logback log file and console In-Reply-To: References: Message-ID: On Tue, Feb 7, 2017 at 2:26 PM, Stuart Douglas wrote: > I think this is something I should address in Undertow Core (Servlet > already has io.undertow.servlet.api.ExceptionHandler), to allow you to > register a handler that will be called if an exception propagates > outside of the handler chain. > > I think there are two options: > > 1) HttpServerExchange.setExceptionHandler(HttpHandler handler), and > then make the exception available as an attachment on the Exchange. > 2) HttpServerExchange.setExceptionHandler(ExceptionHandler handler), > where ExceptionHandler has a single method that takes the exchange and > the exception. > > Thoughts? > > Stuart > I was looking for this feature recently. Did you already decide whether to add it or not? Specifically, I think I want to be able to plug custom behavior into here: https://github.com/undertow-io/undertow/blob/79ce8210f4003a712f48e4e12c0626ff18cd78c5/core/src/main/java/io/undertow/server/Connectors.java#L239-L249 (That's what you had in mind too, right?) I'd personally prefer option 2 so that the type and method signature(s) of the handler reminds me of its purpose. -Michael > On Wed, Feb 8, 2017 at 7:26 AM, Steve Hu wrote: >> Hi Bill, >> >> My exception handler is the first in the chain and it captures majority of >> exceptions but this one. It is basically a try/catch block to wrap all >> handler calls and you can find the source code at >> https://github.com/networknt/light-java/blob/master/exception/src/main/java/com/networknt/exception/ExceptionHandler.java >> >> I will try to dispatch in this handler first tonight and see if it works >> based on your recommendation. >> >> Hi Miere/Kim, >> >> I am in the office now and will try both your approaches tonight on my home >> computer. >> >> Thanks a lot for your help. >> >> Steve >> >> On Tue, Feb 7, 2017 at 2:22 PM, Bill O'Neil wrote: >>> >>> @Steve - If your exception handler is in the handler chain before calling >>> dispatch then an exception is thrown it might not be handled properly (I >>> think I ran into this). If you make sure you add an exception handler after >>> calling dispatch that handles Throwable.class but before your logic, you >>> should be able to catch all Exceptions. I'm not 100% positive here but this >>> seemed to work for me. >>> >>> >>> On Tue, Feb 7, 2017 at 1:48 PM, Kim Rasmussen wrote: >>>> >>>> Hi, >>>> >>>> I have had success with adding the system property: >>>> >>>> -Dorg.jboss.logging.provider=slf4j >>>> >>>> A random search for this on the net revelated this page which does a good >>>> job of explaining various ways of getting it working with WildFly - I myself >>>> use Undertow embedded, so the system property is enough for me. >>>> >>>> /Kim >>>> >>>> 2017-02-07 11:55 GMT+01:00 Miere Teixeira : >>>>> >>>>> Hi Steve, >>>>> >>>>> I've found myself on the same situation couple of years ago and to solve >>>>> my problem I've configured the LoggerProvider to point to >>>>> Slf4JLoggerProvider. Basically, this can be reproduced by declaring a >>>>> META-INF/services/org.jboss.logging.LoggerProvider file with >>>>> org.jboss.logging.Slf4jLoggerProvider as a value. >>>>> >>>>> I hope it helps. >>>>> >>>>> Cheers! >>>>> >>>>> >>>>> On Mon, Feb 6, 2017 at 9:09 PM Steve Hu wrote: >>>>>> >>>>>> Hi, >>>>>> >>>>>> Undertow is using jboss logger to log errors and my application is >>>>>> using slf4j/logback with logback.xml config file in the classpath with >>>>>> Undertow core http server embedded. I handles most exceptions in my own >>>>>> handlers but sometimes uncaught exceptions reaches Connectors class - >>>>>> executeRootHandler method which logs the error and return 500 response code. >>>>>> >>>>>> My first question: Is there a way to redirect the logs from Undertow to >>>>>> logback logs and controlled by logback.xml? I've found some discussions >>>>>> about replacing logger in WildFly but I am using embedded Undertow core >>>>>> only. >>>>>> >>>>>> Second question: When Connectors.executeRootHandler will be called? Is >>>>>> it called when you have the following line in your handler? >>>>>> >>>>>> if (exchange.isInIoThread()) { >>>>>> exchange.dispatch(this); >>>>>> return; >>>>>> >>>>>> } >>>>>> >>>>>> Is there any way we can by pass this so that I can handle uncaught >>>>>> exceptions in my ExceptionHandler in the handler chain? >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Steve >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> undertow-dev mailing list >>>>>> undertow-dev at lists.jboss.org >>>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>> >>>>> -- >>>>> >>>>> Miere Teixeira >>>>> >>>>> >>>>> _______________________________________________ >>>>> undertow-dev mailing list >>>>> undertow-dev at lists.jboss.org >>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>> >>>> >>>> >>>> >>>> -- >>>> Med venlig hilsen / Best regards >>>> >>>> Kim Rasmussen >>>> Partner, IT Architect >>>> >>>> Asseco Denmark A/S >>>> Kronprinsessegade 54 >>>> DK-1306 Copenhagen K >>>> Mobile: +45 26 16 40 23 >>>> Ph.: +45 33 36 46 60 >>>> Fax: +45 33 36 46 61 >>>> >>>> >>>> _______________________________________________ >>>> undertow-dev mailing list >>>> undertow-dev at lists.jboss.org >>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>> >>> >>> >>> _______________________________________________ >>> undertow-dev mailing list >>> undertow-dev at lists.jboss.org >>> https://lists.jboss.org/mailman/listinfo/undertow-dev >> >> >> >> _______________________________________________ >> undertow-dev mailing list >> undertow-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/undertow-dev > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From jim-undertow at spudsoft.co.uk Fri Mar 17 16:52:18 2017 From: jim-undertow at spudsoft.co.uk (jim-undertow at spudsoft.co.uk) Date: Fri, 17 Mar 2017 20:52:18 +0000 Subject: [undertow-dev] Notifications from proxy Message-ID: <530a6e16-5178-bd65-31dc-724982065aa8@spudsoft.co.uk> Hi, I'm trying to use embedded Undertow as a proxy in front of some REST services. I can get it all working, but I'm not getting enough information from the proxy, specifically I'd like some way to know: * When the proxy client tries to connect to an internal endpoint. * When the proxy client fails to connect to an internal endpoint. * The details (definitely headers, but possibly also body) going to the internal endpoint. * The details (definitely headers, but possibly also body) coming from the internal endpoint. At the moment I can't see any easily hookable way to get notifications about these things. I've copied and hacked the LoadBalancingProxyClient so I can add hooks to discover the internal endpoints and failures, but it looks like I'd have to duplicate quite a bit more to get hold of the details of the messages going to/from the internal endpoint. Have I missed anything? Is there a nice hook that will give me access to the exchange at these points? Thanks Jim From stevehu at gmail.com Fri Mar 17 21:18:31 2017 From: stevehu at gmail.com (Steve Hu) Date: Fri, 17 Mar 2017 21:18:31 -0400 Subject: [undertow-dev] Enable HTTP/2 and get JDK9 ALPN not supported Message-ID: Hi, I searched this mailing list and one post mentioned that I don't need to use -Xbootclasspath/p: after 1.4.0Final. I am trying HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but when I start the server I got the following error. Do I have to use OpenJDK 8? If I switch to JBoss OpenSSL implementation? Thanks, Steve 21:00:36.468 [main] DEBUG io.undertow - Configuring listener with protocol HTTPS for interface 0.0.0.0 and port 8843 21:00:36.486 [main] DEBUG io.undertow - JDK9 ALPN not supported java.lang.NoSuchMethodException: javax.net.ssl.SSLParameters.setApplicationProtocols([Ljava.lang.String;) at java.lang.Class.getMethod(Class.java:1786) at io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:47) at io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:43) at java.security.AccessController.doPrivileged(Native Method) at io.undertow.protocols.alpn.JDK9AlpnProvider.(JDK9AlpnProvider.java:43) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at java.lang.Class.newInstance(Class.java:442) at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380) at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) at java.util.ServiceLoader$1.next(ServiceLoader.java:480) at io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:40) at io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:35) at io.undertow.server.protocol.http.AlpnOpenListener.(AlpnOpenListener.java:67) at io.undertow.server.protocol.http.AlpnOpenListener.(AlpnOpenListener.java:90) at io.undertow.Undertow.start(Undertow.java:179) at com.networknt.server.Server.start(Server.java:170) at com.networknt.server.Server.main(Server.java:90) 21:00:36.503 [main] INFO com.networknt.server.Server - Https Server started on ip:0.0.0.0 Port:8843 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170317/8681f1ec/attachment-0001.html From sdouglas at redhat.com Fri Mar 17 23:03:05 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Sat, 18 Mar 2017 14:03:05 +1100 Subject: [undertow-dev] Enable HTTP/2 and get JDK9 ALPN not supported In-Reply-To: References: Message-ID: No, that is a debug level message. The JDK8 ALPN provider should still be registered. Stuart On Sat, Mar 18, 2017 at 12:18 PM, Steve Hu wrote: > Hi, > > I searched this mailing list and one post mentioned that I don't need to use > -Xbootclasspath/p: after 1.4.0Final. I am trying > HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but when I start the > server I got the following error. Do I have to use OpenJDK 8? If I switch to > JBoss OpenSSL implementation? > > Thanks, > > Steve > > 21:00:36.468 [main] DEBUG io.undertow - Configuring listener with protocol > HTTPS for interface 0.0.0.0 and port 8843 > > 21:00:36.486 [main] DEBUG io.undertow - JDK9 ALPN not supported > > java.lang.NoSuchMethodException: > javax.net.ssl.SSLParameters.setApplicationProtocols([Ljava.lang.String;) > > at java.lang.Class.getMethod(Class.java:1786) > > at > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:47) > > at > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:43) > > at java.security.AccessController.doPrivileged(Native Method) > > at > io.undertow.protocols.alpn.JDK9AlpnProvider.(JDK9AlpnProvider.java:43) > > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) > > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > > at java.lang.reflect.Constructor.newInstance(Constructor.java:423) > > at java.lang.Class.newInstance(Class.java:442) > > at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380) > > at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) > > at java.util.ServiceLoader$1.next(ServiceLoader.java:480) > > at io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:40) > > at io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:35) > > at > io.undertow.server.protocol.http.AlpnOpenListener.(AlpnOpenListener.java:67) > > at > io.undertow.server.protocol.http.AlpnOpenListener.(AlpnOpenListener.java:90) > > at io.undertow.Undertow.start(Undertow.java:179) > > at com.networknt.server.Server.start(Server.java:170) > > at com.networknt.server.Server.main(Server.java:90) > > 21:00:36.503 [main] INFO com.networknt.server.Server - Https Server > started on ip:0.0.0.0 Port:8843 > > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From stevehu at gmail.com Sun Mar 19 16:21:25 2017 From: stevehu at gmail.com (Steve Hu) Date: Sun, 19 Mar 2017 16:21:25 -0400 Subject: [undertow-dev] Enable HTTP/2 and get JDK9 ALPN not supported In-Reply-To: References: Message-ID: Thanks Stuart for the quick response. Now I have server started with HTTP/2 and it works perfect with some client tools. Now I am looking for Java HTTP/2 client libraries to update my client module to support HTTP/2 protocol for microservices communication. There are three major libraries okhttp, jetty and netty but all of them require Jetty's ALPN boot JAR. I saw you have resolved the boot jar dependency in Undertow and am wondering if you could point me to the right direction. Do you have any recommendation for HTTP/2 client library? How do you work around the alpn boot jar? Is the same solution can be used by okhttp, jetty and netty before Java 9 is released? On Fri, Mar 17, 2017 at 11:03 PM, Stuart Douglas wrote: > No, that is a debug level message. The JDK8 ALPN provider should still > be registered. > > Stuart > > On Sat, Mar 18, 2017 at 12:18 PM, Steve Hu wrote: > > Hi, > > > > I searched this mailing list and one post mentioned that I don't need to > use > > -Xbootclasspath/p: after 1.4.0Final. I am trying > > HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but when I start the > > server I got the following error. Do I have to use OpenJDK 8? If I > switch to > > JBoss OpenSSL implementation? > > > > Thanks, > > > > Steve > > > > 21:00:36.468 [main] DEBUG io.undertow - Configuring listener with > protocol > > HTTPS for interface 0.0.0.0 and port 8843 > > > > 21:00:36.486 [main] DEBUG io.undertow - JDK9 ALPN not supported > > > > java.lang.NoSuchMethodException: > > javax.net.ssl.SSLParameters.setApplicationProtocols([Ljava.lang.String;) > > > > at java.lang.Class.getMethod(Class.java:1786) > > > > at > > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run( > JDK9AlpnProvider.java:47) > > > > at > > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run( > JDK9AlpnProvider.java:43) > > > > at java.security.AccessController.doPrivileged(Native Method) > > > > at > > io.undertow.protocols.alpn.JDK9AlpnProvider.( > JDK9AlpnProvider.java:43) > > > > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > > > > at > > sun.reflect.NativeConstructorAccessorImpl.newInstance( > NativeConstructorAccessorImpl.java:62) > > > > at > > sun.reflect.DelegatingConstructorAccessorImpl.newInstance( > DelegatingConstructorAccessorImpl.java:45) > > > > at java.lang.reflect.Constructor.newInstance(Constructor.java:423) > > > > at java.lang.Class.newInstance(Class.java:442) > > > > at java.util.ServiceLoader$LazyIterator.nextService( > ServiceLoader.java:380) > > > > at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) > > > > at java.util.ServiceLoader$1.next(ServiceLoader.java:480) > > > > at io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:40) > > > > at io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:35) > > > > at > > io.undertow.server.protocol.http.AlpnOpenListener.( > AlpnOpenListener.java:67) > > > > at > > io.undertow.server.protocol.http.AlpnOpenListener.( > AlpnOpenListener.java:90) > > > > at io.undertow.Undertow.start(Undertow.java:179) > > > > at com.networknt.server.Server.start(Server.java:170) > > > > at com.networknt.server.Server.main(Server.java:90) > > > > 21:00:36.503 [main] INFO com.networknt.server.Server - Https Server > > started on ip:0.0.0.0 Port:8843 > > > > > > _______________________________________________ > > undertow-dev mailing list > > undertow-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170319/7280d55d/attachment.html From sdouglas at redhat.com Sun Mar 19 17:32:23 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Mon, 20 Mar 2017 08:32:23 +1100 Subject: [undertow-dev] Enable HTTP/2 and get JDK9 ALPN not supported In-Reply-To: References: Message-ID: You could use Undertow's HTTP/2 client, although it's API was designed around the reverse proxy use case and as a result is not ideal for the general purpose HTTP client use case (although it is still perfectly usable). In terms of using Undertow's ALPN implementation with Netty etc it would require someone to port it over. The code is at [1] if you are interested. Stuart [1] https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/protocols/ssl/ALPNHackSSLEngine.java On Mon, Mar 20, 2017 at 7:21 AM, Steve Hu wrote: > Thanks Stuart for the quick response. Now I have server started with HTTP/2 > and it works perfect with some client tools. Now I am looking for Java > HTTP/2 client libraries to update my client module to support HTTP/2 > protocol for microservices communication. There are three major libraries > okhttp, jetty and netty but all of them require Jetty's ALPN boot JAR. I saw > you have resolved the boot jar dependency in Undertow and am wondering if > you could point me to the right direction. Do you have any recommendation > for HTTP/2 client library? How do you work around the alpn boot jar? Is the > same solution can be used by okhttp, jetty and netty before Java 9 is > released? > > > > On Fri, Mar 17, 2017 at 11:03 PM, Stuart Douglas > wrote: >> >> No, that is a debug level message. The JDK8 ALPN provider should still >> be registered. >> >> Stuart >> >> On Sat, Mar 18, 2017 at 12:18 PM, Steve Hu wrote: >> > Hi, >> > >> > I searched this mailing list and one post mentioned that I don't need to >> > use >> > -Xbootclasspath/p: after 1.4.0Final. I am trying >> > HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but when I start the >> > server I got the following error. Do I have to use OpenJDK 8? If I >> > switch to >> > JBoss OpenSSL implementation? >> > >> > Thanks, >> > >> > Steve >> > >> > 21:00:36.468 [main] DEBUG io.undertow - Configuring listener with >> > protocol >> > HTTPS for interface 0.0.0.0 and port 8843 >> > >> > 21:00:36.486 [main] DEBUG io.undertow - JDK9 ALPN not supported >> > >> > java.lang.NoSuchMethodException: >> > javax.net.ssl.SSLParameters.setApplicationProtocols([Ljava.lang.String;) >> > >> > at java.lang.Class.getMethod(Class.java:1786) >> > >> > at >> > >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:47) >> > >> > at >> > >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:43) >> > >> > at java.security.AccessController.doPrivileged(Native Method) >> > >> > at >> > >> > io.undertow.protocols.alpn.JDK9AlpnProvider.(JDK9AlpnProvider.java:43) >> > >> > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) >> > >> > at >> > >> > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) >> > >> > at >> > >> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >> > >> > at java.lang.reflect.Constructor.newInstance(Constructor.java:423) >> > >> > at java.lang.Class.newInstance(Class.java:442) >> > >> > at >> > java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380) >> > >> > at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) >> > >> > at java.util.ServiceLoader$1.next(ServiceLoader.java:480) >> > >> > at io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:40) >> > >> > at io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:35) >> > >> > at >> > >> > io.undertow.server.protocol.http.AlpnOpenListener.(AlpnOpenListener.java:67) >> > >> > at >> > >> > io.undertow.server.protocol.http.AlpnOpenListener.(AlpnOpenListener.java:90) >> > >> > at io.undertow.Undertow.start(Undertow.java:179) >> > >> > at com.networknt.server.Server.start(Server.java:170) >> > >> > at com.networknt.server.Server.main(Server.java:90) >> > >> > 21:00:36.503 [main] INFO com.networknt.server.Server - Https Server >> > started on ip:0.0.0.0 Port:8843 >> > >> > >> > _______________________________________________ >> > undertow-dev mailing list >> > undertow-dev at lists.jboss.org >> > https://lists.jboss.org/mailman/listinfo/undertow-dev > > From sdouglas at redhat.com Sun Mar 19 17:33:27 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Mon, 20 Mar 2017 08:33:27 +1100 Subject: [undertow-dev] Notifications from proxy In-Reply-To: <530a6e16-5178-bd65-31dc-724982065aa8@spudsoft.co.uk> References: <530a6e16-5178-bd65-31dc-724982065aa8@spudsoft.co.uk> Message-ID: You will need to file a feature request for this. Stuart On Sat, Mar 18, 2017 at 7:52 AM, wrote: > Hi, > > I'm trying to use embedded Undertow as a proxy in front of some REST > services. > I can get it all working, but I'm not getting enough information from > the proxy, specifically I'd like some way to know: > * When the proxy client tries to connect to an internal endpoint. > * When the proxy client fails to connect to an internal endpoint. > * The details (definitely headers, but possibly also body) going to the > internal endpoint. > * The details (definitely headers, but possibly also body) coming from > the internal endpoint. > > At the moment I can't see any easily hookable way to get notifications > about these things. > > I've copied and hacked the LoadBalancingProxyClient so I can add hooks > to discover the internal endpoints and failures, but it looks like I'd > have to duplicate quite a bit more to get hold of the details of the > messages going to/from the internal endpoint. > Have I missed anything? Is there a nice hook that will give me access > to the exchange at these points? > > Thanks > > Jim > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From sdouglas at redhat.com Sun Mar 19 17:53:21 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Mon, 20 Mar 2017 08:53:21 +1100 Subject: [undertow-dev] Undertow jboss logging redirect to logback log file and console In-Reply-To: References: Message-ID: So at the moment it is possible to get this functionality, it is just not the most intuitive API wise. If you register a io.undertow.server.DefaultResponseListener it will be called when the exchange is ended, and if it ended via an exception the exception will be available under io.undertow.server.DefaultResponseListener#EXCEPTION, so you can just check for this attachment, and if it is present do your exception handling logic. Stuart On Thu, Mar 16, 2017 at 8:58 AM, Michael Hixson wrote: > On Tue, Feb 7, 2017 at 2:26 PM, Stuart Douglas wrote: >> I think this is something I should address in Undertow Core (Servlet >> already has io.undertow.servlet.api.ExceptionHandler), to allow you to >> register a handler that will be called if an exception propagates >> outside of the handler chain. >> >> I think there are two options: >> >> 1) HttpServerExchange.setExceptionHandler(HttpHandler handler), and >> then make the exception available as an attachment on the Exchange. >> 2) HttpServerExchange.setExceptionHandler(ExceptionHandler handler), >> where ExceptionHandler has a single method that takes the exchange and >> the exception. >> >> Thoughts? >> >> Stuart >> > > I was looking for this feature recently. Did you already decide > whether to add it or not? > > Specifically, I think I want to be able to plug custom behavior into here: > > https://github.com/undertow-io/undertow/blob/79ce8210f4003a712f48e4e12c0626ff18cd78c5/core/src/main/java/io/undertow/server/Connectors.java#L239-L249 > > (That's what you had in mind too, right?) > > I'd personally prefer option 2 so that the type and method > signature(s) of the handler reminds me of its purpose. > > -Michael > >> On Wed, Feb 8, 2017 at 7:26 AM, Steve Hu wrote: >>> Hi Bill, >>> >>> My exception handler is the first in the chain and it captures majority of >>> exceptions but this one. It is basically a try/catch block to wrap all >>> handler calls and you can find the source code at >>> https://github.com/networknt/light-java/blob/master/exception/src/main/java/com/networknt/exception/ExceptionHandler.java >>> >>> I will try to dispatch in this handler first tonight and see if it works >>> based on your recommendation. >>> >>> Hi Miere/Kim, >>> >>> I am in the office now and will try both your approaches tonight on my home >>> computer. >>> >>> Thanks a lot for your help. >>> >>> Steve >>> >>> On Tue, Feb 7, 2017 at 2:22 PM, Bill O'Neil wrote: >>>> >>>> @Steve - If your exception handler is in the handler chain before calling >>>> dispatch then an exception is thrown it might not be handled properly (I >>>> think I ran into this). If you make sure you add an exception handler after >>>> calling dispatch that handles Throwable.class but before your logic, you >>>> should be able to catch all Exceptions. I'm not 100% positive here but this >>>> seemed to work for me. >>>> >>>> >>>> On Tue, Feb 7, 2017 at 1:48 PM, Kim Rasmussen wrote: >>>>> >>>>> Hi, >>>>> >>>>> I have had success with adding the system property: >>>>> >>>>> -Dorg.jboss.logging.provider=slf4j >>>>> >>>>> A random search for this on the net revelated this page which does a good >>>>> job of explaining various ways of getting it working with WildFly - I myself >>>>> use Undertow embedded, so the system property is enough for me. >>>>> >>>>> /Kim >>>>> >>>>> 2017-02-07 11:55 GMT+01:00 Miere Teixeira : >>>>>> >>>>>> Hi Steve, >>>>>> >>>>>> I've found myself on the same situation couple of years ago and to solve >>>>>> my problem I've configured the LoggerProvider to point to >>>>>> Slf4JLoggerProvider. Basically, this can be reproduced by declaring a >>>>>> META-INF/services/org.jboss.logging.LoggerProvider file with >>>>>> org.jboss.logging.Slf4jLoggerProvider as a value. >>>>>> >>>>>> I hope it helps. >>>>>> >>>>>> Cheers! >>>>>> >>>>>> >>>>>> On Mon, Feb 6, 2017 at 9:09 PM Steve Hu wrote: >>>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> Undertow is using jboss logger to log errors and my application is >>>>>>> using slf4j/logback with logback.xml config file in the classpath with >>>>>>> Undertow core http server embedded. I handles most exceptions in my own >>>>>>> handlers but sometimes uncaught exceptions reaches Connectors class - >>>>>>> executeRootHandler method which logs the error and return 500 response code. >>>>>>> >>>>>>> My first question: Is there a way to redirect the logs from Undertow to >>>>>>> logback logs and controlled by logback.xml? I've found some discussions >>>>>>> about replacing logger in WildFly but I am using embedded Undertow core >>>>>>> only. >>>>>>> >>>>>>> Second question: When Connectors.executeRootHandler will be called? Is >>>>>>> it called when you have the following line in your handler? >>>>>>> >>>>>>> if (exchange.isInIoThread()) { >>>>>>> exchange.dispatch(this); >>>>>>> return; >>>>>>> >>>>>>> } >>>>>>> >>>>>>> Is there any way we can by pass this so that I can handle uncaught >>>>>>> exceptions in my ExceptionHandler in the handler chain? >>>>>>> >>>>>>> Thanks, >>>>>>> >>>>>>> Steve >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> undertow-dev mailing list >>>>>>> undertow-dev at lists.jboss.org >>>>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>> >>>>>> -- >>>>>> >>>>>> Miere Teixeira >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> undertow-dev mailing list >>>>>> undertow-dev at lists.jboss.org >>>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Med venlig hilsen / Best regards >>>>> >>>>> Kim Rasmussen >>>>> Partner, IT Architect >>>>> >>>>> Asseco Denmark A/S >>>>> Kronprinsessegade 54 >>>>> DK-1306 Copenhagen K >>>>> Mobile: +45 26 16 40 23 >>>>> Ph.: +45 33 36 46 60 >>>>> Fax: +45 33 36 46 61 >>>>> >>>>> >>>>> _______________________________________________ >>>>> undertow-dev mailing list >>>>> undertow-dev at lists.jboss.org >>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>> >>>> >>>> >>>> _______________________________________________ >>>> undertow-dev mailing list >>>> undertow-dev at lists.jboss.org >>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>> >>> >>> >>> _______________________________________________ >>> undertow-dev mailing list >>> undertow-dev at lists.jboss.org >>> https://lists.jboss.org/mailman/listinfo/undertow-dev >> _______________________________________________ >> undertow-dev mailing list >> undertow-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/undertow-dev From stevehu at gmail.com Sun Mar 19 20:07:33 2017 From: stevehu at gmail.com (Steve Hu) Date: Sun, 19 Mar 2017 20:07:33 -0400 Subject: [undertow-dev] Enable HTTP/2 and get JDK9 ALPN not supported In-Reply-To: References: Message-ID: I am reading the code in client package and they look really good. As currently none of the http/2 client library has a work around on alpn boot jar and this blocks majority of developers to move to http/2. I am wondering if you want to split client package to a standalone client module so that it can be used by other developers to connect to servers that implement http/2. If you are interested in it, I can help to create a pull request and add some test cases while I am working on my own client implementation. Thanks. On Sun, Mar 19, 2017 at 5:32 PM, Stuart Douglas wrote: > You could use Undertow's HTTP/2 client, although it's API was designed > around the reverse proxy use case and as a result is not ideal for the > general purpose HTTP client use case (although it is still perfectly > usable). > > In terms of using Undertow's ALPN implementation with Netty etc it > would require someone to port it over. The code is at [1] if you are > interested. > > Stuart > > [1] https://github.com/undertow-io/undertow/blob/master/core/ > src/main/java/io/undertow/protocols/ssl/ALPNHackSSLEngine.java > > On Mon, Mar 20, 2017 at 7:21 AM, Steve Hu wrote: > > Thanks Stuart for the quick response. Now I have server started with > HTTP/2 > > and it works perfect with some client tools. Now I am looking for Java > > HTTP/2 client libraries to update my client module to support HTTP/2 > > protocol for microservices communication. There are three major libraries > > okhttp, jetty and netty but all of them require Jetty's ALPN boot JAR. I > saw > > you have resolved the boot jar dependency in Undertow and am wondering if > > you could point me to the right direction. Do you have any recommendation > > for HTTP/2 client library? How do you work around the alpn boot jar? Is > the > > same solution can be used by okhttp, jetty and netty before Java 9 is > > released? > > > > > > > > On Fri, Mar 17, 2017 at 11:03 PM, Stuart Douglas > > wrote: > >> > >> No, that is a debug level message. The JDK8 ALPN provider should still > >> be registered. > >> > >> Stuart > >> > >> On Sat, Mar 18, 2017 at 12:18 PM, Steve Hu wrote: > >> > Hi, > >> > > >> > I searched this mailing list and one post mentioned that I don't need > to > >> > use > >> > -Xbootclasspath/p: after 1.4.0Final. I am > trying > >> > HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but when I start > the > >> > server I got the following error. Do I have to use OpenJDK 8? If I > >> > switch to > >> > JBoss OpenSSL implementation? > >> > > >> > Thanks, > >> > > >> > Steve > >> > > >> > 21:00:36.468 [main] DEBUG io.undertow - Configuring listener with > >> > protocol > >> > HTTPS for interface 0.0.0.0 and port 8843 > >> > > >> > 21:00:36.486 [main] DEBUG io.undertow - JDK9 ALPN not supported > >> > > >> > java.lang.NoSuchMethodException: > >> > javax.net.ssl.SSLParameters.setApplicationProtocols([ > Ljava.lang.String;) > >> > > >> > at java.lang.Class.getMethod(Class.java:1786) > >> > > >> > at > >> > > >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run( > JDK9AlpnProvider.java:47) > >> > > >> > at > >> > > >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run( > JDK9AlpnProvider.java:43) > >> > > >> > at java.security.AccessController.doPrivileged(Native Method) > >> > > >> > at > >> > > >> > io.undertow.protocols.alpn.JDK9AlpnProvider.( > JDK9AlpnProvider.java:43) > >> > > >> > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native > Method) > >> > > >> > at > >> > > >> > sun.reflect.NativeConstructorAccessorImpl.newInstance( > NativeConstructorAccessorImpl.java:62) > >> > > >> > at > >> > > >> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance( > DelegatingConstructorAccessorImpl.java:45) > >> > > >> > at java.lang.reflect.Constructor.newInstance(Constructor.java:423) > >> > > >> > at java.lang.Class.newInstance(Class.java:442) > >> > > >> > at > >> > java.util.ServiceLoader$LazyIterator.nextService( > ServiceLoader.java:380) > >> > > >> > at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) > >> > > >> > at java.util.ServiceLoader$1.next(ServiceLoader.java:480) > >> > > >> > at io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:40) > >> > > >> > at io.undertow.protocols.alpn.ALPNManager.( > ALPNManager.java:35) > >> > > >> > at > >> > > >> > io.undertow.server.protocol.http.AlpnOpenListener.( > AlpnOpenListener.java:67) > >> > > >> > at > >> > > >> > io.undertow.server.protocol.http.AlpnOpenListener.( > AlpnOpenListener.java:90) > >> > > >> > at io.undertow.Undertow.start(Undertow.java:179) > >> > > >> > at com.networknt.server.Server.start(Server.java:170) > >> > > >> > at com.networknt.server.Server.main(Server.java:90) > >> > > >> > 21:00:36.503 [main] INFO com.networknt.server.Server - Https Server > >> > started on ip:0.0.0.0 Port:8843 > >> > > >> > > >> > _______________________________________________ > >> > undertow-dev mailing list > >> > undertow-dev at lists.jboss.org > >> > https://lists.jboss.org/mailman/listinfo/undertow-dev > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170319/0d9e29de/attachment.html From sdouglas at redhat.com Sun Mar 19 20:23:48 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Mon, 20 Mar 2017 11:23:48 +1100 Subject: [undertow-dev] Enable HTTP/2 and get JDK9 ALPN not supported In-Reply-To: References: Message-ID: I don't really have time to do it (there is no real benefit for Undertow, so it is not high on my priority list), but the code is all Apache licensed so there is no reason why you can't start a project that provides this code as a standalone implementation. You would still need to implement code in Netty etc to actually use this as well, as there is no standardized ALPN API yet. Stuart On Mon, Mar 20, 2017 at 11:07 AM, Steve Hu wrote: > I am reading the code in client package and they look really good. As > currently none of the http/2 client library has a work around on alpn boot > jar and this blocks majority of developers to move to http/2. I am wondering > if you want to split client package to a standalone client module so that it > can be used by other developers to connect to servers that implement http/2. > If you are interested in it, I can help to create a pull request and add > some test cases while I am working on my own client implementation. Thanks. > > On Sun, Mar 19, 2017 at 5:32 PM, Stuart Douglas wrote: >> >> You could use Undertow's HTTP/2 client, although it's API was designed >> around the reverse proxy use case and as a result is not ideal for the >> general purpose HTTP client use case (although it is still perfectly >> usable). >> >> In terms of using Undertow's ALPN implementation with Netty etc it >> would require someone to port it over. The code is at [1] if you are >> interested. >> >> Stuart >> >> [1] >> https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/protocols/ssl/ALPNHackSSLEngine.java >> >> On Mon, Mar 20, 2017 at 7:21 AM, Steve Hu wrote: >> > Thanks Stuart for the quick response. Now I have server started with >> > HTTP/2 >> > and it works perfect with some client tools. Now I am looking for Java >> > HTTP/2 client libraries to update my client module to support HTTP/2 >> > protocol for microservices communication. There are three major >> > libraries >> > okhttp, jetty and netty but all of them require Jetty's ALPN boot JAR. I >> > saw >> > you have resolved the boot jar dependency in Undertow and am wondering >> > if >> > you could point me to the right direction. Do you have any >> > recommendation >> > for HTTP/2 client library? How do you work around the alpn boot jar? Is >> > the >> > same solution can be used by okhttp, jetty and netty before Java 9 is >> > released? >> > >> > >> > >> > On Fri, Mar 17, 2017 at 11:03 PM, Stuart Douglas >> > wrote: >> >> >> >> No, that is a debug level message. The JDK8 ALPN provider should still >> >> be registered. >> >> >> >> Stuart >> >> >> >> On Sat, Mar 18, 2017 at 12:18 PM, Steve Hu wrote: >> >> > Hi, >> >> > >> >> > I searched this mailing list and one post mentioned that I don't need >> >> > to >> >> > use >> >> > -Xbootclasspath/p: after 1.4.0Final. I am >> >> > trying >> >> > HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but when I start >> >> > the >> >> > server I got the following error. Do I have to use OpenJDK 8? If I >> >> > switch to >> >> > JBoss OpenSSL implementation? >> >> > >> >> > Thanks, >> >> > >> >> > Steve >> >> > >> >> > 21:00:36.468 [main] DEBUG io.undertow - Configuring listener with >> >> > protocol >> >> > HTTPS for interface 0.0.0.0 and port 8843 >> >> > >> >> > 21:00:36.486 [main] DEBUG io.undertow - JDK9 ALPN not supported >> >> > >> >> > java.lang.NoSuchMethodException: >> >> > >> >> > javax.net.ssl.SSLParameters.setApplicationProtocols([Ljava.lang.String;) >> >> > >> >> > at java.lang.Class.getMethod(Class.java:1786) >> >> > >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:47) >> >> > >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:43) >> >> > >> >> > at java.security.AccessController.doPrivileged(Native Method) >> >> > >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider.(JDK9AlpnProvider.java:43) >> >> > >> >> > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native >> >> > Method) >> >> > >> >> > at >> >> > >> >> > >> >> > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) >> >> > >> >> > at >> >> > >> >> > >> >> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >> >> > >> >> > at java.lang.reflect.Constructor.newInstance(Constructor.java:423) >> >> > >> >> > at java.lang.Class.newInstance(Class.java:442) >> >> > >> >> > at >> >> > >> >> > java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380) >> >> > >> >> > at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) >> >> > >> >> > at java.util.ServiceLoader$1.next(ServiceLoader.java:480) >> >> > >> >> > at io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:40) >> >> > >> >> > at >> >> > io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:35) >> >> > >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.http.AlpnOpenListener.(AlpnOpenListener.java:67) >> >> > >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.http.AlpnOpenListener.(AlpnOpenListener.java:90) >> >> > >> >> > at io.undertow.Undertow.start(Undertow.java:179) >> >> > >> >> > at com.networknt.server.Server.start(Server.java:170) >> >> > >> >> > at com.networknt.server.Server.main(Server.java:90) >> >> > >> >> > 21:00:36.503 [main] INFO com.networknt.server.Server - Https Server >> >> > started on ip:0.0.0.0 Port:8843 >> >> > >> >> > >> >> > _______________________________________________ >> >> > undertow-dev mailing list >> >> > undertow-dev at lists.jboss.org >> >> > https://lists.jboss.org/mailman/listinfo/undertow-dev >> > >> > > > From stevehu at gmail.com Tue Mar 21 21:50:38 2017 From: stevehu at gmail.com (Steve Hu) Date: Tue, 21 Mar 2017 21:50:38 -0400 Subject: [undertow-dev] Enable HTTP/2 and get JDK9 ALPN not supported In-Reply-To: References: Message-ID: Hi Stuart, I debugged into the ALPN code and found some issues with Http2Client. I started with the Http2Server example and found LoadBalancingProxyClient is using an instance of UndertowClient which can only load HTTP1.1 ClientProviders. The following is the code to get ClientProvider and only "http" or "https" can be the return from uri.getSchema(). ClientProvider provider = clientProviders.get(uri.getScheme()); If this is true, then the communication between the proxy and Http/2 server is Http/1.1 In addition, I have created a new class UndertowHttp2Client and Http2ClientTestCase in my forked repo to try the Http2ClientProviders and found all three http2 client providers don't work as expected. h2c and h2-prior got 200 response code back during handshake and h2 works but the connection is still http 1.1 I am debugging the ALPN code now but it is very slow as I have to dig into the spec to learn how the handshake works. As you have resolved the ALPN boot jar issue with the hack, I think Undertow is very usable for HTTP/2 and it would be perfect if the client is working as well. Could you please confirm my findings and let me know direction I should focus on? Thanks, Steve Here is my repo with UndertowHttp2Client and Test. https://github.com/stevehu/undertow And here is the files I have added. https://github.com/stevehu/undertow/blob/master/core/src/main/java/io/undertow/client/UndertowHttp2Client.java https://github.com/stevehu/undertow/blob/master/core/src/test/java/io/undertow/client/http/Http2ClientTestCase.java On Sun, Mar 19, 2017 at 8:23 PM, Stuart Douglas wrote: > I don't really have time to do it (there is no real benefit for > Undertow, so it is not high on my priority list), but the code is all > Apache licensed so there is no reason why you can't start a project > that provides this code as a standalone implementation. > > You would still need to implement code in Netty etc to actually use > this as well, as there is no standardized ALPN API yet. > > Stuart > > On Mon, Mar 20, 2017 at 11:07 AM, Steve Hu wrote: > > I am reading the code in client package and they look really good. As > > currently none of the http/2 client library has a work around on alpn > boot > > jar and this blocks majority of developers to move to http/2. I am > wondering > > if you want to split client package to a standalone client module so > that it > > can be used by other developers to connect to servers that implement > http/2. > > If you are interested in it, I can help to create a pull request and add > > some test cases while I am working on my own client implementation. > Thanks. > > > > On Sun, Mar 19, 2017 at 5:32 PM, Stuart Douglas > wrote: > >> > >> You could use Undertow's HTTP/2 client, although it's API was designed > >> around the reverse proxy use case and as a result is not ideal for the > >> general purpose HTTP client use case (although it is still perfectly > >> usable). > >> > >> In terms of using Undertow's ALPN implementation with Netty etc it > >> would require someone to port it over. The code is at [1] if you are > >> interested. > >> > >> Stuart > >> > >> [1] > >> https://github.com/undertow-io/undertow/blob/master/core/ > src/main/java/io/undertow/protocols/ssl/ALPNHackSSLEngine.java > >> > >> On Mon, Mar 20, 2017 at 7:21 AM, Steve Hu wrote: > >> > Thanks Stuart for the quick response. Now I have server started with > >> > HTTP/2 > >> > and it works perfect with some client tools. Now I am looking for Java > >> > HTTP/2 client libraries to update my client module to support HTTP/2 > >> > protocol for microservices communication. There are three major > >> > libraries > >> > okhttp, jetty and netty but all of them require Jetty's ALPN boot > JAR. I > >> > saw > >> > you have resolved the boot jar dependency in Undertow and am wondering > >> > if > >> > you could point me to the right direction. Do you have any > >> > recommendation > >> > for HTTP/2 client library? How do you work around the alpn boot jar? > Is > >> > the > >> > same solution can be used by okhttp, jetty and netty before Java 9 is > >> > released? > >> > > >> > > >> > > >> > On Fri, Mar 17, 2017 at 11:03 PM, Stuart Douglas > > >> > wrote: > >> >> > >> >> No, that is a debug level message. The JDK8 ALPN provider should > still > >> >> be registered. > >> >> > >> >> Stuart > >> >> > >> >> On Sat, Mar 18, 2017 at 12:18 PM, Steve Hu > wrote: > >> >> > Hi, > >> >> > > >> >> > I searched this mailing list and one post mentioned that I don't > need > >> >> > to > >> >> > use > >> >> > -Xbootclasspath/p: after 1.4.0Final. I am > >> >> > trying > >> >> > HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but when I start > >> >> > the > >> >> > server I got the following error. Do I have to use OpenJDK 8? If I > >> >> > switch to > >> >> > JBoss OpenSSL implementation? > >> >> > > >> >> > Thanks, > >> >> > > >> >> > Steve > >> >> > > >> >> > 21:00:36.468 [main] DEBUG io.undertow - Configuring listener with > >> >> > protocol > >> >> > HTTPS for interface 0.0.0.0 and port 8843 > >> >> > > >> >> > 21:00:36.486 [main] DEBUG io.undertow - JDK9 ALPN not supported > >> >> > > >> >> > java.lang.NoSuchMethodException: > >> >> > > >> >> > javax.net.ssl.SSLParameters.setApplicationProtocols([ > Ljava.lang.String;) > >> >> > > >> >> > at java.lang.Class.getMethod(Class.java:1786) > >> >> > > >> >> > at > >> >> > > >> >> > > >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run( > JDK9AlpnProvider.java:47) > >> >> > > >> >> > at > >> >> > > >> >> > > >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run( > JDK9AlpnProvider.java:43) > >> >> > > >> >> > at java.security.AccessController.doPrivileged(Native Method) > >> >> > > >> >> > at > >> >> > > >> >> > > >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider.( > JDK9AlpnProvider.java:43) > >> >> > > >> >> > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native > >> >> > Method) > >> >> > > >> >> > at > >> >> > > >> >> > > >> >> > sun.reflect.NativeConstructorAccessorImpl.newInstance( > NativeConstructorAccessorImpl.java:62) > >> >> > > >> >> > at > >> >> > > >> >> > > >> >> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance( > DelegatingConstructorAccessorImpl.java:45) > >> >> > > >> >> > at java.lang.reflect.Constructor.newInstance(Constructor.java:423) > >> >> > > >> >> > at java.lang.Class.newInstance(Class.java:442) > >> >> > > >> >> > at > >> >> > > >> >> > java.util.ServiceLoader$LazyIterator.nextService( > ServiceLoader.java:380) > >> >> > > >> >> > at java.util.ServiceLoader$LazyIterator.next( > ServiceLoader.java:404) > >> >> > > >> >> > at java.util.ServiceLoader$1.next(ServiceLoader.java:480) > >> >> > > >> >> > at io.undertow.protocols.alpn.ALPNManager.( > ALPNManager.java:40) > >> >> > > >> >> > at > >> >> > io.undertow.protocols.alpn.ALPNManager.( > ALPNManager.java:35) > >> >> > > >> >> > at > >> >> > > >> >> > > >> >> > io.undertow.server.protocol.http.AlpnOpenListener.( > AlpnOpenListener.java:67) > >> >> > > >> >> > at > >> >> > > >> >> > > >> >> > io.undertow.server.protocol.http.AlpnOpenListener.( > AlpnOpenListener.java:90) > >> >> > > >> >> > at io.undertow.Undertow.start(Undertow.java:179) > >> >> > > >> >> > at com.networknt.server.Server.start(Server.java:170) > >> >> > > >> >> > at com.networknt.server.Server.main(Server.java:90) > >> >> > > >> >> > 21:00:36.503 [main] INFO com.networknt.server.Server - Https > Server > >> >> > started on ip:0.0.0.0 Port:8843 > >> >> > > >> >> > > >> >> > _______________________________________________ > >> >> > undertow-dev mailing list > >> >> > undertow-dev at lists.jboss.org > >> >> > https://lists.jboss.org/mailman/listinfo/undertow-dev > >> > > >> > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170321/1e4182a0/attachment-0001.html From sdouglas at redhat.com Tue Mar 21 23:39:07 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Wed, 22 Mar 2017 14:39:07 +1100 Subject: [undertow-dev] Enable HTTP/2 and get JDK9 ALPN not supported In-Reply-To: References: Message-ID: On Wed, Mar 22, 2017 at 12:50 PM, Steve Hu wrote: > Hi Stuart, > > I debugged into the ALPN code and found some issues with Http2Client. > > I started with the Http2Server example and found LoadBalancingProxyClient is > using an instance of UndertowClient which can only load HTTP1.1 > ClientProviders. The following is the code to get ClientProvider and only > "http" or "https" can be the return from uri.getSchema(). > > ClientProvider provider = clientProviders.get(uri.getScheme()); > > If this is true, then the communication between the proxy and Http/2 server > is Http/1.1 You need to pass in the ENABLE_HTTP2 option in the OptionsMap. For http URI's this means that the client will attempt an upgrade on the first request, for https URI's ALPN will be used to try and negotiate HTTP/2. This is how browsers behave, and will work even if the target does not support HTTP/2. One thing I did notice that I fixed upstream was that the Undertow builder was not registering a HTTP2UpgradeHandler when HTTP/2 was enabled, which has been fixed. > > In addition, I have created a new class UndertowHttp2Client and > Http2ClientTestCase in my forked repo to try > > the Http2ClientProviders and found all three http2 client providers don't > work as expected. > > h2c and h2-prior got 200 response code back during handshake and h2 works > but the connection is still http 1.1 I think this was probably caused by the lack of the upgrade handler (well for h2c, h2c-prior should still work). Stuart > > I am debugging the ALPN code now but it is very slow as I have to dig into > the spec to learn how the handshake works. > > As you have resolved the ALPN boot jar issue with the hack, I think Undertow > is very usable for HTTP/2 and it would > > be perfect if the client is working as well. Could you please confirm my > findings and let me know direction I should > > focus on? > > > Thanks, > > > Steve > > > Here is my repo with UndertowHttp2Client and Test. > > https://github.com/stevehu/undertow > > > And here is the files I have added. > > https://github.com/stevehu/undertow/blob/master/core/src/main/java/io/undertow/client/UndertowHttp2Client.java > > https://github.com/stevehu/undertow/blob/master/core/src/test/java/io/undertow/client/http/Http2ClientTestCase.java > > > > > > > On Sun, Mar 19, 2017 at 8:23 PM, Stuart Douglas wrote: >> >> I don't really have time to do it (there is no real benefit for >> Undertow, so it is not high on my priority list), but the code is all >> Apache licensed so there is no reason why you can't start a project >> that provides this code as a standalone implementation. >> >> You would still need to implement code in Netty etc to actually use >> this as well, as there is no standardized ALPN API yet. >> >> Stuart >> >> On Mon, Mar 20, 2017 at 11:07 AM, Steve Hu wrote: >> > I am reading the code in client package and they look really good. As >> > currently none of the http/2 client library has a work around on alpn >> > boot >> > jar and this blocks majority of developers to move to http/2. I am >> > wondering >> > if you want to split client package to a standalone client module so >> > that it >> > can be used by other developers to connect to servers that implement >> > http/2. >> > If you are interested in it, I can help to create a pull request and add >> > some test cases while I am working on my own client implementation. >> > Thanks. >> > >> > On Sun, Mar 19, 2017 at 5:32 PM, Stuart Douglas >> > wrote: >> >> >> >> You could use Undertow's HTTP/2 client, although it's API was designed >> >> around the reverse proxy use case and as a result is not ideal for the >> >> general purpose HTTP client use case (although it is still perfectly >> >> usable). >> >> >> >> In terms of using Undertow's ALPN implementation with Netty etc it >> >> would require someone to port it over. The code is at [1] if you are >> >> interested. >> >> >> >> Stuart >> >> >> >> [1] >> >> >> >> https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/protocols/ssl/ALPNHackSSLEngine.java >> >> >> >> On Mon, Mar 20, 2017 at 7:21 AM, Steve Hu wrote: >> >> > Thanks Stuart for the quick response. Now I have server started with >> >> > HTTP/2 >> >> > and it works perfect with some client tools. Now I am looking for >> >> > Java >> >> > HTTP/2 client libraries to update my client module to support HTTP/2 >> >> > protocol for microservices communication. There are three major >> >> > libraries >> >> > okhttp, jetty and netty but all of them require Jetty's ALPN boot >> >> > JAR. I >> >> > saw >> >> > you have resolved the boot jar dependency in Undertow and am >> >> > wondering >> >> > if >> >> > you could point me to the right direction. Do you have any >> >> > recommendation >> >> > for HTTP/2 client library? How do you work around the alpn boot jar? >> >> > Is >> >> > the >> >> > same solution can be used by okhttp, jetty and netty before Java 9 is >> >> > released? >> >> > >> >> > >> >> > >> >> > On Fri, Mar 17, 2017 at 11:03 PM, Stuart Douglas >> >> > >> >> > wrote: >> >> >> >> >> >> No, that is a debug level message. The JDK8 ALPN provider should >> >> >> still >> >> >> be registered. >> >> >> >> >> >> Stuart >> >> >> >> >> >> On Sat, Mar 18, 2017 at 12:18 PM, Steve Hu >> >> >> wrote: >> >> >> > Hi, >> >> >> > >> >> >> > I searched this mailing list and one post mentioned that I don't >> >> >> > need >> >> >> > to >> >> >> > use >> >> >> > -Xbootclasspath/p: after 1.4.0Final. I am >> >> >> > trying >> >> >> > HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but when I >> >> >> > start >> >> >> > the >> >> >> > server I got the following error. Do I have to use OpenJDK 8? If I >> >> >> > switch to >> >> >> > JBoss OpenSSL implementation? >> >> >> > >> >> >> > Thanks, >> >> >> > >> >> >> > Steve >> >> >> > >> >> >> > 21:00:36.468 [main] DEBUG io.undertow - Configuring listener with >> >> >> > protocol >> >> >> > HTTPS for interface 0.0.0.0 and port 8843 >> >> >> > >> >> >> > 21:00:36.486 [main] DEBUG io.undertow - JDK9 ALPN not supported >> >> >> > >> >> >> > java.lang.NoSuchMethodException: >> >> >> > >> >> >> > >> >> >> > javax.net.ssl.SSLParameters.setApplicationProtocols([Ljava.lang.String;) >> >> >> > >> >> >> > at java.lang.Class.getMethod(Class.java:1786) >> >> >> > >> >> >> > at >> >> >> > >> >> >> > >> >> >> > >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:47) >> >> >> > >> >> >> > at >> >> >> > >> >> >> > >> >> >> > >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:43) >> >> >> > >> >> >> > at java.security.AccessController.doPrivileged(Native Method) >> >> >> > >> >> >> > at >> >> >> > >> >> >> > >> >> >> > >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider.(JDK9AlpnProvider.java:43) >> >> >> > >> >> >> > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native >> >> >> > Method) >> >> >> > >> >> >> > at >> >> >> > >> >> >> > >> >> >> > >> >> >> > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) >> >> >> > >> >> >> > at >> >> >> > >> >> >> > >> >> >> > >> >> >> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >> >> >> > >> >> >> > at java.lang.reflect.Constructor.newInstance(Constructor.java:423) >> >> >> > >> >> >> > at java.lang.Class.newInstance(Class.java:442) >> >> >> > >> >> >> > at >> >> >> > >> >> >> > >> >> >> > java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380) >> >> >> > >> >> >> > at >> >> >> > java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) >> >> >> > >> >> >> > at java.util.ServiceLoader$1.next(ServiceLoader.java:480) >> >> >> > >> >> >> > at >> >> >> > io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:40) >> >> >> > >> >> >> > at >> >> >> > >> >> >> > io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:35) >> >> >> > >> >> >> > at >> >> >> > >> >> >> > >> >> >> > >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.(AlpnOpenListener.java:67) >> >> >> > >> >> >> > at >> >> >> > >> >> >> > >> >> >> > >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.(AlpnOpenListener.java:90) >> >> >> > >> >> >> > at io.undertow.Undertow.start(Undertow.java:179) >> >> >> > >> >> >> > at com.networknt.server.Server.start(Server.java:170) >> >> >> > >> >> >> > at com.networknt.server.Server.main(Server.java:90) >> >> >> > >> >> >> > 21:00:36.503 [main] INFO com.networknt.server.Server - Https >> >> >> > Server >> >> >> > started on ip:0.0.0.0 Port:8843 >> >> >> > >> >> >> > >> >> >> > _______________________________________________ >> >> >> > undertow-dev mailing list >> >> >> > undertow-dev at lists.jboss.org >> >> >> > https://lists.jboss.org/mailman/listinfo/undertow-dev >> >> > >> >> > >> > >> > > > From stevehu at gmail.com Wed Mar 22 10:31:39 2017 From: stevehu at gmail.com (Steve Hu) Date: Wed, 22 Mar 2017 10:31:39 -0400 Subject: [undertow-dev] Enable HTTP/2 and get JDK9 ALPN not supported In-Reply-To: References: Message-ID: Hi Stuart, Thanks for the upgrade handler fix. I can clearly see the handler is registered and handleRequest is called in a debug session. I also replaced EMPTY option with OptionMap.create(UndertowOptions.ENABLE_HTTP2, true) when opening client connection. The response protocol is still HTTP/1.1 for both http and https requests. The following is the output from the console and the syched/updated source code can be found https://github.com/stevehu/undertow/blob/master/core/src/test/java/io/undertow/client/http/Http2ClientTestCase.java 10:16:43,804 INFO (main) [org.xnio] XNIO version 3.3.6.Final 10:16:43,829 INFO (main) [org.xnio.nio] XNIO NIO Implementation Version 3.3.6.Final 10:17:42,980 DEBUG (main) [io.undertow.request.io] Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7778 local /127.0.0.1:64696[ No Receiver [] -- [] -- []]: java.nio.channels.ClosedChannelException at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) at io.undertow.client.http2.Http2ClientConnection.close(Http2ClientConnection.java:312) at org.xnio.IoUtils.safeClose(IoUtils.java:134) at io.undertow.client.http.Http2ClientTestCase.testHttpsConnectionClose(Http2ClientTestCase.java:245) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) HTTP/1.1 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) 10:17:42,986 DEBUG (Client I/O-7) [io.undertow.request.io] Channel Http2Channel peer localhost/ 127.0.0.1:7778 local /127.0.0.1:64696[ No Receiver [] -- [] -- []] is being closed: java.nio.channels.ClosedChannelException at io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) at org.xnio.IoUtils.safeClose(IoUtils.java:134) at io.undertow.protocols.http2.Http2Channel$3.handleEvent(Http2Channel.java:762) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:421) at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:409) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel$1.run(AbstractFramedStreamSinkChannel.java:212) at io.undertow.server.protocol.framed.AbstractFramedChannel$3.run(AbstractFramedChannel.java:231) at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) 10:17:42,986 DEBUG (XNIO-1 I/O-7) [io.undertow.request.io] Sending goaway on channel Http2Channel peer / 127.0.0.1:64696 local /127.0.0.1:7778[ No Receiver [] -- [] -- []]: java.nio.channels.ClosedChannelException at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) at io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) at io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) at io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) at io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) at io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1129) at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) 10:17:42,988 DEBUG (XNIO-1 I/O-7) [io.undertow.request.io] Channel Http2Channel peer /127.0.0.1:64696 local /127.0.0.1:7778[ No Receiver [] -- [] -- []] is being closed: java.nio.channels.ClosedChannelException at io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) at org.xnio.IoUtils.safeClose(IoUtils.java:134) at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:767) at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) at io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) at io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) at io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) at io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) at io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1129) at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) 10:17:43,001 DEBUG (Client I/O-7) [io.undertow.request.io] UT005013: An IOException occurred: java.nio.channels.ClosedChannelException at io.undertow.client.http2.Http2ClientConnection$Http2ReceiveListener.handleEvent(Http2ClientConnection.java:452) at io.undertow.client.http2.Http2ClientConnection$Http2ReceiveListener.handleEvent(Http2ClientConnection.java:366) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) at io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1129) at io.undertow.protocols.ssl.SslConduit$1.run(SslConduit.java:168) at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) HTTP/1.1 10:20:14,473 DEBUG (main) [io.undertow.request.io] Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7777 local /127.0.0.1:64697[ No Receiver [] -- [] -- []]: java.nio.channels.ClosedChannelException at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) at io.undertow.client.http2.Http2ClientConnection.close(Http2ClientConnection.java:312) at org.xnio.IoUtils.safeClose(IoUtils.java:134) at io.undertow.client.http.Http2ClientTestCase.testHttpConnectionClose(Http2ClientTestCase.java:220) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) 10:20:14,474 DEBUG (Client I/O-4) [io.undertow.request.io] Channel Http2Channel peer localhost/ 127.0.0.1:7777 local /127.0.0.1:64697[ No Receiver [] -- [] -- []] is being closed: java.nio.channels.ClosedChannelException at io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) at org.xnio.IoUtils.safeClose(IoUtils.java:134) at io.undertow.protocols.http2.Http2Channel$3.handleEvent(Http2Channel.java:762) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:421) at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:409) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.ChannelListeners$4.run(ChannelListeners.java:147) at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) 10:20:14,474 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] Sending goaway on channel Http2Channel peer / 127.0.0.1:64697 local /127.0.0.1:7777[ No Receiver [] -- [] -- []]: java.nio.channels.ClosedChannelException at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) at io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) at io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) at io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) at io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) 10:20:14,476 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] Channel Http2Channel peer /127.0.0.1:64697 local /127.0.0.1:7777[ No Receiver [] -- [] -- []] is being closed: java.nio.channels.ClosedChannelException at io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) at org.xnio.IoUtils.safeClose(IoUtils.java:134) at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:767) at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) at io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) at io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) at io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) at io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) On Tue, Mar 21, 2017 at 11:39 PM, Stuart Douglas wrote: > On Wed, Mar 22, 2017 at 12:50 PM, Steve Hu wrote: > > Hi Stuart, > > > > I debugged into the ALPN code and found some issues with Http2Client. > > > > I started with the Http2Server example and found > LoadBalancingProxyClient is > > using an instance of UndertowClient which can only load HTTP1.1 > > ClientProviders. The following is the code to get ClientProvider and only > > "http" or "https" can be the return from uri.getSchema(). > > > > ClientProvider provider = clientProviders.get(uri.getScheme()); > > > > If this is true, then the communication between the proxy and Http/2 > server > > is Http/1.1 > > You need to pass in the ENABLE_HTTP2 option in the OptionsMap. For > http URI's this means that the client will attempt an upgrade on the > first request, for https URI's ALPN will be used to try and negotiate > HTTP/2. This is how browsers behave, and will work even if the target > does not support HTTP/2. > > One thing I did notice that I fixed upstream was that the Undertow > builder was not registering a HTTP2UpgradeHandler when HTTP/2 was > enabled, which has been fixed. > > > > > In addition, I have created a new class UndertowHttp2Client and > > Http2ClientTestCase in my forked repo to try > > > > the Http2ClientProviders and found all three http2 client providers don't > > work as expected. > > > > h2c and h2-prior got 200 response code back during handshake and h2 works > > but the connection is still http 1.1 > > I think this was probably caused by the lack of the upgrade handler > (well for h2c, h2c-prior should still work). > > Stuart > > > > > I am debugging the ALPN code now but it is very slow as I have to dig > into > > the spec to learn how the handshake works. > > > > As you have resolved the ALPN boot jar issue with the hack, I think > Undertow > > is very usable for HTTP/2 and it would > > > > be perfect if the client is working as well. Could you please confirm my > > findings and let me know direction I should > > > > focus on? > > > > > > > > Thanks, > > > > > > Steve > > > > > > Here is my repo with UndertowHttp2Client and Test. > > > > https://github.com/stevehu/undertow > > > > > > And here is the files I have added. > > > > https://github.com/stevehu/undertow/blob/master/core/src/ > main/java/io/undertow/client/UndertowHttp2Client.java > > > > https://github.com/stevehu/undertow/blob/master/core/src/ > test/java/io/undertow/client/http/Http2ClientTestCase.java > > > > > > > > > > > > > > On Sun, Mar 19, 2017 at 8:23 PM, Stuart Douglas > wrote: > >> > >> I don't really have time to do it (there is no real benefit for > >> Undertow, so it is not high on my priority list), but the code is all > >> Apache licensed so there is no reason why you can't start a project > >> that provides this code as a standalone implementation. > >> > >> You would still need to implement code in Netty etc to actually use > >> this as well, as there is no standardized ALPN API yet. > >> > >> Stuart > >> > >> On Mon, Mar 20, 2017 at 11:07 AM, Steve Hu wrote: > >> > I am reading the code in client package and they look really good. As > >> > currently none of the http/2 client library has a work around on alpn > >> > boot > >> > jar and this blocks majority of developers to move to http/2. I am > >> > wondering > >> > if you want to split client package to a standalone client module so > >> > that it > >> > can be used by other developers to connect to servers that implement > >> > http/2. > >> > If you are interested in it, I can help to create a pull request and > add > >> > some test cases while I am working on my own client implementation. > >> > Thanks. > >> > > >> > On Sun, Mar 19, 2017 at 5:32 PM, Stuart Douglas > >> > wrote: > >> >> > >> >> You could use Undertow's HTTP/2 client, although it's API was > designed > >> >> around the reverse proxy use case and as a result is not ideal for > the > >> >> general purpose HTTP client use case (although it is still perfectly > >> >> usable). > >> >> > >> >> In terms of using Undertow's ALPN implementation with Netty etc it > >> >> would require someone to port it over. The code is at [1] if you are > >> >> interested. > >> >> > >> >> Stuart > >> >> > >> >> [1] > >> >> > >> >> https://github.com/undertow-io/undertow/blob/master/core/ > src/main/java/io/undertow/protocols/ssl/ALPNHackSSLEngine.java > >> >> > >> >> On Mon, Mar 20, 2017 at 7:21 AM, Steve Hu wrote: > >> >> > Thanks Stuart for the quick response. Now I have server started > with > >> >> > HTTP/2 > >> >> > and it works perfect with some client tools. Now I am looking for > >> >> > Java > >> >> > HTTP/2 client libraries to update my client module to support > HTTP/2 > >> >> > protocol for microservices communication. There are three major > >> >> > libraries > >> >> > okhttp, jetty and netty but all of them require Jetty's ALPN boot > >> >> > JAR. I > >> >> > saw > >> >> > you have resolved the boot jar dependency in Undertow and am > >> >> > wondering > >> >> > if > >> >> > you could point me to the right direction. Do you have any > >> >> > recommendation > >> >> > for HTTP/2 client library? How do you work around the alpn boot > jar? > >> >> > Is > >> >> > the > >> >> > same solution can be used by okhttp, jetty and netty before Java 9 > is > >> >> > released? > >> >> > > >> >> > > >> >> > > >> >> > On Fri, Mar 17, 2017 at 11:03 PM, Stuart Douglas > >> >> > > >> >> > wrote: > >> >> >> > >> >> >> No, that is a debug level message. The JDK8 ALPN provider should > >> >> >> still > >> >> >> be registered. > >> >> >> > >> >> >> Stuart > >> >> >> > >> >> >> On Sat, Mar 18, 2017 at 12:18 PM, Steve Hu > >> >> >> wrote: > >> >> >> > Hi, > >> >> >> > > >> >> >> > I searched this mailing list and one post mentioned that I don't > >> >> >> > need > >> >> >> > to > >> >> >> > use > >> >> >> > -Xbootclasspath/p: after 1.4.0Final. I > am > >> >> >> > trying > >> >> >> > HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but when I > >> >> >> > start > >> >> >> > the > >> >> >> > server I got the following error. Do I have to use OpenJDK 8? > If I > >> >> >> > switch to > >> >> >> > JBoss OpenSSL implementation? > >> >> >> > > >> >> >> > Thanks, > >> >> >> > > >> >> >> > Steve > >> >> >> > > >> >> >> > 21:00:36.468 [main] DEBUG io.undertow - Configuring listener > with > >> >> >> > protocol > >> >> >> > HTTPS for interface 0.0.0.0 and port 8843 > >> >> >> > > >> >> >> > 21:00:36.486 [main] DEBUG io.undertow - JDK9 ALPN not supported > >> >> >> > > >> >> >> > java.lang.NoSuchMethodException: > >> >> >> > > >> >> >> > > >> >> >> > javax.net.ssl.SSLParameters.setApplicationProtocols([ > Ljava.lang.String;) > >> >> >> > > >> >> >> > at java.lang.Class.getMethod(Class.java:1786) > >> >> >> > > >> >> >> > at > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run( > JDK9AlpnProvider.java:47) > >> >> >> > > >> >> >> > at > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run( > JDK9AlpnProvider.java:43) > >> >> >> > > >> >> >> > at java.security.AccessController.doPrivileged(Native Method) > >> >> >> > > >> >> >> > at > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider.( > JDK9AlpnProvider.java:43) > >> >> >> > > >> >> >> > at sun.reflect.NativeConstructorAccessorImpl. > newInstance0(Native > >> >> >> > Method) > >> >> >> > > >> >> >> > at > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > sun.reflect.NativeConstructorAccessorImpl.newInstance( > NativeConstructorAccessorImpl.java:62) > >> >> >> > > >> >> >> > at > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance( > DelegatingConstructorAccessorImpl.java:45) > >> >> >> > > >> >> >> > at java.lang.reflect.Constructor.newInstance(Constructor.java: > 423) > >> >> >> > > >> >> >> > at java.lang.Class.newInstance(Class.java:442) > >> >> >> > > >> >> >> > at > >> >> >> > > >> >> >> > > >> >> >> > java.util.ServiceLoader$LazyIterator.nextService( > ServiceLoader.java:380) > >> >> >> > > >> >> >> > at > >> >> >> > java.util.ServiceLoader$LazyIterator.next( > ServiceLoader.java:404) > >> >> >> > > >> >> >> > at java.util.ServiceLoader$1.next(ServiceLoader.java:480) > >> >> >> > > >> >> >> > at > >> >> >> > io.undertow.protocols.alpn.ALPNManager.( > ALPNManager.java:40) > >> >> >> > > >> >> >> > at > >> >> >> > > >> >> >> > io.undertow.protocols.alpn.ALPNManager.( > ALPNManager.java:35) > >> >> >> > > >> >> >> > at > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.( > AlpnOpenListener.java:67) > >> >> >> > > >> >> >> > at > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.( > AlpnOpenListener.java:90) > >> >> >> > > >> >> >> > at io.undertow.Undertow.start(Undertow.java:179) > >> >> >> > > >> >> >> > at com.networknt.server.Server.start(Server.java:170) > >> >> >> > > >> >> >> > at com.networknt.server.Server.main(Server.java:90) > >> >> >> > > >> >> >> > 21:00:36.503 [main] INFO com.networknt.server.Server - Https > >> >> >> > Server > >> >> >> > started on ip:0.0.0.0 Port:8843 > >> >> >> > > >> >> >> > > >> >> >> > _______________________________________________ > >> >> >> > undertow-dev mailing list > >> >> >> > undertow-dev at lists.jboss.org > >> >> >> > https://lists.jboss.org/mailman/listinfo/undertow-dev > >> >> > > >> >> > > >> > > >> > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170322/b068961e/attachment-0001.html From sdouglas at redhat.com Wed Mar 22 17:01:37 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Thu, 23 Mar 2017 08:01:37 +1100 Subject: [undertow-dev] Enable HTTP/2 and get JDK9 ALPN not supported In-Reply-To: References: Message-ID: The issue is that it is reporting the wrong protocol in the response, I have fixed this upstream. Stuart On Thu, Mar 23, 2017 at 1:31 AM, Steve Hu wrote: > Hi Stuart, > > Thanks for the upgrade handler fix. I can clearly see the handler is > registered and handleRequest is called in a debug session. I also replaced > EMPTY option with OptionMap.create(UndertowOptions.ENABLE_HTTP2, true) when > opening client connection. The response protocol is still HTTP/1.1 for both > http and https requests. The following is the output from the console and > the syched/updated source code can be found > https://github.com/stevehu/undertow/blob/master/core/src/test/java/io/undertow/client/http/Http2ClientTestCase.java > > 10:16:43,804 INFO (main) [org.xnio] XNIO version 3.3.6.Final > 10:16:43,829 INFO (main) [org.xnio.nio] XNIO NIO > Implementation Version 3.3.6.Final > 10:17:42,980 DEBUG (main) [io.undertow.request.io] > Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7778 local > /127.0.0.1:64696[ No Receiver [] -- [] -- []]: > java.nio.channels.ClosedChannelException > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) > at > io.undertow.client.http2.Http2ClientConnection.close(Http2ClientConnection.java:312) > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > at > io.undertow.client.http.Http2ClientTestCase.testHttpsConnectionClose(Http2ClientTestCase.java:245) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > HTTP/1.1 > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) > at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) > at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) > at > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > at > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) > at > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > at org.junit.runner.JUnitCore.run(JUnitCore.java:137) > at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) > at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) > at > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) > at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) > > 10:17:42,986 DEBUG (Client I/O-7) [io.undertow.request.io] > Channel Http2Channel peer > localhost/127.0.0.1:7778 local /127.0.0.1:64696[ No Receiver [] -- [] -- []] > is being closed: java.nio.channels.ClosedChannelException > at > io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > at > io.undertow.protocols.http2.Http2Channel$3.handleEvent(Http2Channel.java:762) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:421) > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:409) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at > io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel$1.run(AbstractFramedStreamSinkChannel.java:212) > at > io.undertow.server.protocol.framed.AbstractFramedChannel$3.run(AbstractFramedChannel.java:231) > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) > > 10:17:42,986 DEBUG (XNIO-1 I/O-7) [io.undertow.request.io] > Sending goaway on channel Http2Channel peer > /127.0.0.1:64696 local /127.0.0.1:7778[ No Receiver [] -- [] -- []]: > java.nio.channels.ClosedChannelException > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) > at > io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) > at > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) > at > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) > at > io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) > at > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) > at > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > at > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) > at > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1129) > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > > 10:17:42,988 DEBUG (XNIO-1 I/O-7) [io.undertow.request.io] > Channel Http2Channel peer /127.0.0.1:64696 > local /127.0.0.1:7778[ No Receiver [] -- [] -- []] is being closed: > java.nio.channels.ClosedChannelException > at > io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:767) > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) > at > io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) > at > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) > at > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) > at > io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) > at > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) > at > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > at > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) > at > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1129) > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > > 10:17:43,001 DEBUG (Client I/O-7) [io.undertow.request.io] > UT005013: An IOException occurred: > java.nio.channels.ClosedChannelException > at > io.undertow.client.http2.Http2ClientConnection$Http2ReceiveListener.handleEvent(Http2ClientConnection.java:452) > at > io.undertow.client.http2.Http2ClientConnection$Http2ReceiveListener.handleEvent(Http2ClientConnection.java:366) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > at > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) > at > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1129) > at io.undertow.protocols.ssl.SslConduit$1.run(SslConduit.java:168) > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) > > HTTP/1.1 > 10:20:14,473 DEBUG (main) [io.undertow.request.io] > Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7777 local > /127.0.0.1:64697[ No Receiver [] -- [] -- []]: > java.nio.channels.ClosedChannelException > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) > > at > io.undertow.client.http2.Http2ClientConnection.close(Http2ClientConnection.java:312) > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > at > io.undertow.client.http.Http2ClientTestCase.testHttpConnectionClose(Http2ClientTestCase.java:220) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) > at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) > at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) > at > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > at > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) > at > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > at org.junit.runner.JUnitCore.run(JUnitCore.java:137) > at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) > at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) > at > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) > at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) > > 10:20:14,474 DEBUG (Client I/O-4) [io.undertow.request.io] > Channel Http2Channel peer > localhost/127.0.0.1:7777 local /127.0.0.1:64697[ No Receiver [] -- [] -- []] > is being closed: java.nio.channels.ClosedChannelException > at > io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > at > io.undertow.protocols.http2.Http2Channel$3.handleEvent(Http2Channel.java:762) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:421) > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:409) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at org.xnio.ChannelListeners$4.run(ChannelListeners.java:147) > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) > > 10:20:14,474 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] > Sending goaway on channel Http2Channel peer > /127.0.0.1:64697 local /127.0.0.1:7777[ No Receiver [] -- [] -- []]: > java.nio.channels.ClosedChannelException > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) > at > io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) > at > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) > at > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) > at > io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) > at > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) > at > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > at > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > > 10:20:14,476 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] > Channel Http2Channel peer /127.0.0.1:64697 > local /127.0.0.1:7777[ No Receiver [] -- [] -- []] is being closed: > java.nio.channels.ClosedChannelException > at > io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:767) > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) > at > io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) > at > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) > at > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) > at > io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) > at > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) > at > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > at > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > > > On Tue, Mar 21, 2017 at 11:39 PM, Stuart Douglas > wrote: >> >> On Wed, Mar 22, 2017 at 12:50 PM, Steve Hu wrote: >> > Hi Stuart, >> > >> > I debugged into the ALPN code and found some issues with Http2Client. >> > >> > I started with the Http2Server example and found >> > LoadBalancingProxyClient is >> > using an instance of UndertowClient which can only load HTTP1.1 >> > ClientProviders. The following is the code to get ClientProvider and >> > only >> > "http" or "https" can be the return from uri.getSchema(). >> > >> > ClientProvider provider = clientProviders.get(uri.getScheme()); >> > >> > If this is true, then the communication between the proxy and Http/2 >> > server >> > is Http/1.1 >> >> You need to pass in the ENABLE_HTTP2 option in the OptionsMap. For >> http URI's this means that the client will attempt an upgrade on the >> first request, for https URI's ALPN will be used to try and negotiate >> HTTP/2. This is how browsers behave, and will work even if the target >> does not support HTTP/2. >> >> One thing I did notice that I fixed upstream was that the Undertow >> builder was not registering a HTTP2UpgradeHandler when HTTP/2 was >> enabled, which has been fixed. >> >> > >> > In addition, I have created a new class UndertowHttp2Client and >> > Http2ClientTestCase in my forked repo to try >> > >> > the Http2ClientProviders and found all three http2 client providers >> > don't >> > work as expected. >> > >> > h2c and h2-prior got 200 response code back during handshake and h2 >> > works >> > but the connection is still http 1.1 >> >> I think this was probably caused by the lack of the upgrade handler >> (well for h2c, h2c-prior should still work). >> >> Stuart >> >> > >> > I am debugging the ALPN code now but it is very slow as I have to dig >> > into >> > the spec to learn how the handshake works. >> > >> > As you have resolved the ALPN boot jar issue with the hack, I think >> > Undertow >> > is very usable for HTTP/2 and it would >> > >> > be perfect if the client is working as well. Could you please confirm my >> > findings and let me know direction I should >> > >> > focus on? >> >> >> > >> > >> > Thanks, >> > >> > >> > Steve >> > >> > >> > Here is my repo with UndertowHttp2Client and Test. >> > >> > https://github.com/stevehu/undertow >> > >> > >> > And here is the files I have added. >> > >> > >> > https://github.com/stevehu/undertow/blob/master/core/src/main/java/io/undertow/client/UndertowHttp2Client.java >> > >> > >> > https://github.com/stevehu/undertow/blob/master/core/src/test/java/io/undertow/client/http/Http2ClientTestCase.java >> > >> > >> > >> > >> > >> > >> > On Sun, Mar 19, 2017 at 8:23 PM, Stuart Douglas >> > wrote: >> >> >> >> I don't really have time to do it (there is no real benefit for >> >> Undertow, so it is not high on my priority list), but the code is all >> >> Apache licensed so there is no reason why you can't start a project >> >> that provides this code as a standalone implementation. >> >> >> >> You would still need to implement code in Netty etc to actually use >> >> this as well, as there is no standardized ALPN API yet. >> >> >> >> Stuart >> >> >> >> On Mon, Mar 20, 2017 at 11:07 AM, Steve Hu wrote: >> >> > I am reading the code in client package and they look really good. As >> >> > currently none of the http/2 client library has a work around on alpn >> >> > boot >> >> > jar and this blocks majority of developers to move to http/2. I am >> >> > wondering >> >> > if you want to split client package to a standalone client module so >> >> > that it >> >> > can be used by other developers to connect to servers that implement >> >> > http/2. >> >> > If you are interested in it, I can help to create a pull request and >> >> > add >> >> > some test cases while I am working on my own client implementation. >> >> > Thanks. >> >> > >> >> > On Sun, Mar 19, 2017 at 5:32 PM, Stuart Douglas >> >> > wrote: >> >> >> >> >> >> You could use Undertow's HTTP/2 client, although it's API was >> >> >> designed >> >> >> around the reverse proxy use case and as a result is not ideal for >> >> >> the >> >> >> general purpose HTTP client use case (although it is still perfectly >> >> >> usable). >> >> >> >> >> >> In terms of using Undertow's ALPN implementation with Netty etc it >> >> >> would require someone to port it over. The code is at [1] if you are >> >> >> interested. >> >> >> >> >> >> Stuart >> >> >> >> >> >> [1] >> >> >> >> >> >> >> >> >> https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/protocols/ssl/ALPNHackSSLEngine.java >> >> >> >> >> >> On Mon, Mar 20, 2017 at 7:21 AM, Steve Hu wrote: >> >> >> > Thanks Stuart for the quick response. Now I have server started >> >> >> > with >> >> >> > HTTP/2 >> >> >> > and it works perfect with some client tools. Now I am looking for >> >> >> > Java >> >> >> > HTTP/2 client libraries to update my client module to support >> >> >> > HTTP/2 >> >> >> > protocol for microservices communication. There are three major >> >> >> > libraries >> >> >> > okhttp, jetty and netty but all of them require Jetty's ALPN boot >> >> >> > JAR. I >> >> >> > saw >> >> >> > you have resolved the boot jar dependency in Undertow and am >> >> >> > wondering >> >> >> > if >> >> >> > you could point me to the right direction. Do you have any >> >> >> > recommendation >> >> >> > for HTTP/2 client library? How do you work around the alpn boot >> >> >> > jar? >> >> >> > Is >> >> >> > the >> >> >> > same solution can be used by okhttp, jetty and netty before Java 9 >> >> >> > is >> >> >> > released? >> >> >> > >> >> >> > >> >> >> > >> >> >> > On Fri, Mar 17, 2017 at 11:03 PM, Stuart Douglas >> >> >> > >> >> >> > wrote: >> >> >> >> >> >> >> >> No, that is a debug level message. The JDK8 ALPN provider should >> >> >> >> still >> >> >> >> be registered. >> >> >> >> >> >> >> >> Stuart >> >> >> >> >> >> >> >> On Sat, Mar 18, 2017 at 12:18 PM, Steve Hu >> >> >> >> wrote: >> >> >> >> > Hi, >> >> >> >> > >> >> >> >> > I searched this mailing list and one post mentioned that I >> >> >> >> > don't >> >> >> >> > need >> >> >> >> > to >> >> >> >> > use >> >> >> >> > -Xbootclasspath/p: after 1.4.0Final. I >> >> >> >> > am >> >> >> >> > trying >> >> >> >> > HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but when I >> >> >> >> > start >> >> >> >> > the >> >> >> >> > server I got the following error. Do I have to use OpenJDK 8? >> >> >> >> > If I >> >> >> >> > switch to >> >> >> >> > JBoss OpenSSL implementation? >> >> >> >> > >> >> >> >> > Thanks, >> >> >> >> > >> >> >> >> > Steve >> >> >> >> > >> >> >> >> > 21:00:36.468 [main] DEBUG io.undertow - Configuring listener >> >> >> >> > with >> >> >> >> > protocol >> >> >> >> > HTTPS for interface 0.0.0.0 and port 8843 >> >> >> >> > >> >> >> >> > 21:00:36.486 [main] DEBUG io.undertow - JDK9 ALPN not >> >> >> >> > supported >> >> >> >> > >> >> >> >> > java.lang.NoSuchMethodException: >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > javax.net.ssl.SSLParameters.setApplicationProtocols([Ljava.lang.String;) >> >> >> >> > >> >> >> >> > at java.lang.Class.getMethod(Class.java:1786) >> >> >> >> > >> >> >> >> > at >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:47) >> >> >> >> > >> >> >> >> > at >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:43) >> >> >> >> > >> >> >> >> > at java.security.AccessController.doPrivileged(Native Method) >> >> >> >> > >> >> >> >> > at >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider.(JDK9AlpnProvider.java:43) >> >> >> >> > >> >> >> >> > at >> >> >> >> > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native >> >> >> >> > Method) >> >> >> >> > >> >> >> >> > at >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) >> >> >> >> > >> >> >> >> > at >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >> >> >> >> > >> >> >> >> > at >> >> >> >> > java.lang.reflect.Constructor.newInstance(Constructor.java:423) >> >> >> >> > >> >> >> >> > at java.lang.Class.newInstance(Class.java:442) >> >> >> >> > >> >> >> >> > at >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380) >> >> >> >> > >> >> >> >> > at >> >> >> >> > >> >> >> >> > java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) >> >> >> >> > >> >> >> >> > at java.util.ServiceLoader$1.next(ServiceLoader.java:480) >> >> >> >> > >> >> >> >> > at >> >> >> >> > >> >> >> >> > io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:40) >> >> >> >> > >> >> >> >> > at >> >> >> >> > >> >> >> >> > >> >> >> >> > io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:35) >> >> >> >> > >> >> >> >> > at >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.(AlpnOpenListener.java:67) >> >> >> >> > >> >> >> >> > at >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.(AlpnOpenListener.java:90) >> >> >> >> > >> >> >> >> > at io.undertow.Undertow.start(Undertow.java:179) >> >> >> >> > >> >> >> >> > at com.networknt.server.Server.start(Server.java:170) >> >> >> >> > >> >> >> >> > at com.networknt.server.Server.main(Server.java:90) >> >> >> >> > >> >> >> >> > 21:00:36.503 [main] INFO com.networknt.server.Server - Https >> >> >> >> > Server >> >> >> >> > started on ip:0.0.0.0 Port:8843 >> >> >> >> > >> >> >> >> > >> >> >> >> > _______________________________________________ >> >> >> >> > undertow-dev mailing list >> >> >> >> > undertow-dev at lists.jboss.org >> >> >> >> > https://lists.jboss.org/mailman/listinfo/undertow-dev >> >> >> > >> >> >> > >> >> > >> >> > >> > >> > > > From stevehu at gmail.com Wed Mar 22 17:53:15 2017 From: stevehu at gmail.com (Steve Hu) Date: Wed, 22 Mar 2017 17:53:15 -0400 Subject: [undertow-dev] Enable HTTP/2 and get JDK9 ALPN not supported In-Reply-To: References: Message-ID: It works. Thanks a lot for your help. I will add two more http/2 post test cases and give you a pull request. On Wed, Mar 22, 2017 at 5:01 PM, Stuart Douglas wrote: > The issue is that it is reporting the wrong protocol in the response, > I have fixed this upstream. > > Stuart > > On Thu, Mar 23, 2017 at 1:31 AM, Steve Hu wrote: > > Hi Stuart, > > > > Thanks for the upgrade handler fix. I can clearly see the handler is > > registered and handleRequest is called in a debug session. I also > replaced > > EMPTY option with OptionMap.create(UndertowOptions.ENABLE_HTTP2, true) > when > > opening client connection. The response protocol is still HTTP/1.1 for > both > > http and https requests. The following is the output from the console and > > the syched/updated source code can be found > > https://github.com/stevehu/undertow/blob/master/core/src/ > test/java/io/undertow/client/http/Http2ClientTestCase.java > > > > 10:16:43,804 INFO (main) [org.xnio] XNIO version > 3.3.6.Final > > 10:16:43,829 INFO (main) [org.xnio.nio] XNIO NIO > > Implementation Version 3.3.6.Final > > 10:17:42,980 DEBUG (main) [io.undertow.request.io] > > > Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7778 > local > > /127.0.0.1:64696[ No Receiver [] -- [] -- []]: > > java.nio.channels.ClosedChannelException > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:753) > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > > at > > io.undertow.client.http2.Http2ClientConnection.close( > Http2ClientConnection.java:312) > > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > > at > > io.undertow.client.http.Http2ClientTestCase.testHttpsConnectionClose( > Http2ClientTestCase.java:245) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > HTTP/1.1 > > at > > sun.reflect.NativeMethodAccessorImpl.invoke( > NativeMethodAccessorImpl.java:62) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke( > DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:498) > > at > > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall( > FrameworkMethod.java:50) > > at > > org.junit.internal.runners.model.ReflectiveCallable.run( > ReflectiveCallable.java:12) > > at > > org.junit.runners.model.FrameworkMethod.invokeExplosively( > FrameworkMethod.java:47) > > at > > org.junit.internal.runners.statements.InvokeMethod. > evaluate(InvokeMethod.java:17) > > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) > > at > > org.junit.runners.BlockJUnit4ClassRunner.runChild( > BlockJUnit4ClassRunner.java:78) > > at > > org.junit.runners.BlockJUnit4ClassRunner.runChild( > BlockJUnit4ClassRunner.java:57) > > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > > at > > org.junit.internal.runners.statements.RunBefores. > evaluate(RunBefores.java:26) > > at > > org.junit.internal.runners.statements.RunAfters.evaluate( > RunAfters.java:27) > > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > > at org.junit.runner.JUnitCore.run(JUnitCore.java:137) > > at > > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs( > JUnit4IdeaTestRunner.java:117) > > at > > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs( > JUnit4IdeaTestRunner.java:42) > > at > > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart( > JUnitStarter.java:262) > > at com.intellij.rt.execution.junit.JUnitStarter.main( > JUnitStarter.java:84) > > > > 10:17:42,986 DEBUG (Client I/O-7) [io.undertow.request.io] > > Channel Http2Channel peer > > localhost/127.0.0.1:7778 local /127.0.0.1:64696[ No Receiver [] -- [] > -- []] > > is being closed: java.nio.channels.ClosedChannelException > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel. > close(AbstractFramedChannel.java:791) > > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > > at > > io.undertow.protocols.http2.Http2Channel$3.handleEvent( > Http2Channel.java:762) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:421) > > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:409) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > io.undertow.server.protocol.framed.AbstractFramedStreamSinkChanne > l$1.run(AbstractFramedStreamSinkChannel.java:212) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > 3.run(AbstractFramedChannel.java:231) > > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) > > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) > > > > 10:17:42,986 DEBUG (XNIO-1 I/O-7) [io.undertow.request.io] > > Sending goaway on channel Http2Channel peer > > /127.0.0.1:64696 local /127.0.0.1:7778[ No Receiver [] -- [] -- []]: > > java.nio.channels.ClosedChannelException > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:753) > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > > at > > io.undertow.protocols.http2.Http2Channel.createChannelImpl( > Http2Channel.java:478) > > at > > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:317) > > at > > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:65) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel. > receive(AbstractFramedChannel.java:452) > > at > > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:106) > > at > > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:57) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler. > readReady(ReadReadyHandler.java:66) > > at > > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady( > SslConduit.java:1129) > > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) > > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > > > > 10:17:42,988 DEBUG (XNIO-1 I/O-7) [io.undertow.request.io] > > Channel Http2Channel peer / > 127.0.0.1:64696 > > local /127.0.0.1:7778[ No Receiver [] -- [] -- []] is being closed: > > java.nio.channels.ClosedChannelException > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel. > close(AbstractFramedChannel.java:791) > > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:767) > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > > at > > io.undertow.protocols.http2.Http2Channel.createChannelImpl( > Http2Channel.java:478) > > at > > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:317) > > at > > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:65) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel. > receive(AbstractFramedChannel.java:452) > > at > > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:106) > > at > > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:57) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler. > readReady(ReadReadyHandler.java:66) > > at > > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady( > SslConduit.java:1129) > > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) > > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > > > > 10:17:43,001 DEBUG (Client I/O-7) [io.undertow.request.io] > > UT005013: An IOException occurred: > > java.nio.channels.ClosedChannelException > > at > > io.undertow.client.http2.Http2ClientConnection$Http2ReceiveListener. > handleEvent(Http2ClientConnection.java:452) > > at > > io.undertow.client.http2.Http2ClientConnection$Http2ReceiveListener. > handleEvent(Http2ClientConnection.java:366) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler. > readReady(ReadReadyHandler.java:66) > > at > > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady( > SslConduit.java:1129) > > at io.undertow.protocols.ssl.SslConduit$1.run(SslConduit.java:168) > > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) > > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) > > > > HTTP/1.1 > > 10:20:14,473 DEBUG (main) [io.undertow.request.io] > > > Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7777 > local > > /127.0.0.1:64697[ No Receiver [] -- [] -- []]: > > java.nio.channels.ClosedChannelException > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:753) > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > > > > at > > io.undertow.client.http2.Http2ClientConnection.close( > Http2ClientConnection.java:312) > > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > > at > > io.undertow.client.http.Http2ClientTestCase.testHttpConnectionClose( > Http2ClientTestCase.java:220) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > > sun.reflect.NativeMethodAccessorImpl.invoke( > NativeMethodAccessorImpl.java:62) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke( > DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:498) > > at > > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall( > FrameworkMethod.java:50) > > at > > org.junit.internal.runners.model.ReflectiveCallable.run( > ReflectiveCallable.java:12) > > at > > org.junit.runners.model.FrameworkMethod.invokeExplosively( > FrameworkMethod.java:47) > > at > > org.junit.internal.runners.statements.InvokeMethod. > evaluate(InvokeMethod.java:17) > > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) > > at > > org.junit.runners.BlockJUnit4ClassRunner.runChild( > BlockJUnit4ClassRunner.java:78) > > at > > org.junit.runners.BlockJUnit4ClassRunner.runChild( > BlockJUnit4ClassRunner.java:57) > > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > > at > > org.junit.internal.runners.statements.RunBefores. > evaluate(RunBefores.java:26) > > at > > org.junit.internal.runners.statements.RunAfters.evaluate( > RunAfters.java:27) > > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > > at org.junit.runner.JUnitCore.run(JUnitCore.java:137) > > at > > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs( > JUnit4IdeaTestRunner.java:117) > > at > > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs( > JUnit4IdeaTestRunner.java:42) > > at > > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart( > JUnitStarter.java:262) > > at com.intellij.rt.execution.junit.JUnitStarter.main( > JUnitStarter.java:84) > > > > 10:20:14,474 DEBUG (Client I/O-4) [io.undertow.request.io] > > Channel Http2Channel peer > > localhost/127.0.0.1:7777 local /127.0.0.1:64697[ No Receiver [] -- [] > -- []] > > is being closed: java.nio.channels.ClosedChannelException > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel. > close(AbstractFramedChannel.java:791) > > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > > at > > io.undertow.protocols.http2.Http2Channel$3.handleEvent( > Http2Channel.java:762) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:421) > > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:409) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at org.xnio.ChannelListeners$4.run(ChannelListeners.java:147) > > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) > > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) > > > > 10:20:14,474 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] > > Sending goaway on channel Http2Channel peer > > /127.0.0.1:64697 local /127.0.0.1:7777[ No Receiver [] -- [] -- []]: > > java.nio.channels.ClosedChannelException > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:753) > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > > at > > io.undertow.protocols.http2.Http2Channel.createChannelImpl( > Http2Channel.java:478) > > at > > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:317) > > at > > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:65) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel. > receive(AbstractFramedChannel.java:452) > > at > > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:106) > > at > > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:57) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler. > readReady(ReadReadyHandler.java:66) > > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) > > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > > > > 10:20:14,476 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] > > Channel Http2Channel peer / > 127.0.0.1:64697 > > local /127.0.0.1:7777[ No Receiver [] -- [] -- []] is being closed: > > java.nio.channels.ClosedChannelException > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel. > close(AbstractFramedChannel.java:791) > > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:767) > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > > at > > io.undertow.protocols.http2.Http2Channel.createChannelImpl( > Http2Channel.java:478) > > at > > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:317) > > at > > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:65) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel. > receive(AbstractFramedChannel.java:452) > > at > > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:106) > > at > > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:57) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler. > readReady(ReadReadyHandler.java:66) > > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) > > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > > > > > > On Tue, Mar 21, 2017 at 11:39 PM, Stuart Douglas > > wrote: > >> > >> On Wed, Mar 22, 2017 at 12:50 PM, Steve Hu wrote: > >> > Hi Stuart, > >> > > >> > I debugged into the ALPN code and found some issues with Http2Client. > >> > > >> > I started with the Http2Server example and found > >> > LoadBalancingProxyClient is > >> > using an instance of UndertowClient which can only load HTTP1.1 > >> > ClientProviders. The following is the code to get ClientProvider and > >> > only > >> > "http" or "https" can be the return from uri.getSchema(). > >> > > >> > ClientProvider provider = clientProviders.get(uri.getScheme()); > >> > > >> > If this is true, then the communication between the proxy and Http/2 > >> > server > >> > is Http/1.1 > >> > >> You need to pass in the ENABLE_HTTP2 option in the OptionsMap. For > >> http URI's this means that the client will attempt an upgrade on the > >> first request, for https URI's ALPN will be used to try and negotiate > >> HTTP/2. This is how browsers behave, and will work even if the target > >> does not support HTTP/2. > >> > >> One thing I did notice that I fixed upstream was that the Undertow > >> builder was not registering a HTTP2UpgradeHandler when HTTP/2 was > >> enabled, which has been fixed. > >> > >> > > >> > In addition, I have created a new class UndertowHttp2Client and > >> > Http2ClientTestCase in my forked repo to try > >> > > >> > the Http2ClientProviders and found all three http2 client providers > >> > don't > >> > work as expected. > >> > > >> > h2c and h2-prior got 200 response code back during handshake and h2 > >> > works > >> > but the connection is still http 1.1 > >> > >> I think this was probably caused by the lack of the upgrade handler > >> (well for h2c, h2c-prior should still work). > >> > >> Stuart > >> > >> > > >> > I am debugging the ALPN code now but it is very slow as I have to dig > >> > into > >> > the spec to learn how the handshake works. > >> > > >> > As you have resolved the ALPN boot jar issue with the hack, I think > >> > Undertow > >> > is very usable for HTTP/2 and it would > >> > > >> > be perfect if the client is working as well. Could you please confirm > my > >> > findings and let me know direction I should > >> > > >> > focus on? > >> > >> > >> > > >> > > >> > Thanks, > >> > > >> > > >> > Steve > >> > > >> > > >> > Here is my repo with UndertowHttp2Client and Test. > >> > > >> > https://github.com/stevehu/undertow > >> > > >> > > >> > And here is the files I have added. > >> > > >> > > >> > https://github.com/stevehu/undertow/blob/master/core/src/ > main/java/io/undertow/client/UndertowHttp2Client.java > >> > > >> > > >> > https://github.com/stevehu/undertow/blob/master/core/src/ > test/java/io/undertow/client/http/Http2ClientTestCase.java > >> > > >> > > >> > > >> > > >> > > >> > > >> > On Sun, Mar 19, 2017 at 8:23 PM, Stuart Douglas > >> > wrote: > >> >> > >> >> I don't really have time to do it (there is no real benefit for > >> >> Undertow, so it is not high on my priority list), but the code is all > >> >> Apache licensed so there is no reason why you can't start a project > >> >> that provides this code as a standalone implementation. > >> >> > >> >> You would still need to implement code in Netty etc to actually use > >> >> this as well, as there is no standardized ALPN API yet. > >> >> > >> >> Stuart > >> >> > >> >> On Mon, Mar 20, 2017 at 11:07 AM, Steve Hu > wrote: > >> >> > I am reading the code in client package and they look really good. > As > >> >> > currently none of the http/2 client library has a work around on > alpn > >> >> > boot > >> >> > jar and this blocks majority of developers to move to http/2. I am > >> >> > wondering > >> >> > if you want to split client package to a standalone client module > so > >> >> > that it > >> >> > can be used by other developers to connect to servers that > implement > >> >> > http/2. > >> >> > If you are interested in it, I can help to create a pull request > and > >> >> > add > >> >> > some test cases while I am working on my own client implementation. > >> >> > Thanks. > >> >> > > >> >> > On Sun, Mar 19, 2017 at 5:32 PM, Stuart Douglas < > sdouglas at redhat.com> > >> >> > wrote: > >> >> >> > >> >> >> You could use Undertow's HTTP/2 client, although it's API was > >> >> >> designed > >> >> >> around the reverse proxy use case and as a result is not ideal for > >> >> >> the > >> >> >> general purpose HTTP client use case (although it is still > perfectly > >> >> >> usable). > >> >> >> > >> >> >> In terms of using Undertow's ALPN implementation with Netty etc it > >> >> >> would require someone to port it over. The code is at [1] if you > are > >> >> >> interested. > >> >> >> > >> >> >> Stuart > >> >> >> > >> >> >> [1] > >> >> >> > >> >> >> > >> >> >> https://github.com/undertow-io/undertow/blob/master/core/ > src/main/java/io/undertow/protocols/ssl/ALPNHackSSLEngine.java > >> >> >> > >> >> >> On Mon, Mar 20, 2017 at 7:21 AM, Steve Hu > wrote: > >> >> >> > Thanks Stuart for the quick response. Now I have server started > >> >> >> > with > >> >> >> > HTTP/2 > >> >> >> > and it works perfect with some client tools. Now I am looking > for > >> >> >> > Java > >> >> >> > HTTP/2 client libraries to update my client module to support > >> >> >> > HTTP/2 > >> >> >> > protocol for microservices communication. There are three major > >> >> >> > libraries > >> >> >> > okhttp, jetty and netty but all of them require Jetty's ALPN > boot > >> >> >> > JAR. I > >> >> >> > saw > >> >> >> > you have resolved the boot jar dependency in Undertow and am > >> >> >> > wondering > >> >> >> > if > >> >> >> > you could point me to the right direction. Do you have any > >> >> >> > recommendation > >> >> >> > for HTTP/2 client library? How do you work around the alpn boot > >> >> >> > jar? > >> >> >> > Is > >> >> >> > the > >> >> >> > same solution can be used by okhttp, jetty and netty before > Java 9 > >> >> >> > is > >> >> >> > released? > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > On Fri, Mar 17, 2017 at 11:03 PM, Stuart Douglas > >> >> >> > > >> >> >> > wrote: > >> >> >> >> > >> >> >> >> No, that is a debug level message. The JDK8 ALPN provider > should > >> >> >> >> still > >> >> >> >> be registered. > >> >> >> >> > >> >> >> >> Stuart > >> >> >> >> > >> >> >> >> On Sat, Mar 18, 2017 at 12:18 PM, Steve Hu > >> >> >> >> wrote: > >> >> >> >> > Hi, > >> >> >> >> > > >> >> >> >> > I searched this mailing list and one post mentioned that I > >> >> >> >> > don't > >> >> >> >> > need > >> >> >> >> > to > >> >> >> >> > use > >> >> >> >> > -Xbootclasspath/p: after 1.4.0Final. > I > >> >> >> >> > am > >> >> >> >> > trying > >> >> >> >> > HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but when I > >> >> >> >> > start > >> >> >> >> > the > >> >> >> >> > server I got the following error. Do I have to use OpenJDK 8? > >> >> >> >> > If I > >> >> >> >> > switch to > >> >> >> >> > JBoss OpenSSL implementation? > >> >> >> >> > > >> >> >> >> > Thanks, > >> >> >> >> > > >> >> >> >> > Steve > >> >> >> >> > > >> >> >> >> > 21:00:36.468 [main] DEBUG io.undertow - Configuring listener > >> >> >> >> > with > >> >> >> >> > protocol > >> >> >> >> > HTTPS for interface 0.0.0.0 and port 8843 > >> >> >> >> > > >> >> >> >> > 21:00:36.486 [main] DEBUG io.undertow - JDK9 ALPN not > >> >> >> >> > supported > >> >> >> >> > > >> >> >> >> > java.lang.NoSuchMethodException: > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > javax.net.ssl.SSLParameters.setApplicationProtocols([ > Ljava.lang.String;) > >> >> >> >> > > >> >> >> >> > at java.lang.Class.getMethod(Class.java:1786) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run( > JDK9AlpnProvider.java:47) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run( > JDK9AlpnProvider.java:43) > >> >> >> >> > > >> >> >> >> > at java.security.AccessController.doPrivileged(Native > Method) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider.( > JDK9AlpnProvider.java:43) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > sun.reflect.NativeConstructorAccessorImpl. > newInstance0(Native > >> >> >> >> > Method) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > sun.reflect.NativeConstructorAccessorImpl.newInstance( > NativeConstructorAccessorImpl.java:62) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance( > DelegatingConstructorAccessorImpl.java:45) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > java.lang.reflect.Constructor.newInstance(Constructor.java: > 423) > >> >> >> >> > > >> >> >> >> > at java.lang.Class.newInstance(Class.java:442) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > java.util.ServiceLoader$LazyIterator.nextService( > ServiceLoader.java:380) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > java.util.ServiceLoader$LazyIterator.next( > ServiceLoader.java:404) > >> >> >> >> > > >> >> >> >> > at java.util.ServiceLoader$1.next(ServiceLoader.java:480) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > io.undertow.protocols.alpn.ALPNManager.( > ALPNManager.java:40) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > io.undertow.protocols.alpn.ALPNManager.( > ALPNManager.java:35) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.( > AlpnOpenListener.java:67) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.( > AlpnOpenListener.java:90) > >> >> >> >> > > >> >> >> >> > at io.undertow.Undertow.start(Undertow.java:179) > >> >> >> >> > > >> >> >> >> > at com.networknt.server.Server.start(Server.java:170) > >> >> >> >> > > >> >> >> >> > at com.networknt.server.Server.main(Server.java:90) > >> >> >> >> > > >> >> >> >> > 21:00:36.503 [main] INFO com.networknt.server.Server - > Https > >> >> >> >> > Server > >> >> >> >> > started on ip:0.0.0.0 Port:8843 > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > _______________________________________________ > >> >> >> >> > undertow-dev mailing list > >> >> >> >> > undertow-dev at lists.jboss.org > >> >> >> >> > https://lists.jboss.org/mailman/listinfo/undertow-dev > >> >> >> > > >> >> >> > > >> >> > > >> >> > > >> > > >> > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170322/b97e65e1/attachment-0001.html From stevehu at gmail.com Wed Mar 22 20:07:57 2017 From: stevehu at gmail.com (Steve Hu) Date: Wed, 22 Mar 2017 20:07:57 -0400 Subject: [undertow-dev] Enable HTTP/2 and get JDK9 ALPN not supported In-Reply-To: References: Message-ID: Hi Stuart, I am trying to find an example or test case that uses http post for HttpClient but couldn't find anything. The only information is the comment of ClientRequest. Could you please provide an example on how to push body in a post ClientRequest? Thanks, Steve * This class only represents the HTTP header, it does not represent an entity body. If the request needs an entity * body then this must be specified by either setting a Content-Length or Transfer-Encoding header, otherwise * the client will assume that the body is empty. On Wed, Mar 22, 2017 at 5:01 PM, Stuart Douglas wrote: > The issue is that it is reporting the wrong protocol in the response, > I have fixed this upstream. > > Stuart > > On Thu, Mar 23, 2017 at 1:31 AM, Steve Hu wrote: > > Hi Stuart, > > > > Thanks for the upgrade handler fix. I can clearly see the handler is > > registered and handleRequest is called in a debug session. I also > replaced > > EMPTY option with OptionMap.create(UndertowOptions.ENABLE_HTTP2, true) > when > > opening client connection. The response protocol is still HTTP/1.1 for > both > > http and https requests. The following is the output from the console and > > the syched/updated source code can be found > > https://github.com/stevehu/undertow/blob/master/core/src/ > test/java/io/undertow/client/http/Http2ClientTestCase.java > > > > 10:16:43,804 INFO (main) [org.xnio] XNIO version > 3.3.6.Final > > 10:16:43,829 INFO (main) [org.xnio.nio] XNIO NIO > > Implementation Version 3.3.6.Final > > 10:17:42,980 DEBUG (main) [io.undertow.request.io] > > > Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7778 > local > > /127.0.0.1:64696[ No Receiver [] -- [] -- []]: > > java.nio.channels.ClosedChannelException > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:753) > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > > at > > io.undertow.client.http2.Http2ClientConnection.close( > Http2ClientConnection.java:312) > > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > > at > > io.undertow.client.http.Http2ClientTestCase.testHttpsConnectionClose( > Http2ClientTestCase.java:245) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > HTTP/1.1 > > at > > sun.reflect.NativeMethodAccessorImpl.invoke( > NativeMethodAccessorImpl.java:62) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke( > DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:498) > > at > > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall( > FrameworkMethod.java:50) > > at > > org.junit.internal.runners.model.ReflectiveCallable.run( > ReflectiveCallable.java:12) > > at > > org.junit.runners.model.FrameworkMethod.invokeExplosively( > FrameworkMethod.java:47) > > at > > org.junit.internal.runners.statements.InvokeMethod. > evaluate(InvokeMethod.java:17) > > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) > > at > > org.junit.runners.BlockJUnit4ClassRunner.runChild( > BlockJUnit4ClassRunner.java:78) > > at > > org.junit.runners.BlockJUnit4ClassRunner.runChild( > BlockJUnit4ClassRunner.java:57) > > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > > at > > org.junit.internal.runners.statements.RunBefores. > evaluate(RunBefores.java:26) > > at > > org.junit.internal.runners.statements.RunAfters.evaluate( > RunAfters.java:27) > > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > > at org.junit.runner.JUnitCore.run(JUnitCore.java:137) > > at > > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs( > JUnit4IdeaTestRunner.java:117) > > at > > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs( > JUnit4IdeaTestRunner.java:42) > > at > > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart( > JUnitStarter.java:262) > > at com.intellij.rt.execution.junit.JUnitStarter.main( > JUnitStarter.java:84) > > > > 10:17:42,986 DEBUG (Client I/O-7) [io.undertow.request.io] > > Channel Http2Channel peer > > localhost/127.0.0.1:7778 local /127.0.0.1:64696[ No Receiver [] -- [] > -- []] > > is being closed: java.nio.channels.ClosedChannelException > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel. > close(AbstractFramedChannel.java:791) > > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > > at > > io.undertow.protocols.http2.Http2Channel$3.handleEvent( > Http2Channel.java:762) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:421) > > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:409) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > io.undertow.server.protocol.framed.AbstractFramedStreamSinkChanne > l$1.run(AbstractFramedStreamSinkChannel.java:212) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > 3.run(AbstractFramedChannel.java:231) > > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) > > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) > > > > 10:17:42,986 DEBUG (XNIO-1 I/O-7) [io.undertow.request.io] > > Sending goaway on channel Http2Channel peer > > /127.0.0.1:64696 local /127.0.0.1:7778[ No Receiver [] -- [] -- []]: > > java.nio.channels.ClosedChannelException > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:753) > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > > at > > io.undertow.protocols.http2.Http2Channel.createChannelImpl( > Http2Channel.java:478) > > at > > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:317) > > at > > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:65) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel. > receive(AbstractFramedChannel.java:452) > > at > > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:106) > > at > > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:57) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler. > readReady(ReadReadyHandler.java:66) > > at > > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady( > SslConduit.java:1129) > > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) > > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > > > > 10:17:42,988 DEBUG (XNIO-1 I/O-7) [io.undertow.request.io] > > Channel Http2Channel peer / > 127.0.0.1:64696 > > local /127.0.0.1:7778[ No Receiver [] -- [] -- []] is being closed: > > java.nio.channels.ClosedChannelException > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel. > close(AbstractFramedChannel.java:791) > > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:767) > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > > at > > io.undertow.protocols.http2.Http2Channel.createChannelImpl( > Http2Channel.java:478) > > at > > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:317) > > at > > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:65) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel. > receive(AbstractFramedChannel.java:452) > > at > > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:106) > > at > > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:57) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler. > readReady(ReadReadyHandler.java:66) > > at > > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady( > SslConduit.java:1129) > > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) > > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > > > > 10:17:43,001 DEBUG (Client I/O-7) [io.undertow.request.io] > > UT005013: An IOException occurred: > > java.nio.channels.ClosedChannelException > > at > > io.undertow.client.http2.Http2ClientConnection$Http2ReceiveListener. > handleEvent(Http2ClientConnection.java:452) > > at > > io.undertow.client.http2.Http2ClientConnection$Http2ReceiveListener. > handleEvent(Http2ClientConnection.java:366) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler. > readReady(ReadReadyHandler.java:66) > > at > > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady( > SslConduit.java:1129) > > at io.undertow.protocols.ssl.SslConduit$1.run(SslConduit.java:168) > > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) > > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) > > > > HTTP/1.1 > > 10:20:14,473 DEBUG (main) [io.undertow.request.io] > > > Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7777 > local > > /127.0.0.1:64697[ No Receiver [] -- [] -- []]: > > java.nio.channels.ClosedChannelException > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:753) > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > > > > at > > io.undertow.client.http2.Http2ClientConnection.close( > Http2ClientConnection.java:312) > > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > > at > > io.undertow.client.http.Http2ClientTestCase.testHttpConnectionClose( > Http2ClientTestCase.java:220) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > > sun.reflect.NativeMethodAccessorImpl.invoke( > NativeMethodAccessorImpl.java:62) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke( > DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:498) > > at > > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall( > FrameworkMethod.java:50) > > at > > org.junit.internal.runners.model.ReflectiveCallable.run( > ReflectiveCallable.java:12) > > at > > org.junit.runners.model.FrameworkMethod.invokeExplosively( > FrameworkMethod.java:47) > > at > > org.junit.internal.runners.statements.InvokeMethod. > evaluate(InvokeMethod.java:17) > > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) > > at > > org.junit.runners.BlockJUnit4ClassRunner.runChild( > BlockJUnit4ClassRunner.java:78) > > at > > org.junit.runners.BlockJUnit4ClassRunner.runChild( > BlockJUnit4ClassRunner.java:57) > > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > > at > > org.junit.internal.runners.statements.RunBefores. > evaluate(RunBefores.java:26) > > at > > org.junit.internal.runners.statements.RunAfters.evaluate( > RunAfters.java:27) > > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > > at org.junit.runner.JUnitCore.run(JUnitCore.java:137) > > at > > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs( > JUnit4IdeaTestRunner.java:117) > > at > > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs( > JUnit4IdeaTestRunner.java:42) > > at > > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart( > JUnitStarter.java:262) > > at com.intellij.rt.execution.junit.JUnitStarter.main( > JUnitStarter.java:84) > > > > 10:20:14,474 DEBUG (Client I/O-4) [io.undertow.request.io] > > Channel Http2Channel peer > > localhost/127.0.0.1:7777 local /127.0.0.1:64697[ No Receiver [] -- [] > -- []] > > is being closed: java.nio.channels.ClosedChannelException > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel. > close(AbstractFramedChannel.java:791) > > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > > at > > io.undertow.protocols.http2.Http2Channel$3.handleEvent( > Http2Channel.java:762) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:421) > > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:409) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at org.xnio.ChannelListeners$4.run(ChannelListeners.java:147) > > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) > > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) > > > > 10:20:14,474 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] > > Sending goaway on channel Http2Channel peer > > /127.0.0.1:64697 local /127.0.0.1:7777[ No Receiver [] -- [] -- []]: > > java.nio.channels.ClosedChannelException > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:753) > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > > at > > io.undertow.protocols.http2.Http2Channel.createChannelImpl( > Http2Channel.java:478) > > at > > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:317) > > at > > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:65) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel. > receive(AbstractFramedChannel.java:452) > > at > > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:106) > > at > > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:57) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler. > readReady(ReadReadyHandler.java:66) > > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) > > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > > > > 10:20:14,476 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] > > Channel Http2Channel peer / > 127.0.0.1:64697 > > local /127.0.0.1:7777[ No Receiver [] -- [] -- []] is being closed: > > java.nio.channels.ClosedChannelException > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel. > close(AbstractFramedChannel.java:791) > > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:767) > > at > > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > > at > > io.undertow.protocols.http2.Http2Channel.createChannelImpl( > Http2Channel.java:478) > > at > > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:317) > > at > > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:65) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel. > receive(AbstractFramedChannel.java:452) > > at > > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:106) > > at > > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:57) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > > at > > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > > at org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > > at > > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler. > readReady(ReadReadyHandler.java:66) > > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) > > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > > > > > > On Tue, Mar 21, 2017 at 11:39 PM, Stuart Douglas > > wrote: > >> > >> On Wed, Mar 22, 2017 at 12:50 PM, Steve Hu wrote: > >> > Hi Stuart, > >> > > >> > I debugged into the ALPN code and found some issues with Http2Client. > >> > > >> > I started with the Http2Server example and found > >> > LoadBalancingProxyClient is > >> > using an instance of UndertowClient which can only load HTTP1.1 > >> > ClientProviders. The following is the code to get ClientProvider and > >> > only > >> > "http" or "https" can be the return from uri.getSchema(). > >> > > >> > ClientProvider provider = clientProviders.get(uri.getScheme()); > >> > > >> > If this is true, then the communication between the proxy and Http/2 > >> > server > >> > is Http/1.1 > >> > >> You need to pass in the ENABLE_HTTP2 option in the OptionsMap. For > >> http URI's this means that the client will attempt an upgrade on the > >> first request, for https URI's ALPN will be used to try and negotiate > >> HTTP/2. This is how browsers behave, and will work even if the target > >> does not support HTTP/2. > >> > >> One thing I did notice that I fixed upstream was that the Undertow > >> builder was not registering a HTTP2UpgradeHandler when HTTP/2 was > >> enabled, which has been fixed. > >> > >> > > >> > In addition, I have created a new class UndertowHttp2Client and > >> > Http2ClientTestCase in my forked repo to try > >> > > >> > the Http2ClientProviders and found all three http2 client providers > >> > don't > >> > work as expected. > >> > > >> > h2c and h2-prior got 200 response code back during handshake and h2 > >> > works > >> > but the connection is still http 1.1 > >> > >> I think this was probably caused by the lack of the upgrade handler > >> (well for h2c, h2c-prior should still work). > >> > >> Stuart > >> > >> > > >> > I am debugging the ALPN code now but it is very slow as I have to dig > >> > into > >> > the spec to learn how the handshake works. > >> > > >> > As you have resolved the ALPN boot jar issue with the hack, I think > >> > Undertow > >> > is very usable for HTTP/2 and it would > >> > > >> > be perfect if the client is working as well. Could you please confirm > my > >> > findings and let me know direction I should > >> > > >> > focus on? > >> > >> > >> > > >> > > >> > Thanks, > >> > > >> > > >> > Steve > >> > > >> > > >> > Here is my repo with UndertowHttp2Client and Test. > >> > > >> > https://github.com/stevehu/undertow > >> > > >> > > >> > And here is the files I have added. > >> > > >> > > >> > https://github.com/stevehu/undertow/blob/master/core/src/ > main/java/io/undertow/client/UndertowHttp2Client.java > >> > > >> > > >> > https://github.com/stevehu/undertow/blob/master/core/src/ > test/java/io/undertow/client/http/Http2ClientTestCase.java > >> > > >> > > >> > > >> > > >> > > >> > > >> > On Sun, Mar 19, 2017 at 8:23 PM, Stuart Douglas > >> > wrote: > >> >> > >> >> I don't really have time to do it (there is no real benefit for > >> >> Undertow, so it is not high on my priority list), but the code is all > >> >> Apache licensed so there is no reason why you can't start a project > >> >> that provides this code as a standalone implementation. > >> >> > >> >> You would still need to implement code in Netty etc to actually use > >> >> this as well, as there is no standardized ALPN API yet. > >> >> > >> >> Stuart > >> >> > >> >> On Mon, Mar 20, 2017 at 11:07 AM, Steve Hu > wrote: > >> >> > I am reading the code in client package and they look really good. > As > >> >> > currently none of the http/2 client library has a work around on > alpn > >> >> > boot > >> >> > jar and this blocks majority of developers to move to http/2. I am > >> >> > wondering > >> >> > if you want to split client package to a standalone client module > so > >> >> > that it > >> >> > can be used by other developers to connect to servers that > implement > >> >> > http/2. > >> >> > If you are interested in it, I can help to create a pull request > and > >> >> > add > >> >> > some test cases while I am working on my own client implementation. > >> >> > Thanks. > >> >> > > >> >> > On Sun, Mar 19, 2017 at 5:32 PM, Stuart Douglas < > sdouglas at redhat.com> > >> >> > wrote: > >> >> >> > >> >> >> You could use Undertow's HTTP/2 client, although it's API was > >> >> >> designed > >> >> >> around the reverse proxy use case and as a result is not ideal for > >> >> >> the > >> >> >> general purpose HTTP client use case (although it is still > perfectly > >> >> >> usable). > >> >> >> > >> >> >> In terms of using Undertow's ALPN implementation with Netty etc it > >> >> >> would require someone to port it over. The code is at [1] if you > are > >> >> >> interested. > >> >> >> > >> >> >> Stuart > >> >> >> > >> >> >> [1] > >> >> >> > >> >> >> > >> >> >> https://github.com/undertow-io/undertow/blob/master/core/ > src/main/java/io/undertow/protocols/ssl/ALPNHackSSLEngine.java > >> >> >> > >> >> >> On Mon, Mar 20, 2017 at 7:21 AM, Steve Hu > wrote: > >> >> >> > Thanks Stuart for the quick response. Now I have server started > >> >> >> > with > >> >> >> > HTTP/2 > >> >> >> > and it works perfect with some client tools. Now I am looking > for > >> >> >> > Java > >> >> >> > HTTP/2 client libraries to update my client module to support > >> >> >> > HTTP/2 > >> >> >> > protocol for microservices communication. There are three major > >> >> >> > libraries > >> >> >> > okhttp, jetty and netty but all of them require Jetty's ALPN > boot > >> >> >> > JAR. I > >> >> >> > saw > >> >> >> > you have resolved the boot jar dependency in Undertow and am > >> >> >> > wondering > >> >> >> > if > >> >> >> > you could point me to the right direction. Do you have any > >> >> >> > recommendation > >> >> >> > for HTTP/2 client library? How do you work around the alpn boot > >> >> >> > jar? > >> >> >> > Is > >> >> >> > the > >> >> >> > same solution can be used by okhttp, jetty and netty before > Java 9 > >> >> >> > is > >> >> >> > released? > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > On Fri, Mar 17, 2017 at 11:03 PM, Stuart Douglas > >> >> >> > > >> >> >> > wrote: > >> >> >> >> > >> >> >> >> No, that is a debug level message. The JDK8 ALPN provider > should > >> >> >> >> still > >> >> >> >> be registered. > >> >> >> >> > >> >> >> >> Stuart > >> >> >> >> > >> >> >> >> On Sat, Mar 18, 2017 at 12:18 PM, Steve Hu > >> >> >> >> wrote: > >> >> >> >> > Hi, > >> >> >> >> > > >> >> >> >> > I searched this mailing list and one post mentioned that I > >> >> >> >> > don't > >> >> >> >> > need > >> >> >> >> > to > >> >> >> >> > use > >> >> >> >> > -Xbootclasspath/p: after 1.4.0Final. > I > >> >> >> >> > am > >> >> >> >> > trying > >> >> >> >> > HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but when I > >> >> >> >> > start > >> >> >> >> > the > >> >> >> >> > server I got the following error. Do I have to use OpenJDK 8? > >> >> >> >> > If I > >> >> >> >> > switch to > >> >> >> >> > JBoss OpenSSL implementation? > >> >> >> >> > > >> >> >> >> > Thanks, > >> >> >> >> > > >> >> >> >> > Steve > >> >> >> >> > > >> >> >> >> > 21:00:36.468 [main] DEBUG io.undertow - Configuring listener > >> >> >> >> > with > >> >> >> >> > protocol > >> >> >> >> > HTTPS for interface 0.0.0.0 and port 8843 > >> >> >> >> > > >> >> >> >> > 21:00:36.486 [main] DEBUG io.undertow - JDK9 ALPN not > >> >> >> >> > supported > >> >> >> >> > > >> >> >> >> > java.lang.NoSuchMethodException: > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > javax.net.ssl.SSLParameters.setApplicationProtocols([ > Ljava.lang.String;) > >> >> >> >> > > >> >> >> >> > at java.lang.Class.getMethod(Class.java:1786) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run( > JDK9AlpnProvider.java:47) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run( > JDK9AlpnProvider.java:43) > >> >> >> >> > > >> >> >> >> > at java.security.AccessController.doPrivileged(Native > Method) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider.( > JDK9AlpnProvider.java:43) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > sun.reflect.NativeConstructorAccessorImpl. > newInstance0(Native > >> >> >> >> > Method) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > sun.reflect.NativeConstructorAccessorImpl.newInstance( > NativeConstructorAccessorImpl.java:62) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance( > DelegatingConstructorAccessorImpl.java:45) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > java.lang.reflect.Constructor.newInstance(Constructor.java: > 423) > >> >> >> >> > > >> >> >> >> > at java.lang.Class.newInstance(Class.java:442) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > java.util.ServiceLoader$LazyIterator.nextService( > ServiceLoader.java:380) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > java.util.ServiceLoader$LazyIterator.next( > ServiceLoader.java:404) > >> >> >> >> > > >> >> >> >> > at java.util.ServiceLoader$1.next(ServiceLoader.java:480) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > io.undertow.protocols.alpn.ALPNManager.( > ALPNManager.java:40) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > io.undertow.protocols.alpn.ALPNManager.( > ALPNManager.java:35) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.( > AlpnOpenListener.java:67) > >> >> >> >> > > >> >> >> >> > at > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.( > AlpnOpenListener.java:90) > >> >> >> >> > > >> >> >> >> > at io.undertow.Undertow.start(Undertow.java:179) > >> >> >> >> > > >> >> >> >> > at com.networknt.server.Server.start(Server.java:170) > >> >> >> >> > > >> >> >> >> > at com.networknt.server.Server.main(Server.java:90) > >> >> >> >> > > >> >> >> >> > 21:00:36.503 [main] INFO com.networknt.server.Server - > Https > >> >> >> >> > Server > >> >> >> >> > started on ip:0.0.0.0 Port:8843 > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > _______________________________________________ > >> >> >> >> > undertow-dev mailing list > >> >> >> >> > undertow-dev at lists.jboss.org > >> >> >> >> > https://lists.jboss.org/mailman/listinfo/undertow-dev > >> >> >> > > >> >> >> > > >> >> > > >> >> > > >> > > >> > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170322/d980043c/attachment-0001.html From sdouglas at redhat.com Wed Mar 22 21:40:14 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Thu, 23 Mar 2017 12:40:14 +1100 Subject: [undertow-dev] Enable HTTP/2 and get JDK9 ALPN not supported In-Reply-To: References: Message-ID: I have added one: https://github.com/undertow-io/undertow/commit/20be7eb052a1efd44c8a1e6981f269344174543a#diff-f92c46f6546a565ef565e205b726ccf8R174 On Thu, Mar 23, 2017 at 11:07 AM, Steve Hu wrote: > Hi Stuart, > > I am trying to find an example or test case that uses http post for > HttpClient but couldn't find anything. The only information is the comment > of ClientRequest. Could you please provide an example on how to push body in > a post ClientRequest? > > Thanks, > > Steve > > * This class only represents the HTTP header, it does not represent an > entity body. If the request needs an entity > * body then this must be specified by either setting a Content-Length or > Transfer-Encoding header, otherwise > * the client will assume that the body is empty. > > > > On Wed, Mar 22, 2017 at 5:01 PM, Stuart Douglas wrote: >> >> The issue is that it is reporting the wrong protocol in the response, >> I have fixed this upstream. >> >> Stuart >> >> On Thu, Mar 23, 2017 at 1:31 AM, Steve Hu wrote: >> > Hi Stuart, >> > >> > Thanks for the upgrade handler fix. I can clearly see the handler is >> > registered and handleRequest is called in a debug session. I also >> > replaced >> > EMPTY option with OptionMap.create(UndertowOptions.ENABLE_HTTP2, true) >> > when >> > opening client connection. The response protocol is still HTTP/1.1 for >> > both >> > http and https requests. The following is the output from the console >> > and >> > the syched/updated source code can be found >> > >> > https://github.com/stevehu/undertow/blob/master/core/src/test/java/io/undertow/client/http/Http2ClientTestCase.java >> > >> > 10:16:43,804 INFO (main) [org.xnio] XNIO version >> > 3.3.6.Final >> > 10:16:43,829 INFO (main) [org.xnio.nio] XNIO NIO >> > Implementation Version 3.3.6.Final >> > 10:17:42,980 DEBUG (main) [io.undertow.request.io] >> > >> > Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7778 >> > local >> > /127.0.0.1:64696[ No Receiver [] -- [] -- []]: >> > java.nio.channels.ClosedChannelException >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) >> > at >> > >> > io.undertow.client.http2.Http2ClientConnection.close(Http2ClientConnection.java:312) >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) >> > at >> > >> > io.undertow.client.http.Http2ClientTestCase.testHttpsConnectionClose(Http2ClientTestCase.java:245) >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> > HTTP/1.1 >> > at >> > >> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) >> > at >> > >> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >> > at java.lang.reflect.Method.invoke(Method.java:498) >> > at >> > >> > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) >> > at >> > >> > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) >> > at >> > >> > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) >> > at >> > >> > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) >> > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) >> > at >> > >> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) >> > at >> > >> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) >> > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) >> > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) >> > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) >> > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) >> > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) >> > at >> > >> > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) >> > at >> > >> > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) >> > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) >> > at org.junit.runner.JUnitCore.run(JUnitCore.java:137) >> > at >> > >> > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) >> > at >> > >> > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) >> > at >> > >> > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) >> > at >> > com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) >> > >> > 10:17:42,986 DEBUG (Client I/O-7) [io.undertow.request.io] >> > Channel Http2Channel peer >> > localhost/127.0.0.1:7778 local /127.0.0.1:64696[ No Receiver [] -- [] -- >> > []] >> > is being closed: java.nio.channels.ClosedChannelException >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel$3.handleEvent(Http2Channel.java:762) >> > at >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:421) >> > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:409) >> > at >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel$1.run(AbstractFramedStreamSinkChannel.java:212) >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$3.run(AbstractFramedChannel.java:231) >> > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) >> > >> > 10:17:42,986 DEBUG (XNIO-1 I/O-7) [io.undertow.request.io] >> > Sending goaway on channel Http2Channel peer >> > /127.0.0.1:64696 local /127.0.0.1:7778[ No Receiver [] -- [] -- []]: >> > java.nio.channels.ClosedChannelException >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) >> > at >> > >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) >> > at >> > >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) >> > at >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) >> > at >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> > at >> > >> > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) >> > at >> > >> > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1129) >> > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) >> > >> > 10:17:42,988 DEBUG (XNIO-1 I/O-7) [io.undertow.request.io] >> > Channel Http2Channel peer >> > /127.0.0.1:64696 >> > local /127.0.0.1:7778[ No Receiver [] -- [] -- []] is being closed: >> > java.nio.channels.ClosedChannelException >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:767) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) >> > at >> > >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) >> > at >> > >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) >> > at >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) >> > at >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> > at >> > >> > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) >> > at >> > >> > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1129) >> > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) >> > >> > 10:17:43,001 DEBUG (Client I/O-7) [io.undertow.request.io] >> > UT005013: An IOException occurred: >> > java.nio.channels.ClosedChannelException >> > at >> > >> > io.undertow.client.http2.Http2ClientConnection$Http2ReceiveListener.handleEvent(Http2ClientConnection.java:452) >> > at >> > >> > io.undertow.client.http2.Http2ClientConnection$Http2ReceiveListener.handleEvent(Http2ClientConnection.java:366) >> > at >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) >> > at >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> > at >> > >> > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) >> > at >> > >> > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1129) >> > at io.undertow.protocols.ssl.SslConduit$1.run(SslConduit.java:168) >> > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) >> > >> > HTTP/1.1 >> > 10:20:14,473 DEBUG (main) [io.undertow.request.io] >> > >> > Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7777 >> > local >> > /127.0.0.1:64697[ No Receiver [] -- [] -- []]: >> > java.nio.channels.ClosedChannelException >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) >> > >> > at >> > >> > io.undertow.client.http2.Http2ClientConnection.close(Http2ClientConnection.java:312) >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) >> > at >> > >> > io.undertow.client.http.Http2ClientTestCase.testHttpConnectionClose(Http2ClientTestCase.java:220) >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> > at >> > >> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) >> > at >> > >> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >> > at java.lang.reflect.Method.invoke(Method.java:498) >> > at >> > >> > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) >> > at >> > >> > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) >> > at >> > >> > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) >> > at >> > >> > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) >> > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) >> > at >> > >> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) >> > at >> > >> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) >> > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) >> > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) >> > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) >> > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) >> > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) >> > at >> > >> > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) >> > at >> > >> > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) >> > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) >> > at org.junit.runner.JUnitCore.run(JUnitCore.java:137) >> > at >> > >> > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) >> > at >> > >> > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) >> > at >> > >> > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) >> > at >> > com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) >> > >> > 10:20:14,474 DEBUG (Client I/O-4) [io.undertow.request.io] >> > Channel Http2Channel peer >> > localhost/127.0.0.1:7777 local /127.0.0.1:64697[ No Receiver [] -- [] -- >> > []] >> > is being closed: java.nio.channels.ClosedChannelException >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel$3.handleEvent(Http2Channel.java:762) >> > at >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:421) >> > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:409) >> > at >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> > at org.xnio.ChannelListeners$4.run(ChannelListeners.java:147) >> > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) >> > >> > 10:20:14,474 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] >> > Sending goaway on channel Http2Channel peer >> > /127.0.0.1:64697 local /127.0.0.1:7777[ No Receiver [] -- [] -- []]: >> > java.nio.channels.ClosedChannelException >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) >> > at >> > >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) >> > at >> > >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) >> > at >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) >> > at >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> > at >> > >> > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) >> > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) >> > >> > 10:20:14,476 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] >> > Channel Http2Channel peer >> > /127.0.0.1:64697 >> > local /127.0.0.1:7777[ No Receiver [] -- [] -- []] is being closed: >> > java.nio.channels.ClosedChannelException >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:767) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) >> > at >> > >> > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) >> > at >> > >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) >> > at >> > >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) >> > at >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) >> > at >> > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) >> > at >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> > at >> > >> > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) >> > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) >> > >> > >> > On Tue, Mar 21, 2017 at 11:39 PM, Stuart Douglas >> > wrote: >> >> >> >> On Wed, Mar 22, 2017 at 12:50 PM, Steve Hu wrote: >> >> > Hi Stuart, >> >> > >> >> > I debugged into the ALPN code and found some issues with Http2Client. >> >> > >> >> > I started with the Http2Server example and found >> >> > LoadBalancingProxyClient is >> >> > using an instance of UndertowClient which can only load HTTP1.1 >> >> > ClientProviders. The following is the code to get ClientProvider and >> >> > only >> >> > "http" or "https" can be the return from uri.getSchema(). >> >> > >> >> > ClientProvider provider = clientProviders.get(uri.getScheme()); >> >> > >> >> > If this is true, then the communication between the proxy and Http/2 >> >> > server >> >> > is Http/1.1 >> >> >> >> You need to pass in the ENABLE_HTTP2 option in the OptionsMap. For >> >> http URI's this means that the client will attempt an upgrade on the >> >> first request, for https URI's ALPN will be used to try and negotiate >> >> HTTP/2. This is how browsers behave, and will work even if the target >> >> does not support HTTP/2. >> >> >> >> One thing I did notice that I fixed upstream was that the Undertow >> >> builder was not registering a HTTP2UpgradeHandler when HTTP/2 was >> >> enabled, which has been fixed. >> >> >> >> > >> >> > In addition, I have created a new class UndertowHttp2Client and >> >> > Http2ClientTestCase in my forked repo to try >> >> > >> >> > the Http2ClientProviders and found all three http2 client providers >> >> > don't >> >> > work as expected. >> >> > >> >> > h2c and h2-prior got 200 response code back during handshake and h2 >> >> > works >> >> > but the connection is still http 1.1 >> >> >> >> I think this was probably caused by the lack of the upgrade handler >> >> (well for h2c, h2c-prior should still work). >> >> >> >> Stuart >> >> >> >> > >> >> > I am debugging the ALPN code now but it is very slow as I have to dig >> >> > into >> >> > the spec to learn how the handshake works. >> >> > >> >> > As you have resolved the ALPN boot jar issue with the hack, I think >> >> > Undertow >> >> > is very usable for HTTP/2 and it would >> >> > >> >> > be perfect if the client is working as well. Could you please confirm >> >> > my >> >> > findings and let me know direction I should >> >> > >> >> > focus on? >> >> >> >> >> >> > >> >> > >> >> > Thanks, >> >> > >> >> > >> >> > Steve >> >> > >> >> > >> >> > Here is my repo with UndertowHttp2Client and Test. >> >> > >> >> > https://github.com/stevehu/undertow >> >> > >> >> > >> >> > And here is the files I have added. >> >> > >> >> > >> >> > >> >> > https://github.com/stevehu/undertow/blob/master/core/src/main/java/io/undertow/client/UndertowHttp2Client.java >> >> > >> >> > >> >> > >> >> > https://github.com/stevehu/undertow/blob/master/core/src/test/java/io/undertow/client/http/Http2ClientTestCase.java >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > On Sun, Mar 19, 2017 at 8:23 PM, Stuart Douglas >> >> > wrote: >> >> >> >> >> >> I don't really have time to do it (there is no real benefit for >> >> >> Undertow, so it is not high on my priority list), but the code is >> >> >> all >> >> >> Apache licensed so there is no reason why you can't start a project >> >> >> that provides this code as a standalone implementation. >> >> >> >> >> >> You would still need to implement code in Netty etc to actually use >> >> >> this as well, as there is no standardized ALPN API yet. >> >> >> >> >> >> Stuart >> >> >> >> >> >> On Mon, Mar 20, 2017 at 11:07 AM, Steve Hu >> >> >> wrote: >> >> >> > I am reading the code in client package and they look really good. >> >> >> > As >> >> >> > currently none of the http/2 client library has a work around on >> >> >> > alpn >> >> >> > boot >> >> >> > jar and this blocks majority of developers to move to http/2. I am >> >> >> > wondering >> >> >> > if you want to split client package to a standalone client module >> >> >> > so >> >> >> > that it >> >> >> > can be used by other developers to connect to servers that >> >> >> > implement >> >> >> > http/2. >> >> >> > If you are interested in it, I can help to create a pull request >> >> >> > and >> >> >> > add >> >> >> > some test cases while I am working on my own client >> >> >> > implementation. >> >> >> > Thanks. >> >> >> > >> >> >> > On Sun, Mar 19, 2017 at 5:32 PM, Stuart Douglas >> >> >> > >> >> >> > wrote: >> >> >> >> >> >> >> >> You could use Undertow's HTTP/2 client, although it's API was >> >> >> >> designed >> >> >> >> around the reverse proxy use case and as a result is not ideal >> >> >> >> for >> >> >> >> the >> >> >> >> general purpose HTTP client use case (although it is still >> >> >> >> perfectly >> >> >> >> usable). >> >> >> >> >> >> >> >> In terms of using Undertow's ALPN implementation with Netty etc >> >> >> >> it >> >> >> >> would require someone to port it over. The code is at [1] if you >> >> >> >> are >> >> >> >> interested. >> >> >> >> >> >> >> >> Stuart >> >> >> >> >> >> >> >> [1] >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/protocols/ssl/ALPNHackSSLEngine.java >> >> >> >> >> >> >> >> On Mon, Mar 20, 2017 at 7:21 AM, Steve Hu >> >> >> >> wrote: >> >> >> >> > Thanks Stuart for the quick response. Now I have server started >> >> >> >> > with >> >> >> >> > HTTP/2 >> >> >> >> > and it works perfect with some client tools. Now I am looking >> >> >> >> > for >> >> >> >> > Java >> >> >> >> > HTTP/2 client libraries to update my client module to support >> >> >> >> > HTTP/2 >> >> >> >> > protocol for microservices communication. There are three major >> >> >> >> > libraries >> >> >> >> > okhttp, jetty and netty but all of them require Jetty's ALPN >> >> >> >> > boot >> >> >> >> > JAR. I >> >> >> >> > saw >> >> >> >> > you have resolved the boot jar dependency in Undertow and am >> >> >> >> > wondering >> >> >> >> > if >> >> >> >> > you could point me to the right direction. Do you have any >> >> >> >> > recommendation >> >> >> >> > for HTTP/2 client library? How do you work around the alpn boot >> >> >> >> > jar? >> >> >> >> > Is >> >> >> >> > the >> >> >> >> > same solution can be used by okhttp, jetty and netty before >> >> >> >> > Java 9 >> >> >> >> > is >> >> >> >> > released? >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > On Fri, Mar 17, 2017 at 11:03 PM, Stuart Douglas >> >> >> >> > >> >> >> >> > wrote: >> >> >> >> >> >> >> >> >> >> No, that is a debug level message. The JDK8 ALPN provider >> >> >> >> >> should >> >> >> >> >> still >> >> >> >> >> be registered. >> >> >> >> >> >> >> >> >> >> Stuart >> >> >> >> >> >> >> >> >> >> On Sat, Mar 18, 2017 at 12:18 PM, Steve Hu >> >> >> >> >> wrote: >> >> >> >> >> > Hi, >> >> >> >> >> > >> >> >> >> >> > I searched this mailing list and one post mentioned that I >> >> >> >> >> > don't >> >> >> >> >> > need >> >> >> >> >> > to >> >> >> >> >> > use >> >> >> >> >> > -Xbootclasspath/p: after 1.4.0Final. >> >> >> >> >> > I >> >> >> >> >> > am >> >> >> >> >> > trying >> >> >> >> >> > HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but when >> >> >> >> >> > I >> >> >> >> >> > start >> >> >> >> >> > the >> >> >> >> >> > server I got the following error. Do I have to use OpenJDK >> >> >> >> >> > 8? >> >> >> >> >> > If I >> >> >> >> >> > switch to >> >> >> >> >> > JBoss OpenSSL implementation? >> >> >> >> >> > >> >> >> >> >> > Thanks, >> >> >> >> >> > >> >> >> >> >> > Steve >> >> >> >> >> > >> >> >> >> >> > 21:00:36.468 [main] DEBUG io.undertow - Configuring >> >> >> >> >> > listener >> >> >> >> >> > with >> >> >> >> >> > protocol >> >> >> >> >> > HTTPS for interface 0.0.0.0 and port 8843 >> >> >> >> >> > >> >> >> >> >> > 21:00:36.486 [main] DEBUG io.undertow - JDK9 ALPN not >> >> >> >> >> > supported >> >> >> >> >> > >> >> >> >> >> > java.lang.NoSuchMethodException: >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > javax.net.ssl.SSLParameters.setApplicationProtocols([Ljava.lang.String;) >> >> >> >> >> > >> >> >> >> >> > at java.lang.Class.getMethod(Class.java:1786) >> >> >> >> >> > >> >> >> >> >> > at >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:47) >> >> >> >> >> > >> >> >> >> >> > at >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:43) >> >> >> >> >> > >> >> >> >> >> > at java.security.AccessController.doPrivileged(Native >> >> >> >> >> > Method) >> >> >> >> >> > >> >> >> >> >> > at >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider.(JDK9AlpnProvider.java:43) >> >> >> >> >> > >> >> >> >> >> > at >> >> >> >> >> > >> >> >> >> >> > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native >> >> >> >> >> > Method) >> >> >> >> >> > >> >> >> >> >> > at >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) >> >> >> >> >> > >> >> >> >> >> > at >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >> >> >> >> >> > >> >> >> >> >> > at >> >> >> >> >> > >> >> >> >> >> > java.lang.reflect.Constructor.newInstance(Constructor.java:423) >> >> >> >> >> > >> >> >> >> >> > at java.lang.Class.newInstance(Class.java:442) >> >> >> >> >> > >> >> >> >> >> > at >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380) >> >> >> >> >> > >> >> >> >> >> > at >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) >> >> >> >> >> > >> >> >> >> >> > at java.util.ServiceLoader$1.next(ServiceLoader.java:480) >> >> >> >> >> > >> >> >> >> >> > at >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:40) >> >> >> >> >> > >> >> >> >> >> > at >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:35) >> >> >> >> >> > >> >> >> >> >> > at >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.(AlpnOpenListener.java:67) >> >> >> >> >> > >> >> >> >> >> > at >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.(AlpnOpenListener.java:90) >> >> >> >> >> > >> >> >> >> >> > at io.undertow.Undertow.start(Undertow.java:179) >> >> >> >> >> > >> >> >> >> >> > at com.networknt.server.Server.start(Server.java:170) >> >> >> >> >> > >> >> >> >> >> > at com.networknt.server.Server.main(Server.java:90) >> >> >> >> >> > >> >> >> >> >> > 21:00:36.503 [main] INFO com.networknt.server.Server - >> >> >> >> >> > Https >> >> >> >> >> > Server >> >> >> >> >> > started on ip:0.0.0.0 Port:8843 >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > _______________________________________________ >> >> >> >> >> > undertow-dev mailing list >> >> >> >> >> > undertow-dev at lists.jboss.org >> >> >> >> >> > https://lists.jboss.org/mailman/listinfo/undertow-dev >> >> >> >> > >> >> >> >> > >> >> >> > >> >> >> > >> >> > >> >> > >> > >> > > > From stevehu at gmail.com Thu Mar 23 19:57:22 2017 From: stevehu at gmail.com (Steve Hu) Date: Thu, 23 Mar 2017 19:57:22 -0400 Subject: [undertow-dev] Enable HTTP/2 and get JDK9 ALPN not supported In-Reply-To: References: Message-ID: Thanks Stuart for the examples. I have created two more post test cases for UndertowHttp2Client for both clean text and tls. They are all working but with some debug level exceptions. Will these exceptions be removed later? Or is there any way I can avoid these exceptions? 19:30:17,688 DEBUG (main) [io.undertow.request.io] Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7777 local /127.0.0.1:60969[ No Receiver [] -- [] -- []]: java.nio.channels.ClosedChannelException at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) at io.undertow.client.http2.Http2ClientConnection.close(Http2ClientConnection.java:312) at org.xnio.IoUtils.safeClose(IoUtils.java:134) at io.undertow.client.http.Http2ClientTestCase.testSimpleHttp(Http2ClientTestCase.java:176) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) 19:30:17,693 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] Sending goaway on channel Http2Channel peer / 127.0.0.1:60969 local /127.0.0.1:7777[ No Receiver [] -- [] -- []]: java.nio.channels.ClosedChannelException at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) at io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) at io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) at io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) at io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) 19:30:17,694 DEBUG (Client I/O-4) [io.undertow.request.io] Channel Http2Channel peer localhost/ 127.0.0.1:7777 local /127.0.0.1:60969[ No Receiver [] -- [] -- []] is being closed: java.nio.channels.ClosedChannelException at io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) at org.xnio.IoUtils.safeClose(IoUtils.java:134) at io.undertow.protocols.http2.Http2Channel$3.handleEvent(Http2Channel.java:762) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:421) at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:409) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel$1.run(AbstractFramedStreamSinkChannel.java:212) at io.undertow.server.protocol.framed.AbstractFramedChannel$3.run(AbstractFramedChannel.java:231) at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) 19:30:17,694 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] Channel Http2Channel peer /127.0.0.1:60969 local /127.0.0.1:7777[ No Receiver [] -- [] -- []] is being closed: java.nio.channels.ClosedChannelException at io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) at org.xnio.IoUtils.safeClose(IoUtils.java:134) at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:767) at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) at io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) at io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) at io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) at io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) On Wed, Mar 22, 2017 at 9:40 PM, Stuart Douglas wrote: > I have added one: > https://github.com/undertow-io/undertow/commit/ > 20be7eb052a1efd44c8a1e6981f269344174543a#diff- > f92c46f6546a565ef565e205b726ccf8R174 > > On Thu, Mar 23, 2017 at 11:07 AM, Steve Hu wrote: > > Hi Stuart, > > > > I am trying to find an example or test case that uses http post for > > HttpClient but couldn't find anything. The only information is the > comment > > of ClientRequest. Could you please provide an example on how to push > body in > > a post ClientRequest? > > > > Thanks, > > > > Steve > > > > * This class only represents the HTTP header, it does not represent an > > entity body. If the request needs an entity > > * body then this must be specified by either setting a Content-Length or > > Transfer-Encoding header, otherwise > > * the client will assume that the body is empty. > > > > > > > > On Wed, Mar 22, 2017 at 5:01 PM, Stuart Douglas > wrote: > >> > >> The issue is that it is reporting the wrong protocol in the response, > >> I have fixed this upstream. > >> > >> Stuart > >> > >> On Thu, Mar 23, 2017 at 1:31 AM, Steve Hu wrote: > >> > Hi Stuart, > >> > > >> > Thanks for the upgrade handler fix. I can clearly see the handler is > >> > registered and handleRequest is called in a debug session. I also > >> > replaced > >> > EMPTY option with OptionMap.create(UndertowOptions.ENABLE_HTTP2, > true) > >> > when > >> > opening client connection. The response protocol is still HTTP/1.1 for > >> > both > >> > http and https requests. The following is the output from the console > >> > and > >> > the syched/updated source code can be found > >> > > >> > https://github.com/stevehu/undertow/blob/master/core/src/ > test/java/io/undertow/client/http/Http2ClientTestCase.java > >> > > >> > 10:16:43,804 INFO (main) [org.xnio] XNIO version > >> > 3.3.6.Final > >> > 10:16:43,829 INFO (main) [org.xnio.nio] XNIO NIO > >> > Implementation Version 3.3.6.Final > >> > 10:17:42,980 DEBUG (main) [io.undertow.request.io] > >> > > >> > Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7778 > >> > local > >> > /127.0.0.1:64696[ No Receiver [] -- [] -- []]: > >> > java.nio.channels.ClosedChannelException > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:753) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > >> > at > >> > > >> > io.undertow.client.http2.Http2ClientConnection.close( > Http2ClientConnection.java:312) > >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > >> > at > >> > > >> > io.undertow.client.http.Http2ClientTestCase.testHttpsConnectionClose( > Http2ClientTestCase.java:245) > >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > >> > HTTP/1.1 > >> > at > >> > > >> > sun.reflect.NativeMethodAccessorImpl.invoke( > NativeMethodAccessorImpl.java:62) > >> > at > >> > > >> > sun.reflect.DelegatingMethodAccessorImpl.invoke( > DelegatingMethodAccessorImpl.java:43) > >> > at java.lang.reflect.Method.invoke(Method.java:498) > >> > at > >> > > >> > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall( > FrameworkMethod.java:50) > >> > at > >> > > >> > org.junit.internal.runners.model.ReflectiveCallable.run( > ReflectiveCallable.java:12) > >> > at > >> > > >> > org.junit.runners.model.FrameworkMethod.invokeExplosively( > FrameworkMethod.java:47) > >> > at > >> > > >> > org.junit.internal.runners.statements.InvokeMethod. > evaluate(InvokeMethod.java:17) > >> > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) > >> > at > >> > > >> > org.junit.runners.BlockJUnit4ClassRunner.runChild( > BlockJUnit4ClassRunner.java:78) > >> > at > >> > > >> > org.junit.runners.BlockJUnit4ClassRunner.runChild( > BlockJUnit4ClassRunner.java:57) > >> > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > >> > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > >> > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > >> > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > >> > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > >> > at > >> > > >> > org.junit.internal.runners.statements.RunBefores. > evaluate(RunBefores.java:26) > >> > at > >> > > >> > org.junit.internal.runners.statements.RunAfters.evaluate( > RunAfters.java:27) > >> > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > >> > at org.junit.runner.JUnitCore.run(JUnitCore.java:137) > >> > at > >> > > >> > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs( > JUnit4IdeaTestRunner.java:117) > >> > at > >> > > >> > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs( > JUnit4IdeaTestRunner.java:42) > >> > at > >> > > >> > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart( > JUnitStarter.java:262) > >> > at > >> > com.intellij.rt.execution.junit.JUnitStarter.main( > JUnitStarter.java:84) > >> > > >> > 10:17:42,986 DEBUG (Client I/O-7) [io.undertow.request.io] > >> > Channel Http2Channel peer > >> > localhost/127.0.0.1:7778 local /127.0.0.1:64696[ No Receiver [] -- > [] -- > >> > []] > >> > is being closed: java.nio.channels.ClosedChannelException > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel. > close(AbstractFramedChannel.java:791) > >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel$3.handleEvent( > Http2Channel.java:762) > >> > at > >> > org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > >> > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners. > java:421) > >> > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners. > java:409) > >> > at > >> > org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedStreamSinkChanne > l$1.run(AbstractFramedStreamSinkChannel.java:212) > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$ > 3.run(AbstractFramedChannel.java:231) > >> > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) > >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) > >> > > >> > 10:17:42,986 DEBUG (XNIO-1 I/O-7) [io.undertow.request.io] > >> > Sending goaway on channel Http2Channel peer > >> > /127.0.0.1:64696 local /127.0.0.1:7778[ No Receiver [] -- [] -- []]: > >> > java.nio.channels.ClosedChannelException > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:753) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.createChannelImpl( > Http2Channel.java:478) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:317) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:65) > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel. > receive(AbstractFramedChannel.java:452) > >> > at > >> > > >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:106) > >> > at > >> > > >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:57) > >> > at > >> > org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > >> > at > >> > org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > >> > at > >> > > >> > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler. > readReady(ReadReadyHandler.java:66) > >> > at > >> > > >> > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady( > SslConduit.java:1129) > >> > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit. > java:88) > >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > >> > > >> > 10:17:42,988 DEBUG (XNIO-1 I/O-7) [io.undertow.request.io] > >> > Channel Http2Channel peer > >> > /127.0.0.1:64696 > >> > local /127.0.0.1:7778[ No Receiver [] -- [] -- []] is being closed: > >> > java.nio.channels.ClosedChannelException > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel. > close(AbstractFramedChannel.java:791) > >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:767) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.createChannelImpl( > Http2Channel.java:478) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:317) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:65) > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel. > receive(AbstractFramedChannel.java:452) > >> > at > >> > > >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:106) > >> > at > >> > > >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:57) > >> > at > >> > org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > >> > at > >> > org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > >> > at > >> > > >> > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler. > readReady(ReadReadyHandler.java:66) > >> > at > >> > > >> > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady( > SslConduit.java:1129) > >> > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit. > java:88) > >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > >> > > >> > 10:17:43,001 DEBUG (Client I/O-7) [io.undertow.request.io] > >> > UT005013: An IOException occurred: > >> > java.nio.channels.ClosedChannelException > >> > at > >> > > >> > io.undertow.client.http2.Http2ClientConnection$Http2ReceiveListener. > handleEvent(Http2ClientConnection.java:452) > >> > at > >> > > >> > io.undertow.client.http2.Http2ClientConnection$Http2ReceiveListener. > handleEvent(Http2ClientConnection.java:366) > >> > at > >> > org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > >> > at > >> > org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > >> > at > >> > > >> > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler. > readReady(ReadReadyHandler.java:66) > >> > at > >> > > >> > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady( > SslConduit.java:1129) > >> > at io.undertow.protocols.ssl.SslConduit$1.run(SslConduit.java:168) > >> > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) > >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) > >> > > >> > HTTP/1.1 > >> > 10:20:14,473 DEBUG (main) [io.undertow.request.io] > >> > > >> > Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7777 > >> > local > >> > /127.0.0.1:64697[ No Receiver [] -- [] -- []]: > >> > java.nio.channels.ClosedChannelException > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:753) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > >> > > >> > at > >> > > >> > io.undertow.client.http2.Http2ClientConnection.close( > Http2ClientConnection.java:312) > >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > >> > at > >> > > >> > io.undertow.client.http.Http2ClientTestCase.testHttpConnectionClose( > Http2ClientTestCase.java:220) > >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > >> > at > >> > > >> > sun.reflect.NativeMethodAccessorImpl.invoke( > NativeMethodAccessorImpl.java:62) > >> > at > >> > > >> > sun.reflect.DelegatingMethodAccessorImpl.invoke( > DelegatingMethodAccessorImpl.java:43) > >> > at java.lang.reflect.Method.invoke(Method.java:498) > >> > at > >> > > >> > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall( > FrameworkMethod.java:50) > >> > at > >> > > >> > org.junit.internal.runners.model.ReflectiveCallable.run( > ReflectiveCallable.java:12) > >> > at > >> > > >> > org.junit.runners.model.FrameworkMethod.invokeExplosively( > FrameworkMethod.java:47) > >> > at > >> > > >> > org.junit.internal.runners.statements.InvokeMethod. > evaluate(InvokeMethod.java:17) > >> > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) > >> > at > >> > > >> > org.junit.runners.BlockJUnit4ClassRunner.runChild( > BlockJUnit4ClassRunner.java:78) > >> > at > >> > > >> > org.junit.runners.BlockJUnit4ClassRunner.runChild( > BlockJUnit4ClassRunner.java:57) > >> > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > >> > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > >> > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > >> > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > >> > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > >> > at > >> > > >> > org.junit.internal.runners.statements.RunBefores. > evaluate(RunBefores.java:26) > >> > at > >> > > >> > org.junit.internal.runners.statements.RunAfters.evaluate( > RunAfters.java:27) > >> > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > >> > at org.junit.runner.JUnitCore.run(JUnitCore.java:137) > >> > at > >> > > >> > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs( > JUnit4IdeaTestRunner.java:117) > >> > at > >> > > >> > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs( > JUnit4IdeaTestRunner.java:42) > >> > at > >> > > >> > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart( > JUnitStarter.java:262) > >> > at > >> > com.intellij.rt.execution.junit.JUnitStarter.main( > JUnitStarter.java:84) > >> > > >> > 10:20:14,474 DEBUG (Client I/O-4) [io.undertow.request.io] > >> > Channel Http2Channel peer > >> > localhost/127.0.0.1:7777 local /127.0.0.1:64697[ No Receiver [] -- > [] -- > >> > []] > >> > is being closed: java.nio.channels.ClosedChannelException > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel. > close(AbstractFramedChannel.java:791) > >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel$3.handleEvent( > Http2Channel.java:762) > >> > at > >> > org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > >> > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners. > java:421) > >> > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners. > java:409) > >> > at > >> > org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > >> > at org.xnio.ChannelListeners$4.run(ChannelListeners.java:147) > >> > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) > >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) > >> > > >> > 10:20:14,474 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] > >> > Sending goaway on channel Http2Channel peer > >> > /127.0.0.1:64697 local /127.0.0.1:7777[ No Receiver [] -- [] -- []]: > >> > java.nio.channels.ClosedChannelException > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:753) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.createChannelImpl( > Http2Channel.java:478) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:317) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:65) > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel. > receive(AbstractFramedChannel.java:452) > >> > at > >> > > >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:106) > >> > at > >> > > >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:57) > >> > at > >> > org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > >> > at > >> > org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > >> > at > >> > > >> > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler. > readReady(ReadReadyHandler.java:66) > >> > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit. > java:88) > >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > >> > > >> > 10:20:14,476 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] > >> > Channel Http2Channel peer > >> > /127.0.0.1:64697 > >> > local /127.0.0.1:7777[ No Receiver [] -- [] -- []] is being closed: > >> > java.nio.channels.ClosedChannelException > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel. > close(AbstractFramedChannel.java:791) > >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:767) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.sendGoAway( > Http2Channel.java:744) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.createChannelImpl( > Http2Channel.java:478) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:317) > >> > at > >> > > >> > io.undertow.protocols.http2.Http2Channel.createChannel( > Http2Channel.java:65) > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel. > receive(AbstractFramedChannel.java:452) > >> > at > >> > > >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:106) > >> > at > >> > > >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent( > Http2ReceiveListener.java:57) > >> > at > >> > org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > >> > at > >> > > >> > io.undertow.server.protocol.framed.AbstractFramedChannel$ > FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > >> > at > >> > org.xnio.ChannelListeners.invokeChannelListener( > ChannelListeners.java:92) > >> > at > >> > > >> > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler. > readReady(ReadReadyHandler.java:66) > >> > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit. > java:88) > >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > >> > > >> > > >> > On Tue, Mar 21, 2017 at 11:39 PM, Stuart Douglas > > >> > wrote: > >> >> > >> >> On Wed, Mar 22, 2017 at 12:50 PM, Steve Hu > wrote: > >> >> > Hi Stuart, > >> >> > > >> >> > I debugged into the ALPN code and found some issues with > Http2Client. > >> >> > > >> >> > I started with the Http2Server example and found > >> >> > LoadBalancingProxyClient is > >> >> > using an instance of UndertowClient which can only load HTTP1.1 > >> >> > ClientProviders. The following is the code to get ClientProvider > and > >> >> > only > >> >> > "http" or "https" can be the return from uri.getSchema(). > >> >> > > >> >> > ClientProvider provider = clientProviders.get(uri.getScheme()); > >> >> > > >> >> > If this is true, then the communication between the proxy and > Http/2 > >> >> > server > >> >> > is Http/1.1 > >> >> > >> >> You need to pass in the ENABLE_HTTP2 option in the OptionsMap. For > >> >> http URI's this means that the client will attempt an upgrade on the > >> >> first request, for https URI's ALPN will be used to try and negotiate > >> >> HTTP/2. This is how browsers behave, and will work even if the target > >> >> does not support HTTP/2. > >> >> > >> >> One thing I did notice that I fixed upstream was that the Undertow > >> >> builder was not registering a HTTP2UpgradeHandler when HTTP/2 was > >> >> enabled, which has been fixed. > >> >> > >> >> > > >> >> > In addition, I have created a new class UndertowHttp2Client and > >> >> > Http2ClientTestCase in my forked repo to try > >> >> > > >> >> > the Http2ClientProviders and found all three http2 client providers > >> >> > don't > >> >> > work as expected. > >> >> > > >> >> > h2c and h2-prior got 200 response code back during handshake and h2 > >> >> > works > >> >> > but the connection is still http 1.1 > >> >> > >> >> I think this was probably caused by the lack of the upgrade handler > >> >> (well for h2c, h2c-prior should still work). > >> >> > >> >> Stuart > >> >> > >> >> > > >> >> > I am debugging the ALPN code now but it is very slow as I have to > dig > >> >> > into > >> >> > the spec to learn how the handshake works. > >> >> > > >> >> > As you have resolved the ALPN boot jar issue with the hack, I think > >> >> > Undertow > >> >> > is very usable for HTTP/2 and it would > >> >> > > >> >> > be perfect if the client is working as well. Could you please > confirm > >> >> > my > >> >> > findings and let me know direction I should > >> >> > > >> >> > focus on? > >> >> > >> >> > >> >> > > >> >> > > >> >> > Thanks, > >> >> > > >> >> > > >> >> > Steve > >> >> > > >> >> > > >> >> > Here is my repo with UndertowHttp2Client and Test. > >> >> > > >> >> > https://github.com/stevehu/undertow > >> >> > > >> >> > > >> >> > And here is the files I have added. > >> >> > > >> >> > > >> >> > > >> >> > https://github.com/stevehu/undertow/blob/master/core/src/ > main/java/io/undertow/client/UndertowHttp2Client.java > >> >> > > >> >> > > >> >> > > >> >> > https://github.com/stevehu/undertow/blob/master/core/src/ > test/java/io/undertow/client/http/Http2ClientTestCase.java > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > On Sun, Mar 19, 2017 at 8:23 PM, Stuart Douglas < > sdouglas at redhat.com> > >> >> > wrote: > >> >> >> > >> >> >> I don't really have time to do it (there is no real benefit for > >> >> >> Undertow, so it is not high on my priority list), but the code is > >> >> >> all > >> >> >> Apache licensed so there is no reason why you can't start a > project > >> >> >> that provides this code as a standalone implementation. > >> >> >> > >> >> >> You would still need to implement code in Netty etc to actually > use > >> >> >> this as well, as there is no standardized ALPN API yet. > >> >> >> > >> >> >> Stuart > >> >> >> > >> >> >> On Mon, Mar 20, 2017 at 11:07 AM, Steve Hu > >> >> >> wrote: > >> >> >> > I am reading the code in client package and they look really > good. > >> >> >> > As > >> >> >> > currently none of the http/2 client library has a work around on > >> >> >> > alpn > >> >> >> > boot > >> >> >> > jar and this blocks majority of developers to move to http/2. I > am > >> >> >> > wondering > >> >> >> > if you want to split client package to a standalone client > module > >> >> >> > so > >> >> >> > that it > >> >> >> > can be used by other developers to connect to servers that > >> >> >> > implement > >> >> >> > http/2. > >> >> >> > If you are interested in it, I can help to create a pull request > >> >> >> > and > >> >> >> > add > >> >> >> > some test cases while I am working on my own client > >> >> >> > implementation. > >> >> >> > Thanks. > >> >> >> > > >> >> >> > On Sun, Mar 19, 2017 at 5:32 PM, Stuart Douglas > >> >> >> > > >> >> >> > wrote: > >> >> >> >> > >> >> >> >> You could use Undertow's HTTP/2 client, although it's API was > >> >> >> >> designed > >> >> >> >> around the reverse proxy use case and as a result is not ideal > >> >> >> >> for > >> >> >> >> the > >> >> >> >> general purpose HTTP client use case (although it is still > >> >> >> >> perfectly > >> >> >> >> usable). > >> >> >> >> > >> >> >> >> In terms of using Undertow's ALPN implementation with Netty etc > >> >> >> >> it > >> >> >> >> would require someone to port it over. The code is at [1] if > you > >> >> >> >> are > >> >> >> >> interested. > >> >> >> >> > >> >> >> >> Stuart > >> >> >> >> > >> >> >> >> [1] > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> https://github.com/undertow-io/undertow/blob/master/core/ > src/main/java/io/undertow/protocols/ssl/ALPNHackSSLEngine.java > >> >> >> >> > >> >> >> >> On Mon, Mar 20, 2017 at 7:21 AM, Steve Hu > >> >> >> >> wrote: > >> >> >> >> > Thanks Stuart for the quick response. Now I have server > started > >> >> >> >> > with > >> >> >> >> > HTTP/2 > >> >> >> >> > and it works perfect with some client tools. Now I am looking > >> >> >> >> > for > >> >> >> >> > Java > >> >> >> >> > HTTP/2 client libraries to update my client module to support > >> >> >> >> > HTTP/2 > >> >> >> >> > protocol for microservices communication. There are three > major > >> >> >> >> > libraries > >> >> >> >> > okhttp, jetty and netty but all of them require Jetty's ALPN > >> >> >> >> > boot > >> >> >> >> > JAR. I > >> >> >> >> > saw > >> >> >> >> > you have resolved the boot jar dependency in Undertow and am > >> >> >> >> > wondering > >> >> >> >> > if > >> >> >> >> > you could point me to the right direction. Do you have any > >> >> >> >> > recommendation > >> >> >> >> > for HTTP/2 client library? How do you work around the alpn > boot > >> >> >> >> > jar? > >> >> >> >> > Is > >> >> >> >> > the > >> >> >> >> > same solution can be used by okhttp, jetty and netty before > >> >> >> >> > Java 9 > >> >> >> >> > is > >> >> >> >> > released? > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > On Fri, Mar 17, 2017 at 11:03 PM, Stuart Douglas > >> >> >> >> > > >> >> >> >> > wrote: > >> >> >> >> >> > >> >> >> >> >> No, that is a debug level message. The JDK8 ALPN provider > >> >> >> >> >> should > >> >> >> >> >> still > >> >> >> >> >> be registered. > >> >> >> >> >> > >> >> >> >> >> Stuart > >> >> >> >> >> > >> >> >> >> >> On Sat, Mar 18, 2017 at 12:18 PM, Steve Hu < > stevehu at gmail.com> > >> >> >> >> >> wrote: > >> >> >> >> >> > Hi, > >> >> >> >> >> > > >> >> >> >> >> > I searched this mailing list and one post mentioned that I > >> >> >> >> >> > don't > >> >> >> >> >> > need > >> >> >> >> >> > to > >> >> >> >> >> > use > >> >> >> >> >> > -Xbootclasspath/p: after > 1.4.0Final. > >> >> >> >> >> > I > >> >> >> >> >> > am > >> >> >> >> >> > trying > >> >> >> >> >> > HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but > when > >> >> >> >> >> > I > >> >> >> >> >> > start > >> >> >> >> >> > the > >> >> >> >> >> > server I got the following error. Do I have to use OpenJDK > >> >> >> >> >> > 8? > >> >> >> >> >> > If I > >> >> >> >> >> > switch to > >> >> >> >> >> > JBoss OpenSSL implementation? > >> >> >> >> >> > > >> >> >> >> >> > Thanks, > >> >> >> >> >> > > >> >> >> >> >> > Steve > >> >> >> >> >> > > >> >> >> >> >> > 21:00:36.468 [main] DEBUG io.undertow - Configuring > >> >> >> >> >> > listener > >> >> >> >> >> > with > >> >> >> >> >> > protocol > >> >> >> >> >> > HTTPS for interface 0.0.0.0 and port 8843 > >> >> >> >> >> > > >> >> >> >> >> > 21:00:36.486 [main] DEBUG io.undertow - JDK9 ALPN not > >> >> >> >> >> > supported > >> >> >> >> >> > > >> >> >> >> >> > java.lang.NoSuchMethodException: > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > javax.net.ssl.SSLParameters.setApplicationProtocols([ > Ljava.lang.String;) > >> >> >> >> >> > > >> >> >> >> >> > at java.lang.Class.getMethod(Class.java:1786) > >> >> >> >> >> > > >> >> >> >> >> > at > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run( > JDK9AlpnProvider.java:47) > >> >> >> >> >> > > >> >> >> >> >> > at > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run( > JDK9AlpnProvider.java:43) > >> >> >> >> >> > > >> >> >> >> >> > at java.security.AccessController.doPrivileged(Native > >> >> >> >> >> > Method) > >> >> >> >> >> > > >> >> >> >> >> > at > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider.( > JDK9AlpnProvider.java:43) > >> >> >> >> >> > > >> >> >> >> >> > at > >> >> >> >> >> > > >> >> >> >> >> > sun.reflect.NativeConstructorAccessorImpl. > newInstance0(Native > >> >> >> >> >> > Method) > >> >> >> >> >> > > >> >> >> >> >> > at > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > sun.reflect.NativeConstructorAccessorImpl.newInstance( > NativeConstructorAccessorImpl.java:62) > >> >> >> >> >> > > >> >> >> >> >> > at > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > sun.reflect.DelegatingConstructorAccessorI > mpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > >> >> >> >> >> > > >> >> >> >> >> > at > >> >> >> >> >> > > >> >> >> >> >> > java.lang.reflect.Constructor. > newInstance(Constructor.java:423) > >> >> >> >> >> > > >> >> >> >> >> > at java.lang.Class.newInstance(Class.java:442) > >> >> >> >> >> > > >> >> >> >> >> > at > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > java.util.ServiceLoader$LazyIterator.nextService( > ServiceLoader.java:380) > >> >> >> >> >> > > >> >> >> >> >> > at > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > java.util.ServiceLoader$LazyIterator.next( > ServiceLoader.java:404) > >> >> >> >> >> > > >> >> >> >> >> > at java.util.ServiceLoader$1.next(ServiceLoader.java:480) > >> >> >> >> >> > > >> >> >> >> >> > at > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > io.undertow.protocols.alpn.ALPNManager.( > ALPNManager.java:40) > >> >> >> >> >> > > >> >> >> >> >> > at > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > io.undertow.protocols.alpn.ALPNManager.( > ALPNManager.java:35) > >> >> >> >> >> > > >> >> >> >> >> > at > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.( > AlpnOpenListener.java:67) > >> >> >> >> >> > > >> >> >> >> >> > at > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.( > AlpnOpenListener.java:90) > >> >> >> >> >> > > >> >> >> >> >> > at io.undertow.Undertow.start(Undertow.java:179) > >> >> >> >> >> > > >> >> >> >> >> > at com.networknt.server.Server.start(Server.java:170) > >> >> >> >> >> > > >> >> >> >> >> > at com.networknt.server.Server.main(Server.java:90) > >> >> >> >> >> > > >> >> >> >> >> > 21:00:36.503 [main] INFO com.networknt.server.Server - > >> >> >> >> >> > Https > >> >> >> >> >> > Server > >> >> >> >> >> > started on ip:0.0.0.0 Port:8843 > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > _______________________________________________ > >> >> >> >> >> > undertow-dev mailing list > >> >> >> >> >> > undertow-dev at lists.jboss.org > >> >> >> >> >> > https://lists.jboss.org/mailman/listinfo/undertow-dev > >> >> >> >> > > >> >> >> >> > > >> >> >> > > >> >> >> > > >> >> > > >> >> > > >> > > >> > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170323/0cee1b23/attachment-0001.html From sdouglas at redhat.com Thu Mar 23 20:05:43 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Fri, 24 Mar 2017 11:05:43 +1100 Subject: [undertow-dev] Enable HTTP/2 and get JDK9 ALPN not supported In-Reply-To: References: Message-ID: I have dropped this log level down to trace. Stuart On Fri, Mar 24, 2017 at 10:57 AM, Steve Hu wrote: > Thanks Stuart for the examples. I have created two more post test cases for > UndertowHttp2Client for both clean text and tls. They are all working but > with some debug level exceptions. Will these exceptions be removed later? Or > is there any way I can avoid these exceptions? > > > 19:30:17,688 DEBUG (main) [io.undertow.request.io] > Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7777 local > /127.0.0.1:60969[ No Receiver [] -- [] -- []]: > java.nio.channels.ClosedChannelException > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) > at > io.undertow.client.http2.Http2ClientConnection.close(Http2ClientConnection.java:312) > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > at > io.undertow.client.http.Http2ClientTestCase.testSimpleHttp(Http2ClientTestCase.java:176) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) > at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) > at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) > at > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > at > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) > at > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > at org.junit.runner.JUnitCore.run(JUnitCore.java:137) > at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) > at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) > at > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) > at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) > > 19:30:17,693 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] > Sending goaway on channel Http2Channel peer > /127.0.0.1:60969 local /127.0.0.1:7777[ No Receiver [] -- [] -- []]: > java.nio.channels.ClosedChannelException > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) > at > io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) > at > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) > at > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) > at > io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) > at > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) > at > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > at > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > > 19:30:17,694 DEBUG (Client I/O-4) [io.undertow.request.io] > Channel Http2Channel peer > localhost/127.0.0.1:7777 local /127.0.0.1:60969[ No Receiver [] -- [] -- []] > is being closed: java.nio.channels.ClosedChannelException > at > io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > at > io.undertow.protocols.http2.Http2Channel$3.handleEvent(Http2Channel.java:762) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:421) > at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:409) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at > io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel$1.run(AbstractFramedStreamSinkChannel.java:212) > at > io.undertow.server.protocol.framed.AbstractFramedChannel$3.run(AbstractFramedChannel.java:231) > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) > > 19:30:17,694 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] > Channel Http2Channel peer /127.0.0.1:60969 > local /127.0.0.1:7777[ No Receiver [] -- [] -- []] is being closed: > java.nio.channels.ClosedChannelException > at > io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) > at org.xnio.IoUtils.safeClose(IoUtils.java:134) > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:767) > at > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) > at > io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) > at > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) > at > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) > at > io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) > at > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) > at > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) > at > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) > at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) > at > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) > at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) > > > On Wed, Mar 22, 2017 at 9:40 PM, Stuart Douglas wrote: >> >> I have added one: >> >> https://github.com/undertow-io/undertow/commit/20be7eb052a1efd44c8a1e6981f269344174543a#diff-f92c46f6546a565ef565e205b726ccf8R174 >> >> On Thu, Mar 23, 2017 at 11:07 AM, Steve Hu wrote: >> > Hi Stuart, >> > >> > I am trying to find an example or test case that uses http post for >> > HttpClient but couldn't find anything. The only information is the >> > comment >> > of ClientRequest. Could you please provide an example on how to push >> > body in >> > a post ClientRequest? >> > >> > Thanks, >> > >> > Steve >> > >> > * This class only represents the HTTP header, it does not represent an >> > entity body. If the request needs an entity >> > * body then this must be specified by either setting a Content-Length or >> > Transfer-Encoding header, otherwise >> > * the client will assume that the body is empty. >> > >> > >> > >> > On Wed, Mar 22, 2017 at 5:01 PM, Stuart Douglas >> > wrote: >> >> >> >> The issue is that it is reporting the wrong protocol in the response, >> >> I have fixed this upstream. >> >> >> >> Stuart >> >> >> >> On Thu, Mar 23, 2017 at 1:31 AM, Steve Hu wrote: >> >> > Hi Stuart, >> >> > >> >> > Thanks for the upgrade handler fix. I can clearly see the handler is >> >> > registered and handleRequest is called in a debug session. I also >> >> > replaced >> >> > EMPTY option with OptionMap.create(UndertowOptions.ENABLE_HTTP2, >> >> > true) >> >> > when >> >> > opening client connection. The response protocol is still HTTP/1.1 >> >> > for >> >> > both >> >> > http and https requests. The following is the output from the console >> >> > and >> >> > the syched/updated source code can be found >> >> > >> >> > >> >> > https://github.com/stevehu/undertow/blob/master/core/src/test/java/io/undertow/client/http/Http2ClientTestCase.java >> >> > >> >> > 10:16:43,804 INFO (main) [org.xnio] XNIO version >> >> > 3.3.6.Final >> >> > 10:16:43,829 INFO (main) [org.xnio.nio] XNIO NIO >> >> > Implementation Version 3.3.6.Final >> >> > 10:17:42,980 DEBUG (main) [io.undertow.request.io] >> >> > >> >> > Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7778 >> >> > local >> >> > /127.0.0.1:64696[ No Receiver [] -- [] -- []]: >> >> > java.nio.channels.ClosedChannelException >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) >> >> > at >> >> > >> >> > >> >> > io.undertow.client.http2.Http2ClientConnection.close(Http2ClientConnection.java:312) >> >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) >> >> > at >> >> > >> >> > >> >> > io.undertow.client.http.Http2ClientTestCase.testHttpsConnectionClose(Http2ClientTestCase.java:245) >> >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> >> > HTTP/1.1 >> >> > at >> >> > >> >> > >> >> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) >> >> > at >> >> > >> >> > >> >> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >> >> > at java.lang.reflect.Method.invoke(Method.java:498) >> >> > at >> >> > >> >> > >> >> > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) >> >> > at >> >> > >> >> > >> >> > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) >> >> > at >> >> > >> >> > >> >> > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) >> >> > at >> >> > >> >> > >> >> > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) >> >> > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) >> >> > at >> >> > >> >> > >> >> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) >> >> > at >> >> > >> >> > >> >> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) >> >> > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) >> >> > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) >> >> > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) >> >> > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) >> >> > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) >> >> > at >> >> > >> >> > >> >> > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) >> >> > at >> >> > >> >> > >> >> > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) >> >> > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) >> >> > at org.junit.runner.JUnitCore.run(JUnitCore.java:137) >> >> > at >> >> > >> >> > >> >> > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) >> >> > at >> >> > >> >> > >> >> > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) >> >> > at >> >> > >> >> > >> >> > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) >> >> > at >> >> > >> >> > com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) >> >> > >> >> > 10:17:42,986 DEBUG (Client I/O-7) [io.undertow.request.io] >> >> > Channel Http2Channel peer >> >> > localhost/127.0.0.1:7778 local /127.0.0.1:64696[ No Receiver [] -- [] >> >> > -- >> >> > []] >> >> > is being closed: java.nio.channels.ClosedChannelException >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) >> >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel$3.handleEvent(Http2Channel.java:762) >> >> > at >> >> > >> >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> >> > at >> >> > org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:421) >> >> > at >> >> > org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:409) >> >> > at >> >> > >> >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel$1.run(AbstractFramedStreamSinkChannel.java:212) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel$3.run(AbstractFramedChannel.java:231) >> >> > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) >> >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) >> >> > >> >> > 10:17:42,986 DEBUG (XNIO-1 I/O-7) [io.undertow.request.io] >> >> > Sending goaway on channel Http2Channel peer >> >> > /127.0.0.1:64696 local /127.0.0.1:7778[ No Receiver [] -- [] -- []]: >> >> > java.nio.channels.ClosedChannelException >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) >> >> > at >> >> > >> >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) >> >> > at >> >> > >> >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> >> > at >> >> > >> >> > >> >> > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1129) >> >> > at >> >> > org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) >> >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) >> >> > >> >> > 10:17:42,988 DEBUG (XNIO-1 I/O-7) [io.undertow.request.io] >> >> > Channel Http2Channel peer >> >> > /127.0.0.1:64696 >> >> > local /127.0.0.1:7778[ No Receiver [] -- [] -- []] is being closed: >> >> > java.nio.channels.ClosedChannelException >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) >> >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:767) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) >> >> > at >> >> > >> >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) >> >> > at >> >> > >> >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> >> > at >> >> > >> >> > >> >> > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1129) >> >> > at >> >> > org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) >> >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) >> >> > >> >> > 10:17:43,001 DEBUG (Client I/O-7) [io.undertow.request.io] >> >> > UT005013: An IOException occurred: >> >> > java.nio.channels.ClosedChannelException >> >> > at >> >> > >> >> > >> >> > io.undertow.client.http2.Http2ClientConnection$Http2ReceiveListener.handleEvent(Http2ClientConnection.java:452) >> >> > at >> >> > >> >> > >> >> > io.undertow.client.http2.Http2ClientConnection$Http2ReceiveListener.handleEvent(Http2ClientConnection.java:366) >> >> > at >> >> > >> >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) >> >> > at >> >> > >> >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> >> > at >> >> > >> >> > >> >> > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1129) >> >> > at io.undertow.protocols.ssl.SslConduit$1.run(SslConduit.java:168) >> >> > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) >> >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) >> >> > >> >> > HTTP/1.1 >> >> > 10:20:14,473 DEBUG (main) [io.undertow.request.io] >> >> > >> >> > Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7777 >> >> > local >> >> > /127.0.0.1:64697[ No Receiver [] -- [] -- []]: >> >> > java.nio.channels.ClosedChannelException >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) >> >> > >> >> > at >> >> > >> >> > >> >> > io.undertow.client.http2.Http2ClientConnection.close(Http2ClientConnection.java:312) >> >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) >> >> > at >> >> > >> >> > >> >> > io.undertow.client.http.Http2ClientTestCase.testHttpConnectionClose(Http2ClientTestCase.java:220) >> >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> >> > at >> >> > >> >> > >> >> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) >> >> > at >> >> > >> >> > >> >> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >> >> > at java.lang.reflect.Method.invoke(Method.java:498) >> >> > at >> >> > >> >> > >> >> > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) >> >> > at >> >> > >> >> > >> >> > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) >> >> > at >> >> > >> >> > >> >> > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) >> >> > at >> >> > >> >> > >> >> > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) >> >> > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) >> >> > at >> >> > >> >> > >> >> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) >> >> > at >> >> > >> >> > >> >> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) >> >> > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) >> >> > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) >> >> > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) >> >> > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) >> >> > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) >> >> > at >> >> > >> >> > >> >> > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) >> >> > at >> >> > >> >> > >> >> > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) >> >> > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) >> >> > at org.junit.runner.JUnitCore.run(JUnitCore.java:137) >> >> > at >> >> > >> >> > >> >> > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) >> >> > at >> >> > >> >> > >> >> > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) >> >> > at >> >> > >> >> > >> >> > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) >> >> > at >> >> > >> >> > com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) >> >> > >> >> > 10:20:14,474 DEBUG (Client I/O-4) [io.undertow.request.io] >> >> > Channel Http2Channel peer >> >> > localhost/127.0.0.1:7777 local /127.0.0.1:64697[ No Receiver [] -- [] >> >> > -- >> >> > []] >> >> > is being closed: java.nio.channels.ClosedChannelException >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) >> >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel$3.handleEvent(Http2Channel.java:762) >> >> > at >> >> > >> >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> >> > at >> >> > org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:421) >> >> > at >> >> > org.xnio.ChannelListeners$14.handleEvent(ChannelListeners.java:409) >> >> > at >> >> > >> >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> >> > at org.xnio.ChannelListeners$4.run(ChannelListeners.java:147) >> >> > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) >> >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) >> >> > >> >> > 10:20:14,474 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] >> >> > Sending goaway on channel Http2Channel peer >> >> > /127.0.0.1:64697 local /127.0.0.1:7777[ No Receiver [] -- [] -- []]: >> >> > java.nio.channels.ClosedChannelException >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:753) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) >> >> > at >> >> > >> >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) >> >> > at >> >> > >> >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> >> > at >> >> > >> >> > >> >> > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) >> >> > at >> >> > org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) >> >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) >> >> > >> >> > 10:20:14,476 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io] >> >> > Channel Http2Channel peer >> >> > /127.0.0.1:64697 >> >> > local /127.0.0.1:7777[ No Receiver [] -- [] -- []] is being closed: >> >> > java.nio.channels.ClosedChannelException >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:791) >> >> > at org.xnio.IoUtils.safeClose(IoUtils.java:134) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:767) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:744) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:478) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:317) >> >> > at >> >> > >> >> > >> >> > io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:65) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:452) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:106) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:57) >> >> > at >> >> > >> >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:931) >> >> > at >> >> > >> >> > >> >> > io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:912) >> >> > at >> >> > >> >> > org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) >> >> > at >> >> > >> >> > >> >> > org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) >> >> > at >> >> > org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) >> >> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559) >> >> > >> >> > >> >> > On Tue, Mar 21, 2017 at 11:39 PM, Stuart Douglas >> >> > >> >> > wrote: >> >> >> >> >> >> On Wed, Mar 22, 2017 at 12:50 PM, Steve Hu >> >> >> wrote: >> >> >> > Hi Stuart, >> >> >> > >> >> >> > I debugged into the ALPN code and found some issues with >> >> >> > Http2Client. >> >> >> > >> >> >> > I started with the Http2Server example and found >> >> >> > LoadBalancingProxyClient is >> >> >> > using an instance of UndertowClient which can only load HTTP1.1 >> >> >> > ClientProviders. The following is the code to get ClientProvider >> >> >> > and >> >> >> > only >> >> >> > "http" or "https" can be the return from uri.getSchema(). >> >> >> > >> >> >> > ClientProvider provider = clientProviders.get(uri.getScheme()); >> >> >> > >> >> >> > If this is true, then the communication between the proxy and >> >> >> > Http/2 >> >> >> > server >> >> >> > is Http/1.1 >> >> >> >> >> >> You need to pass in the ENABLE_HTTP2 option in the OptionsMap. For >> >> >> http URI's this means that the client will attempt an upgrade on the >> >> >> first request, for https URI's ALPN will be used to try and >> >> >> negotiate >> >> >> HTTP/2. This is how browsers behave, and will work even if the >> >> >> target >> >> >> does not support HTTP/2. >> >> >> >> >> >> One thing I did notice that I fixed upstream was that the Undertow >> >> >> builder was not registering a HTTP2UpgradeHandler when HTTP/2 was >> >> >> enabled, which has been fixed. >> >> >> >> >> >> > >> >> >> > In addition, I have created a new class UndertowHttp2Client and >> >> >> > Http2ClientTestCase in my forked repo to try >> >> >> > >> >> >> > the Http2ClientProviders and found all three http2 client >> >> >> > providers >> >> >> > don't >> >> >> > work as expected. >> >> >> > >> >> >> > h2c and h2-prior got 200 response code back during handshake and >> >> >> > h2 >> >> >> > works >> >> >> > but the connection is still http 1.1 >> >> >> >> >> >> I think this was probably caused by the lack of the upgrade handler >> >> >> (well for h2c, h2c-prior should still work). >> >> >> >> >> >> Stuart >> >> >> >> >> >> > >> >> >> > I am debugging the ALPN code now but it is very slow as I have to >> >> >> > dig >> >> >> > into >> >> >> > the spec to learn how the handshake works. >> >> >> > >> >> >> > As you have resolved the ALPN boot jar issue with the hack, I >> >> >> > think >> >> >> > Undertow >> >> >> > is very usable for HTTP/2 and it would >> >> >> > >> >> >> > be perfect if the client is working as well. Could you please >> >> >> > confirm >> >> >> > my >> >> >> > findings and let me know direction I should >> >> >> > >> >> >> > focus on? >> >> >> >> >> >> >> >> >> > >> >> >> > >> >> >> > Thanks, >> >> >> > >> >> >> > >> >> >> > Steve >> >> >> > >> >> >> > >> >> >> > Here is my repo with UndertowHttp2Client and Test. >> >> >> > >> >> >> > https://github.com/stevehu/undertow >> >> >> > >> >> >> > >> >> >> > And here is the files I have added. >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > https://github.com/stevehu/undertow/blob/master/core/src/main/java/io/undertow/client/UndertowHttp2Client.java >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > https://github.com/stevehu/undertow/blob/master/core/src/test/java/io/undertow/client/http/Http2ClientTestCase.java >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > On Sun, Mar 19, 2017 at 8:23 PM, Stuart Douglas >> >> >> > >> >> >> > wrote: >> >> >> >> >> >> >> >> I don't really have time to do it (there is no real benefit for >> >> >> >> Undertow, so it is not high on my priority list), but the code is >> >> >> >> all >> >> >> >> Apache licensed so there is no reason why you can't start a >> >> >> >> project >> >> >> >> that provides this code as a standalone implementation. >> >> >> >> >> >> >> >> You would still need to implement code in Netty etc to actually >> >> >> >> use >> >> >> >> this as well, as there is no standardized ALPN API yet. >> >> >> >> >> >> >> >> Stuart >> >> >> >> >> >> >> >> On Mon, Mar 20, 2017 at 11:07 AM, Steve Hu >> >> >> >> wrote: >> >> >> >> > I am reading the code in client package and they look really >> >> >> >> > good. >> >> >> >> > As >> >> >> >> > currently none of the http/2 client library has a work around >> >> >> >> > on >> >> >> >> > alpn >> >> >> >> > boot >> >> >> >> > jar and this blocks majority of developers to move to http/2. I >> >> >> >> > am >> >> >> >> > wondering >> >> >> >> > if you want to split client package to a standalone client >> >> >> >> > module >> >> >> >> > so >> >> >> >> > that it >> >> >> >> > can be used by other developers to connect to servers that >> >> >> >> > implement >> >> >> >> > http/2. >> >> >> >> > If you are interested in it, I can help to create a pull >> >> >> >> > request >> >> >> >> > and >> >> >> >> > add >> >> >> >> > some test cases while I am working on my own client >> >> >> >> > implementation. >> >> >> >> > Thanks. >> >> >> >> > >> >> >> >> > On Sun, Mar 19, 2017 at 5:32 PM, Stuart Douglas >> >> >> >> > >> >> >> >> > wrote: >> >> >> >> >> >> >> >> >> >> You could use Undertow's HTTP/2 client, although it's API was >> >> >> >> >> designed >> >> >> >> >> around the reverse proxy use case and as a result is not ideal >> >> >> >> >> for >> >> >> >> >> the >> >> >> >> >> general purpose HTTP client use case (although it is still >> >> >> >> >> perfectly >> >> >> >> >> usable). >> >> >> >> >> >> >> >> >> >> In terms of using Undertow's ALPN implementation with Netty >> >> >> >> >> etc >> >> >> >> >> it >> >> >> >> >> would require someone to port it over. The code is at [1] if >> >> >> >> >> you >> >> >> >> >> are >> >> >> >> >> interested. >> >> >> >> >> >> >> >> >> >> Stuart >> >> >> >> >> >> >> >> >> >> [1] >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/protocols/ssl/ALPNHackSSLEngine.java >> >> >> >> >> >> >> >> >> >> On Mon, Mar 20, 2017 at 7:21 AM, Steve Hu >> >> >> >> >> wrote: >> >> >> >> >> > Thanks Stuart for the quick response. Now I have server >> >> >> >> >> > started >> >> >> >> >> > with >> >> >> >> >> > HTTP/2 >> >> >> >> >> > and it works perfect with some client tools. Now I am >> >> >> >> >> > looking >> >> >> >> >> > for >> >> >> >> >> > Java >> >> >> >> >> > HTTP/2 client libraries to update my client module to >> >> >> >> >> > support >> >> >> >> >> > HTTP/2 >> >> >> >> >> > protocol for microservices communication. There are three >> >> >> >> >> > major >> >> >> >> >> > libraries >> >> >> >> >> > okhttp, jetty and netty but all of them require Jetty's ALPN >> >> >> >> >> > boot >> >> >> >> >> > JAR. I >> >> >> >> >> > saw >> >> >> >> >> > you have resolved the boot jar dependency in Undertow and am >> >> >> >> >> > wondering >> >> >> >> >> > if >> >> >> >> >> > you could point me to the right direction. Do you have any >> >> >> >> >> > recommendation >> >> >> >> >> > for HTTP/2 client library? How do you work around the alpn >> >> >> >> >> > boot >> >> >> >> >> > jar? >> >> >> >> >> > Is >> >> >> >> >> > the >> >> >> >> >> > same solution can be used by okhttp, jetty and netty before >> >> >> >> >> > Java 9 >> >> >> >> >> > is >> >> >> >> >> > released? >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > On Fri, Mar 17, 2017 at 11:03 PM, Stuart Douglas >> >> >> >> >> > >> >> >> >> >> > wrote: >> >> >> >> >> >> >> >> >> >> >> >> No, that is a debug level message. The JDK8 ALPN provider >> >> >> >> >> >> should >> >> >> >> >> >> still >> >> >> >> >> >> be registered. >> >> >> >> >> >> >> >> >> >> >> >> Stuart >> >> >> >> >> >> >> >> >> >> >> >> On Sat, Mar 18, 2017 at 12:18 PM, Steve Hu >> >> >> >> >> >> >> >> >> >> >> >> wrote: >> >> >> >> >> >> > Hi, >> >> >> >> >> >> > >> >> >> >> >> >> > I searched this mailing list and one post mentioned that >> >> >> >> >> >> > I >> >> >> >> >> >> > don't >> >> >> >> >> >> > need >> >> >> >> >> >> > to >> >> >> >> >> >> > use >> >> >> >> >> >> > -Xbootclasspath/p: after >> >> >> >> >> >> > 1.4.0Final. >> >> >> >> >> >> > I >> >> >> >> >> >> > am >> >> >> >> >> >> > trying >> >> >> >> >> >> > HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but >> >> >> >> >> >> > when >> >> >> >> >> >> > I >> >> >> >> >> >> > start >> >> >> >> >> >> > the >> >> >> >> >> >> > server I got the following error. Do I have to use >> >> >> >> >> >> > OpenJDK >> >> >> >> >> >> > 8? >> >> >> >> >> >> > If I >> >> >> >> >> >> > switch to >> >> >> >> >> >> > JBoss OpenSSL implementation? >> >> >> >> >> >> > >> >> >> >> >> >> > Thanks, >> >> >> >> >> >> > >> >> >> >> >> >> > Steve >> >> >> >> >> >> > >> >> >> >> >> >> > 21:00:36.468 [main] DEBUG io.undertow - Configuring >> >> >> >> >> >> > listener >> >> >> >> >> >> > with >> >> >> >> >> >> > protocol >> >> >> >> >> >> > HTTPS for interface 0.0.0.0 and port 8843 >> >> >> >> >> >> > >> >> >> >> >> >> > 21:00:36.486 [main] DEBUG io.undertow - JDK9 ALPN not >> >> >> >> >> >> > supported >> >> >> >> >> >> > >> >> >> >> >> >> > java.lang.NoSuchMethodException: >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > javax.net.ssl.SSLParameters.setApplicationProtocols([Ljava.lang.String;) >> >> >> >> >> >> > >> >> >> >> >> >> > at java.lang.Class.getMethod(Class.java:1786) >> >> >> >> >> >> > >> >> >> >> >> >> > at >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:47) >> >> >> >> >> >> > >> >> >> >> >> >> > at >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:43) >> >> >> >> >> >> > >> >> >> >> >> >> > at java.security.AccessController.doPrivileged(Native >> >> >> >> >> >> > Method) >> >> >> >> >> >> > >> >> >> >> >> >> > at >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider.(JDK9AlpnProvider.java:43) >> >> >> >> >> >> > >> >> >> >> >> >> > at >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native >> >> >> >> >> >> > Method) >> >> >> >> >> >> > >> >> >> >> >> >> > at >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) >> >> >> >> >> >> > >> >> >> >> >> >> > at >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >> >> >> >> >> >> > >> >> >> >> >> >> > at >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > java.lang.reflect.Constructor.newInstance(Constructor.java:423) >> >> >> >> >> >> > >> >> >> >> >> >> > at java.lang.Class.newInstance(Class.java:442) >> >> >> >> >> >> > >> >> >> >> >> >> > at >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380) >> >> >> >> >> >> > >> >> >> >> >> >> > at >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) >> >> >> >> >> >> > >> >> >> >> >> >> > at java.util.ServiceLoader$1.next(ServiceLoader.java:480) >> >> >> >> >> >> > >> >> >> >> >> >> > at >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:40) >> >> >> >> >> >> > >> >> >> >> >> >> > at >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > io.undertow.protocols.alpn.ALPNManager.(ALPNManager.java:35) >> >> >> >> >> >> > >> >> >> >> >> >> > at >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.(AlpnOpenListener.java:67) >> >> >> >> >> >> > >> >> >> >> >> >> > at >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.(AlpnOpenListener.java:90) >> >> >> >> >> >> > >> >> >> >> >> >> > at io.undertow.Undertow.start(Undertow.java:179) >> >> >> >> >> >> > >> >> >> >> >> >> > at com.networknt.server.Server.start(Server.java:170) >> >> >> >> >> >> > >> >> >> >> >> >> > at com.networknt.server.Server.main(Server.java:90) >> >> >> >> >> >> > >> >> >> >> >> >> > 21:00:36.503 [main] INFO com.networknt.server.Server - >> >> >> >> >> >> > Https >> >> >> >> >> >> > Server >> >> >> >> >> >> > started on ip:0.0.0.0 Port:8843 >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > _______________________________________________ >> >> >> >> >> >> > undertow-dev mailing list >> >> >> >> >> >> > undertow-dev at lists.jboss.org >> >> >> >> >> >> > https://lists.jboss.org/mailman/listinfo/undertow-dev >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> > >> >> >> > >> >> > >> >> > >> > >> > > > From ebenzacar at gmail.com Mon Mar 27 23:19:08 2017 From: ebenzacar at gmail.com (Eric B) Date: Mon, 27 Mar 2017 23:19:08 -0400 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? Message-ID: I've been trying to figure out how to build my own custom SessionManager to push my sessions into Redis with a custom SessionConfig implementation, but am having trouble finding any documentation to that extent. For the SesisonManager, I've read that I need to: 1. Develop SessionManager which implements io.undertow.server.session.Ses sionManager 2. Develop SessionManagerFactory which implements io.undertow.servlet.api.SessionManagerFactory 3. Develop startup extension which implements io.undertow.servlet.ServletExtension, and in handleDeployment(Deployment) method change sessionManagerFactory with new SessionManagerFactory. 4. Register new ServletExtension by adding ../META-INF/services/io.undertow.servlet.ServletExtension file (file should contain the name of new ServletExtension. for example com.my.utils.StartupExtension) But I can't seem to find anything that indicates how to provide my own SessionConfig implementation. How do I register a custom SessionConfig implementation? Is there any documentation to that extent? Are there any examples that can show me how to create my own SessionManager and SessionConfig object? Thanks, Eric -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170327/36d78fc5/attachment.html From sdouglas at redhat.com Tue Mar 28 19:57:13 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Wed, 29 Mar 2017 10:57:13 +1100 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: Why do you need a custom SessionConfig? In general Servlet will use its own SessionConfig that matches the configuration of the deployed application (generally just using a JSESSIONID cookie, unless it has been customized). Stuart On Tue, Mar 28, 2017 at 2:19 PM, Eric B wrote: > I've been trying to figure out how to build my own custom SessionManager to > push my sessions into Redis with a custom SessionConfig implementation, but > am having trouble finding any documentation to that extent. > > For the SesisonManager, I've read that I need to: > > Develop SessionManager which implements > io.undertow.server.session.SessionManager > Develop SessionManagerFactory which implements > io.undertow.servlet.api.SessionManagerFactory > Develop startup extension which implements > io.undertow.servlet.ServletExtension, and in handleDeployment(Deployment) > method change sessionManagerFactory with new SessionManagerFactory. > Register new ServletExtension by adding > ../META-INF/services/io.undertow.servlet.ServletExtension file (file should > contain the name of new ServletExtension. for example > com.my.utils.StartupExtension) > > > But I can't seem to find anything that indicates how to provide my own > SessionConfig implementation. How do I register a custom SessionConfig > implementation? Is there any documentation to that extent? > > Are there any examples that can show me how to create my own SessionManager > and SessionConfig object? > > Thanks, > > Eric > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From ebenzacar at gmail.com Tue Mar 28 21:41:14 2017 From: ebenzacar at gmail.com (Eric B) Date: Tue, 28 Mar 2017 21:41:14 -0400 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: Stuart, My goal is to actually replace the JSESSIONID cookie/mechanism with my own mechanism. I am looking to use a JsonWebToken (JWT) to pass my JSESSIONID to the application for a few different reasons: 1) I would like to sign the JSESSIONID 2) I would like to pass additional data along with the JSESSIONID (ex: some auth claims) 3) I want to be able to share this information between different containers 4) I want to pass a TTL with my token At some level, I am trying to hack together an SSO solution temporarily which would allow me to log into one container, and have some credentials pass to another container. My issue is that both containers are session based, and hence, need to be able to retrieve a session from a sessionId. However, I also want to make sure that sessions don't expire - that is if I am working in container 2, that my session in container 1 continues to live (if the user gets redirected back to container 1). So, in essence, I am looking to be able to extract my SessionId from a mechanism other than the standard JSESSIONID cookie, but yet, still continue to use the sessions seamlessly. I figure I could potentially hack around the design using the SessionConfigWrapper in which I use the wrap() method to return my own SessionConfig object, but that does not seem to fit in the spirit or design of the wrapper. Is there another/better way to accomplish something like this? Or is undertow designed with only the JSESSIONID cookie in mind? I did notice the SessionConfig.SessionCookieSource enum with value OTHER, but cannot seem to see/figure out where that is used, or how to leverage that setting. I looked through the ServletContextImpl class but only see the SessionTrackingMode of COOKIE, SSL and URL available. Any help/insight would be greatly appreciated. Thanks, Eric On Tue, Mar 28, 2017 at 7:57 PM, Stuart Douglas wrote: > Why do you need a custom SessionConfig? In general Servlet will use > its own SessionConfig that matches the configuration of the deployed > application (generally just using a JSESSIONID cookie, unless it has > been customized). > > Stuart > > On Tue, Mar 28, 2017 at 2:19 PM, Eric B wrote: > > I've been trying to figure out how to build my own custom SessionManager > to > > push my sessions into Redis with a custom SessionConfig implementation, > but > > am having trouble finding any documentation to that extent. > > > > For the SesisonManager, I've read that I need to: > > > > Develop SessionManager which implements > > io.undertow.server.session.SessionManager > > Develop SessionManagerFactory which implements > > io.undertow.servlet.api.SessionManagerFactory > > Develop startup extension which implements > > io.undertow.servlet.ServletExtension, and in > handleDeployment(Deployment) > > method change sessionManagerFactory with new SessionManagerFactory. > > Register new ServletExtension by adding > > ../META-INF/services/io.undertow.servlet.ServletExtension file (file > should > > contain the name of new ServletExtension. for example > > com.my.utils.StartupExtension) > > > > > > But I can't seem to find anything that indicates how to provide my own > > SessionConfig implementation. How do I register a custom SessionConfig > > implementation? Is there any documentation to that extent? > > > > Are there any examples that can show me how to create my own > SessionManager > > and SessionConfig object? > > > > Thanks, > > > > Eric > > > > _______________________________________________ > > undertow-dev mailing list > > undertow-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170328/9b99cb1e/attachment.html From bill at dartalley.com Wed Mar 29 07:01:22 2017 From: bill at dartalley.com (Bill O'Neil) Date: Wed, 29 Mar 2017 07:01:22 -0400 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: If you want such a custom solution why not just use a cookie and ignore all of the SessionConfig code. You can write a handler that checks for the cookie and attaches your own custom session object to the exchange based on the cookie. On Tue, Mar 28, 2017 at 9:41 PM, Eric B wrote: > Stuart, > > My goal is to actually replace the JSESSIONID cookie/mechanism with my own > mechanism. I am looking to use a JsonWebToken (JWT) to pass my JSESSIONID > to the application for a few different reasons: > 1) I would like to sign the JSESSIONID > 2) I would like to pass additional data along with the JSESSIONID (ex: > some auth claims) > 3) I want to be able to share this information between different containers > 4) I want to pass a TTL with my token > > > At some level, I am trying to hack together an SSO solution temporarily > which would allow me to log into one container, and have some credentials > pass to another container. My issue is that both containers are session > based, and hence, need to be able to retrieve a session from a sessionId. > However, I also want to make sure that sessions don't expire - that is if I > am working in container 2, that my session in container 1 continues to live > (if the user gets redirected back to container 1). > > So, in essence, I am looking to be able to extract my SessionId from a > mechanism other than the standard JSESSIONID cookie, but yet, still > continue to use the sessions seamlessly. > > I figure I could potentially hack around the design using the > SessionConfigWrapper in which I use the wrap() method to return my own > SessionConfig object, but that does not seem to fit in the spirit or design > of the wrapper. > > Is there another/better way to accomplish something like this? Or is > undertow designed with only the JSESSIONID cookie in mind? I did notice > the > SessionConfig.SessionCookieSource enum with value OTHER, but cannot seem > to see/figure out where that is used, or how to leverage that setting. I > looked through the ServletContextImpl class but only see the > SessionTrackingMode of COOKIE, SSL and URL available. > > Any help/insight would be greatly appreciated. > > Thanks, > > Eric > > > On Tue, Mar 28, 2017 at 7:57 PM, Stuart Douglas > wrote: > >> Why do you need a custom SessionConfig? In general Servlet will use >> its own SessionConfig that matches the configuration of the deployed >> application (generally just using a JSESSIONID cookie, unless it has >> been customized). >> >> Stuart >> >> On Tue, Mar 28, 2017 at 2:19 PM, Eric B wrote: >> > I've been trying to figure out how to build my own custom >> SessionManager to >> > push my sessions into Redis with a custom SessionConfig implementation, >> but >> > am having trouble finding any documentation to that extent. >> > >> > For the SesisonManager, I've read that I need to: >> > >> > Develop SessionManager which implements >> > io.undertow.server.session.SessionManager >> > Develop SessionManagerFactory which implements >> > io.undertow.servlet.api.SessionManagerFactory >> > Develop startup extension which implements >> > io.undertow.servlet.ServletExtension, and in >> handleDeployment(Deployment) >> > method change sessionManagerFactory with new SessionManagerFactory. >> > Register new ServletExtension by adding >> > ../META-INF/services/io.undertow.servlet.ServletExtension file (file >> should >> > contain the name of new ServletExtension. for example >> > com.my.utils.StartupExtension) >> > >> > >> > But I can't seem to find anything that indicates how to provide my own >> > SessionConfig implementation. How do I register a custom SessionConfig >> > implementation? Is there any documentation to that extent? >> > >> > Are there any examples that can show me how to create my own >> SessionManager >> > and SessionConfig object? >> > >> > Thanks, >> > >> > Eric >> > >> > _______________________________________________ >> > undertow-dev mailing list >> > undertow-dev at lists.jboss.org >> > https://lists.jboss.org/mailman/listinfo/undertow-dev >> > > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/6a51a2e8/attachment-0001.html From ebenzacar at gmail.com Wed Mar 29 07:09:57 2017 From: ebenzacar at gmail.com (Eric B) Date: Wed, 29 Mar 2017 07:09:57 -0400 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: >From my understanding, I was thinking/planning to create my own SessionManager to handle the Session loading. And from the docs, it indicates that the SessionManager must delegate retrieving the sessionId to the SessionConfig object. Am I heading down the wrong path? Is there an easier/another way to load/persist the session? Thanks Eric On Mar 29, 2017 7:01 AM, "Bill O'Neil" wrote: If you want such a custom solution why not just use a cookie and ignore all of the SessionConfig code. You can write a handler that checks for the cookie and attaches your own custom session object to the exchange based on the cookie. On Tue, Mar 28, 2017 at 9:41 PM, Eric B wrote: > Stuart, > > My goal is to actually replace the JSESSIONID cookie/mechanism with my own > mechanism. I am looking to use a JsonWebToken (JWT) to pass my JSESSIONID > to the application for a few different reasons: > 1) I would like to sign the JSESSIONID > 2) I would like to pass additional data along with the JSESSIONID (ex: > some auth claims) > 3) I want to be able to share this information between different containers > 4) I want to pass a TTL with my token > > > At some level, I am trying to hack together an SSO solution temporarily > which would allow me to log into one container, and have some credentials > pass to another container. My issue is that both containers are session > based, and hence, need to be able to retrieve a session from a sessionId. > However, I also want to make sure that sessions don't expire - that is if I > am working in container 2, that my session in container 1 continues to live > (if the user gets redirected back to container 1). > > So, in essence, I am looking to be able to extract my SessionId from a > mechanism other than the standard JSESSIONID cookie, but yet, still > continue to use the sessions seamlessly. > > I figure I could potentially hack around the design using the > SessionConfigWrapper in which I use the wrap() method to return my own > SessionConfig object, but that does not seem to fit in the spirit or design > of the wrapper. > > Is there another/better way to accomplish something like this? Or is > undertow designed with only the JSESSIONID cookie in mind? I did notice > the > SessionConfig.SessionCookieSource enum with value OTHER, but cannot seem > to see/figure out where that is used, or how to leverage that setting. I > looked through the ServletContextImpl class but only see the > SessionTrackingMode of COOKIE, SSL and URL available. > > Any help/insight would be greatly appreciated. > > Thanks, > > Eric > > > On Tue, Mar 28, 2017 at 7:57 PM, Stuart Douglas > wrote: > >> Why do you need a custom SessionConfig? In general Servlet will use >> its own SessionConfig that matches the configuration of the deployed >> application (generally just using a JSESSIONID cookie, unless it has >> been customized). >> >> Stuart >> >> On Tue, Mar 28, 2017 at 2:19 PM, Eric B wrote: >> > I've been trying to figure out how to build my own custom >> SessionManager to >> > push my sessions into Redis with a custom SessionConfig implementation, >> but >> > am having trouble finding any documentation to that extent. >> > >> > For the SesisonManager, I've read that I need to: >> > >> > Develop SessionManager which implements >> > io.undertow.server.session.SessionManager >> > Develop SessionManagerFactory which implements >> > io.undertow.servlet.api.SessionManagerFactory >> > Develop startup extension which implements >> > io.undertow.servlet.ServletExtension, and in >> handleDeployment(Deployment) >> > method change sessionManagerFactory with new SessionManagerFactory. >> > Register new ServletExtension by adding >> > ../META-INF/services/io.undertow.servlet.ServletExtension file (file >> should >> > contain the name of new ServletExtension. for example >> > com.my.utils.StartupExtension) >> > >> > >> > But I can't seem to find anything that indicates how to provide my own >> > SessionConfig implementation. How do I register a custom SessionConfig >> > implementation? Is there any documentation to that extent? >> > >> > Are there any examples that can show me how to create my own >> SessionManager >> > and SessionConfig object? >> > >> > Thanks, >> > >> > Eric >> > >> > _______________________________________________ >> > undertow-dev mailing list >> > undertow-dev at lists.jboss.org >> > https://lists.jboss.org/mailman/listinfo/undertow-dev >> > > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/97038005/attachment.html From antoine.girard at ymail.com Wed Mar 29 07:24:33 2017 From: antoine.girard at ymail.com (Antoine Girard) Date: Wed, 29 Mar 2017 13:24:33 +0200 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: I did a similar thing once: persisting sessions into a Redis data store. My starting point was the InMemorySessionManager. Good luck to you! Cheers, Antoine On Wed, Mar 29, 2017 at 1:09 PM, Eric B wrote: > From my understanding, I was thinking/planning to create my own > SessionManager to handle the Session loading. And from the docs, it > indicates that the SessionManager must delegate retrieving the sessionId to > the SessionConfig object. > > Am I heading down the wrong path? Is there an easier/another way to > load/persist the session? > > Thanks > > Eric > > > > On Mar 29, 2017 7:01 AM, "Bill O'Neil" > wrote: > > If you want such a custom solution why not just use a cookie and ignore > all of the SessionConfig code. You can write a handler that checks for > the cookie and attaches your own custom session object to the exchange > based on the cookie. > > On Tue, Mar 28, 2017 at 9:41 PM, Eric B wrote: > >> Stuart, >> >> My goal is to actually replace the JSESSIONID cookie/mechanism with my >> own mechanism. I am looking to use a JsonWebToken (JWT) to pass my >> JSESSIONID to the application for a few different reasons: >> 1) I would like to sign the JSESSIONID >> 2) I would like to pass additional data along with the JSESSIONID (ex: >> some auth claims) >> 3) I want to be able to share this information between different >> containers >> 4) I want to pass a TTL with my token >> >> >> At some level, I am trying to hack together an SSO solution temporarily >> which would allow me to log into one container, and have some credentials >> pass to another container. My issue is that both containers are session >> based, and hence, need to be able to retrieve a session from a sessionId. >> However, I also want to make sure that sessions don't expire - that is if I >> am working in container 2, that my session in container 1 continues to live >> (if the user gets redirected back to container 1). >> >> So, in essence, I am looking to be able to extract my SessionId from a >> mechanism other than the standard JSESSIONID cookie, but yet, still >> continue to use the sessions seamlessly. >> >> I figure I could potentially hack around the design using the >> SessionConfigWrapper in which I use the wrap() method to return my own >> SessionConfig object, but that does not seem to fit in the spirit or design >> of the wrapper. >> >> Is there another/better way to accomplish something like this? Or is >> undertow designed with only the JSESSIONID cookie in mind? I did notice >> the >> SessionConfig.SessionCookieSource enum with value OTHER, but cannot >> seem to see/figure out where that is used, or how to leverage that >> setting. I looked through the ServletContextImpl class but only see the >> SessionTrackingMode of COOKIE, SSL and URL available. >> >> Any help/insight would be greatly appreciated. >> >> Thanks, >> >> Eric >> >> >> On Tue, Mar 28, 2017 at 7:57 PM, Stuart Douglas >> wrote: >> >>> Why do you need a custom SessionConfig? In general Servlet will use >>> its own SessionConfig that matches the configuration of the deployed >>> application (generally just using a JSESSIONID cookie, unless it has >>> been customized). >>> >>> Stuart >>> >>> On Tue, Mar 28, 2017 at 2:19 PM, Eric B wrote: >>> > I've been trying to figure out how to build my own custom >>> SessionManager to >>> > push my sessions into Redis with a custom SessionConfig >>> implementation, but >>> > am having trouble finding any documentation to that extent. >>> > >>> > For the SesisonManager, I've read that I need to: >>> > >>> > Develop SessionManager which implements >>> > io.undertow.server.session.SessionManager >>> > Develop SessionManagerFactory which implements >>> > io.undertow.servlet.api.SessionManagerFactory >>> > Develop startup extension which implements >>> > io.undertow.servlet.ServletExtension, and in >>> handleDeployment(Deployment) >>> > method change sessionManagerFactory with new SessionManagerFactory. >>> > Register new ServletExtension by adding >>> > ../META-INF/services/io.undertow.servlet.ServletExtension file (file >>> should >>> > contain the name of new ServletExtension. for example >>> > com.my.utils.StartupExtension) >>> > >>> > >>> > But I can't seem to find anything that indicates how to provide my own >>> > SessionConfig implementation. How do I register a custom SessionConfig >>> > implementation? Is there any documentation to that extent? >>> > >>> > Are there any examples that can show me how to create my own >>> SessionManager >>> > and SessionConfig object? >>> > >>> > Thanks, >>> > >>> > Eric >>> > >>> > _______________________________________________ >>> > undertow-dev mailing list >>> > undertow-dev at lists.jboss.org >>> > https://lists.jboss.org/mailman/listinfo/undertow-dev >>> >> >> >> _______________________________________________ >> undertow-dev mailing list >> undertow-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/undertow-dev >> > > > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/1da7d0c7/attachment-0001.html From ebenzacar at gmail.com Wed Mar 29 07:48:15 2017 From: ebenzacar at gmail.com (Eric B) Date: Wed, 29 Mar 2017 07:48:15 -0400 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: Antoine, That's exactly where I am heading too. Is there any chance you still have our can share the code you used to do that? Thanks, Eric On Mar 29, 2017 7:24 AM, "Antoine Girard" wrote: > I did a similar thing once: persisting sessions into a Redis data store. > My starting point was the InMemorySessionManager. > > Good luck to you! > > Cheers, > Antoine > > On Wed, Mar 29, 2017 at 1:09 PM, Eric B wrote: > >> From my understanding, I was thinking/planning to create my own >> SessionManager to handle the Session loading. And from the docs, it >> indicates that the SessionManager must delegate retrieving the sessionId to >> the SessionConfig object. >> >> Am I heading down the wrong path? Is there an easier/another way to >> load/persist the session? >> >> Thanks >> >> Eric >> >> >> >> On Mar 29, 2017 7:01 AM, "Bill O'Neil" > > wrote: >> >> If you want such a custom solution why not just use a cookie and ignore >> all of the SessionConfig code. You can write a handler that checks for >> the cookie and attaches your own custom session object to the exchange >> based on the cookie. >> >> On Tue, Mar 28, 2017 at 9:41 PM, Eric B wrote: >> >>> Stuart, >>> >>> My goal is to actually replace the JSESSIONID cookie/mechanism with my >>> own mechanism. I am looking to use a JsonWebToken (JWT) to pass my >>> JSESSIONID to the application for a few different reasons: >>> 1) I would like to sign the JSESSIONID >>> 2) I would like to pass additional data along with the JSESSIONID (ex: >>> some auth claims) >>> 3) I want to be able to share this information between different >>> containers >>> 4) I want to pass a TTL with my token >>> >>> >>> At some level, I am trying to hack together an SSO solution temporarily >>> which would allow me to log into one container, and have some credentials >>> pass to another container. My issue is that both containers are session >>> based, and hence, need to be able to retrieve a session from a sessionId. >>> However, I also want to make sure that sessions don't expire - that is if I >>> am working in container 2, that my session in container 1 continues to live >>> (if the user gets redirected back to container 1). >>> >>> So, in essence, I am looking to be able to extract my SessionId from a >>> mechanism other than the standard JSESSIONID cookie, but yet, still >>> continue to use the sessions seamlessly. >>> >>> I figure I could potentially hack around the design using the >>> SessionConfigWrapper in which I use the wrap() method to return my own >>> SessionConfig object, but that does not seem to fit in the spirit or design >>> of the wrapper. >>> >>> Is there another/better way to accomplish something like this? Or is >>> undertow designed with only the JSESSIONID cookie in mind? I did notice >>> the >>> SessionConfig.SessionCookieSource enum with value OTHER, but cannot >>> seem to see/figure out where that is used, or how to leverage that >>> setting. I looked through the ServletContextImpl class but only see the >>> SessionTrackingMode of COOKIE, SSL and URL available. >>> >>> Any help/insight would be greatly appreciated. >>> >>> Thanks, >>> >>> Eric >>> >>> >>> On Tue, Mar 28, 2017 at 7:57 PM, Stuart Douglas >>> wrote: >>> >>>> Why do you need a custom SessionConfig? In general Servlet will use >>>> its own SessionConfig that matches the configuration of the deployed >>>> application (generally just using a JSESSIONID cookie, unless it has >>>> been customized). >>>> >>>> Stuart >>>> >>>> On Tue, Mar 28, 2017 at 2:19 PM, Eric B wrote: >>>> > I've been trying to figure out how to build my own custom >>>> SessionManager to >>>> > push my sessions into Redis with a custom SessionConfig >>>> implementation, but >>>> > am having trouble finding any documentation to that extent. >>>> > >>>> > For the SesisonManager, I've read that I need to: >>>> > >>>> > Develop SessionManager which implements >>>> > io.undertow.server.session.SessionManager >>>> > Develop SessionManagerFactory which implements >>>> > io.undertow.servlet.api.SessionManagerFactory >>>> > Develop startup extension which implements >>>> > io.undertow.servlet.ServletExtension, and in >>>> handleDeployment(Deployment) >>>> > method change sessionManagerFactory with new SessionManagerFactory. >>>> > Register new ServletExtension by adding >>>> > ../META-INF/services/io.undertow.servlet.ServletExtension file (file >>>> should >>>> > contain the name of new ServletExtension. for example >>>> > com.my.utils.StartupExtension) >>>> > >>>> > >>>> > But I can't seem to find anything that indicates how to provide my own >>>> > SessionConfig implementation. How do I register a custom >>>> SessionConfig >>>> > implementation? Is there any documentation to that extent? >>>> > >>>> > Are there any examples that can show me how to create my own >>>> SessionManager >>>> > and SessionConfig object? >>>> > >>>> > Thanks, >>>> > >>>> > Eric >>>> > >>>> > _______________________________________________ >>>> > undertow-dev mailing list >>>> > undertow-dev at lists.jboss.org >>>> > https://lists.jboss.org/mailman/listinfo/undertow-dev >>>> >>> >>> >>> _______________________________________________ >>> undertow-dev mailing list >>> undertow-dev at lists.jboss.org >>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>> >> >> >> >> _______________________________________________ >> undertow-dev mailing list >> undertow-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/undertow-dev >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/f0911ac5/attachment.html From antoine.girard at ymail.com Wed Mar 29 07:59:57 2017 From: antoine.girard at ymail.com (Antoine Girard) Date: Wed, 29 Mar 2017 13:59:57 +0200 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: Hi Eric, Unfortunately I cannot share that code as it's company property. As far as I can remember, it was really easy. I used the java redis library: Jedis. Oh, and look what I found: https://github.com/coat/undertow-redis-session/blob/master/src/main/java/com/pedanticprogrammer/undertow/RedisSessionManager.java That's a good starting point, if not the complete solution right there. Cheers, Antoine On Wed, Mar 29, 2017 at 1:48 PM, Eric B wrote: > Antoine, > > That's exactly where I am heading too. Is there any chance you still have > our can share the code you used to do that? > > Thanks, > > Eric > > On Mar 29, 2017 7:24 AM, "Antoine Girard" > wrote: > >> I did a similar thing once: persisting sessions into a Redis data store >> My starting point was the InMemorySessionManager. >> >> Good luck to you! >> >> Cheers, >> Antoine >> >> On Wed, Mar 29, 2017 at 1:09 PM, Eric B wrote: >> >>> From my understanding, I was thinking/planning to create my own >>> SessionManager to handle the Session loading. And from the docs, it >>> indicates that the SessionManager must delegate retrieving the sessionId to >>> the SessionConfig object >>> >>> Am I heading down the wrong path? Is there an easier/another way to >>> load/persist the session? >>> >>> Thanks >>> >>> Eric >>> >>> >>> >>> On Mar 29, 2017 7:01 AM, "Bill O'Neil" wrote: >>> >>> If you want such a custom solution why not just use a cookie and ignore >>> all of the SessionConfig code. You can write a handler that checks for >>> the cookie and attaches your own custom session object to the exchange >>> based on the cookie. >>> >>> On Tue, Mar 28, 2017 at 9:41 PM, Eric B wrote: >>> >>>> Stuart, >>>> >>>> My goal is to actually replace the JSESSIONID cookie/mechanism with my >>>> own mechanism. I am looking to use a JsonWebToken (JWT) to pass my >>>> JSESSIONID to the application for a few different reasons: >>>> 1) I would like to sign the JSESSIONID >>>> 2) I would like to pass additional data along with the JSESSIONID (ex: >>>> some auth claims) >>>> 3) I want to be able to share this information between different >>>> containers >>>> 4) I want to pass a TTL with my token >>>> >>>> >>>> At some level, I am trying to hack together an SSO solution temporarily >>>> which would allow me to log into one container, and have some credentials >>>> pass to another container. My issue is that both containers are session >>>> based, and hence, need to be able to retrieve a session from a sessionId. >>>> However, I also want to make sure that sessions don't expire - that is if I >>>> am working in container 2, that my session in container 1 continues to live >>>> (if the user gets redirected back to container 1). >>>> >>>> So, in essence, I am looking to be able to extract my SessionId from a >>>> mechanism other than the standard JSESSIONID cookie, but yet, still >>>> continue to use the sessions seamlessly. >>>> >>>> I figure I could potentially hack around the design using the >>>> SessionConfigWrapper in which I use the wrap() method to return my own >>>> SessionConfig object, but that does not seem to fit in the spirit or design >>>> of the wrapper. >>>> >>>> Is there another/better way to accomplish something like this? Or is >>>> undertow designed with only the JSESSIONID cookie in mind? I did notice >>>> the >>>> SessionConfig.SessionCookieSource enum with value OTHER, but cannot >>>> seem to see/figure out where that is used, or how to leverage that >>>> setting. I looked through the ServletContextImpl class but only see the >>>> SessionTrackingMode of COOKIE, SSL and URL available. >>>> >>>> Any help/insight would be greatly appreciated. >>>> >>>> Thanks, >>>> >>>> Eric >>>> >>>> >>>> On Tue, Mar 28, 2017 at 7:57 PM, Stuart Douglas >>>> wrote: >>>> >>>>> Why do you need a custom SessionConfig? In general Servlet will use >>>>> its own SessionConfig that matches the configuration of the deployed >>>>> application (generally just using a JSESSIONID cookie, unless it has >>>>> been customized). >>>>> >>>>> Stuart >>>>> >>>>> On Tue, Mar 28, 2017 at 2:19 PM, Eric B wrote: >>>>> > I've been trying to figure out how to build my own custom >>>>> SessionManager to >>>>> > push my sessions into Redis with a custom SessionConfig >>>>> implementation, but >>>>> > am having trouble finding any documentation to that extent. >>>>> > >>>>> > For the SesisonManager, I've read that I need to: >>>>> > >>>>> > Develop SessionManager which implements >>>>> > io.undertow.server.session.SessionManager >>>>> > Develop SessionManagerFactory which implements >>>>> > io.undertow.servlet.api.SessionManagerFactory >>>>> > Develop startup extension which implements >>>>> > io.undertow.servlet.ServletExtension, and in >>>>> handleDeployment(Deployment) >>>>> > method change sessionManagerFactory with new SessionManagerFactory. >>>>> > Register new ServletExtension by adding >>>>> > ../META-INF/services/io.undertow.servlet.ServletExtension file >>>>> (file should >>>>> > contain the name of new ServletExtension. for example >>>>> > com.my.utils.StartupExtension) >>>>> > >>>>> > >>>>> > But I can't seem to find anything that indicates how to provide my >>>>> own >>>>> > SessionConfig implementation. How do I register a custom >>>>> SessionConfig >>>>> > implementation? Is there any documentation to that extent? >>>>> > >>>>> > Are there any examples that can show me how to create my own >>>>> SessionManager >>>>> > and SessionConfig object? >>>>> > >>>>> > Thanks, >>>>> > >>>>> > Eric >>>>> > >>>>> > _______________________________________________ >>>>> > undertow-dev mailing list >>>>> > undertow-dev at lists.jboss.org >>>>> > https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>> >>>> >>>> >>>> _______________________________________________ >>>> undertow-dev mailing list >>>> undertow-dev at lists.jboss.org >>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>> >>> >>> >>> >>> _______________________________________________ >>> undertow-dev mailing list >>> undertow-dev at lists.jboss.org >>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>> >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/74b8aaaf/attachment-0001.html From ebenzacar at gmail.com Wed Mar 29 08:19:54 2017 From: ebenzacar at gmail.com (Eric B) Date: Wed, 29 Mar 2017 08:19:54 -0400 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: Thanks for the link; that is definitely going to be a big help for the redis bridge. But I'm still unclear as to the "right" way to use/define my own SessionConfig implementation. In the link you sent, they instantiate the RedisManager with the existing SessionConfig object, and use whatever undertow passes in the parameters. As I mentioned in my earlier post, I suspect I can hack around it using the SessionConfigWrapper but that does not seem to respect the spirit or intent of the wrapper, so I'm trying to figure out if there is another/better way to do this. Or is the only solution to completely ignore the SessionConfig object and build my solution independent of it? But then it will not respect the contract of the SessionManager to retrieve the Sessionid from the SC object. Thanks, Eric On Mar 29, 2017 8:00 AM, "Antoine Girard" wrote: Hi Eric, Unfortunately I cannot share that code as it's company property. As far as I can remember, it was really easy. I used the java redis library: Jedis. Oh, and look what I found: https://github.com/coat/undertow-redis-session/blob/ master/src/main/java/com/pedanticprogrammer/undertow/ RedisSessionManager.java That's a good starting point, if not the complete solution right there. Cheers, Antoine On Wed, Mar 29, 2017 at 1:48 PM, Eric B wrote: > Antoine, > > That's exactly where I am heading too. Is there any chance you still have > our can share the code you used to do that? > > Thanks, > > Eric > > On Mar 29, 2017 7:24 AM, "Antoine Girard" > wrote: > >> I did a similar thing once: persisting sessions into a Redis data store >> My starting point was the InMemorySessionManager. >> >> Good luck to you! >> >> Cheers, >> Antoine >> >> On Wed, Mar 29, 2017 at 1:09 PM, Eric B wrote: >> >>> From my understanding, I was thinking/planning to create my own >>> SessionManager to handle the Session loading. And from the docs, it >>> indicates that the SessionManager must delegate retrieving the sessionId to >>> the SessionConfig object >>> >>> Am I heading down the wrong path? Is there an easier/another way to >>> load/persist the session? >>> >>> Thanks >>> >>> Eric >>> >>> >>> >>> On Mar 29, 2017 7:01 AM, "Bill O'Neil" wrote: >>> >>> If you want such a custom solution why not just use a cookie and ignore >>> all of the SessionConfig code. You can write a handler that checks for >>> the cookie and attaches your own custom session object to the exchange >>> based on the cookie. >>> >>> On Tue, Mar 28, 2017 at 9:41 PM, Eric B wrote: >>> >>>> Stuart, >>>> >>>> My goal is to actually replace the JSESSIONID cookie/mechanism with my >>>> own mechanism. I am looking to use a JsonWebToken (JWT) to pass my >>>> JSESSIONID to the application for a few different reasons: >>>> 1) I would like to sign the JSESSIONID >>>> 2) I would like to pass additional data along with the JSESSIONID (ex: >>>> some auth claims) >>>> 3) I want to be able to share this information between different >>>> containers >>>> 4) I want to pass a TTL with my token >>>> >>>> >>>> At some level, I am trying to hack together an SSO solution temporarily >>>> which would allow me to log into one container, and have some credentials >>>> pass to another container. My issue is that both containers are session >>>> based, and hence, need to be able to retrieve a session from a sessionId. >>>> However, I also want to make sure that sessions don't expire - that is if I >>>> am working in container 2, that my session in container 1 continues to live >>>> (if the user gets redirected back to container 1). >>>> >>>> So, in essence, I am looking to be able to extract my SessionId from a >>>> mechanism other than the standard JSESSIONID cookie, but yet, still >>>> continue to use the sessions seamlessly. >>>> >>>> I figure I could potentially hack around the design using the >>>> SessionConfigWrapper in which I use the wrap() method to return my own >>>> SessionConfig object, but that does not seem to fit in the spirit or design >>>> of the wrapper. >>>> >>>> Is there another/better way to accomplish something like this? Or is >>>> undertow designed with only the JSESSIONID cookie in mind? I did notice >>>> the >>>> SessionConfig.SessionCookieSource enum with value OTHER, but cannot >>>> seem to see/figure out where that is used, or how to leverage that >>>> setting. I looked through the ServletContextImpl class but only see the >>>> SessionTrackingMode of COOKIE, SSL and URL available. >>>> >>>> Any help/insight would be greatly appreciated. >>>> >>>> Thanks, >>>> >>>> Eric >>>> >>>> >>>> On Tue, Mar 28, 2017 at 7:57 PM, Stuart Douglas >>>> wrote: >>>> >>>>> Why do you need a custom SessionConfig? In general Servlet will use >>>>> its own SessionConfig that matches the configuration of the deployed >>>>> application (generally just using a JSESSIONID cookie, unless it has >>>>> been customized). >>>>> >>>>> Stuart >>>>> >>>>> On Tue, Mar 28, 2017 at 2:19 PM, Eric B wrote: >>>>> > I've been trying to figure out how to build my own custom >>>>> SessionManager to >>>>> > push my sessions into Redis with a custom SessionConfig >>>>> implementation, but >>>>> > am having trouble finding any documentation to that extent. >>>>> > >>>>> > For the SesisonManager, I've read that I need to: >>>>> > >>>>> > Develop SessionManager which implements >>>>> > io.undertow.server.session.SessionManager >>>>> > Develop SessionManagerFactory which implements >>>>> > io.undertow.servlet.api.SessionManagerFactory >>>>> > Develop startup extension which implements >>>>> > io.undertow.servlet.ServletExtension, and in >>>>> handleDeployment(Deployment) >>>>> > method change sessionManagerFactory with new SessionManagerFactory. >>>>> > Register new ServletExtension by adding >>>>> > ../META-INF/services/io.undertow.servlet.ServletExtension file >>>>> (file should >>>>> > contain the name of new ServletExtension. for example >>>>> > com.my.utils.StartupExtension) >>>>> > >>>>> > >>>>> > But I can't seem to find anything that indicates how to provide my >>>>> own >>>>> > SessionConfig implementation. How do I register a custom >>>>> SessionConfig >>>>> > implementation? Is there any documentation to that extent? >>>>> > >>>>> > Are there any examples that can show me how to create my own >>>>> SessionManager >>>>> > and SessionConfig object? >>>>> > >>>>> > Thanks, >>>>> > >>>>> > Eric >>>>> > >>>>> > _______________________________________________ >>>>> > undertow-dev mailing list >>>>> > undertow-dev at lists.jboss.org >>>>> > https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>> >>>> >>>> >>>> _______________________________________________ >>>> undertow-dev mailing list >>>> undertow-dev at lists.jboss.org >>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>> >>> >>> >>> >>> _______________________________________________ >>> undertow-dev mailing list >>> undertow-dev at lists.jboss.org >>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>> >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/f344deaf/attachment.html From antoine.girard at ymail.com Wed Mar 29 08:44:50 2017 From: antoine.girard at ymail.com (Antoine Girard) Date: Wed, 29 Mar 2017 14:44:50 +0200 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: A SessionConfig is just an interface for the SessionManager to retrieve the session ID. You do want to store session IDs in cookies, is that correct? In that case, simply use the default SessionCookieConfig: https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/session/SessionCookieConfig.java Cheers, Antoine On Wed, Mar 29, 2017 at 2:19 PM, Eric B wrote: > Thanks for the link; that is definitely going to be a big help for the > redis bridge. > > But I'm still unclear as to the "right" way to use/define my own > SessionConfig implementation. In the link you sent, they instantiate the > RedisManager with the existing SessionConfig object, and use whatever > undertow passes in the parameters. > > As I mentioned in my earlier post, I suspect I can hack around it using > the SessionConfigWrapper but that does not seem to respect the spirit or > intent of the wrapper, so I'm trying to figure out if there is > another/better way to do this. > > Or is the only solution to completely ignore the SessionConfig object and > build my solution independent of it? But then it will not respect the > contract of the SessionManager to retrieve the Sessionid from the SC object > > Thanks, > > Eric > > On Mar 29, 2017 8:00 AM, "Antoine Girard" > wrote: > > Hi Eric, > > Unfortunately I cannot share that code as it's company property. > As far as I can remember, it was really easy. I used the java redis > library: Jedis. > Oh, and look what I found: > https://github.com/coat/undertow-redis-session/blob/master/ > src/main/java/com/pedanticprogrammer/undertow/RedisSessionManager.java > > That's a good starting point, if not the complete solution right there. > > Cheers, > Antoine > > On Wed, Mar 29, 2017 at 1:48 PM, Eric B wrote: > >> Antoine, >> >> That's exactly where I am heading too. Is there any chance you still >> have our can share the code you used to do that? >> >> Thanks, >> >> Eric >> >> On Mar 29, 2017 7:24 AM, "Antoine Girard" >> wrote: >> >>> I did a similar thing once: persisting sessions into a Redis data store >>> My starting point was the InMemorySessionManager. >>> >>> Good luck to you! >>> >>> Cheers, >>> Antoine >>> >>> On Wed, Mar 29, 2017 at 1:09 PM, Eric B wrote: >>> >>>> From my understanding, I was thinking/planning to create my own >>>> SessionManager to handle the Session loading. And from the docs, it >>>> indicates that the SessionManager must delegate retrieving the sessionId to >>>> the SessionConfig object >>>> >>>> Am I heading down the wrong path? Is there an easier/another way to >>>> load/persist the session? >>>> >>>> Thanks >>>> >>>> Eric >>>> >>>> >>>> >>>> On Mar 29, 2017 7:01 AM, "Bill O'Neil" wrote: >>>> >>>> If you want such a custom solution why not just use a cookie and ignore >>>> all of the SessionConfig code. You can write a handler that checks for >>>> the cookie and attaches your own custom session object to the exchange >>>> based on the cookie. >>>> >>>> On Tue, Mar 28, 2017 at 9:41 PM, Eric B wrote: >>>> >>>>> Stuart, >>>>> >>>>> My goal is to actually replace the JSESSIONID cookie/mechanism with my >>>>> own mechanism. I am looking to use a JsonWebToken (JWT) to pass my >>>>> JSESSIONID to the application for a few different reasons: >>>>> 1) I would like to sign the JSESSIONID >>>>> 2) I would like to pass additional data along with the JSESSIONID (ex: >>>>> some auth claims) >>>>> 3) I want to be able to share this information between different >>>>> containers >>>>> 4) I want to pass a TTL with my token >>>>> >>>>> >>>>> At some level, I am trying to hack together an SSO solution >>>>> temporarily which would allow me to log into one container, and have some >>>>> credentials pass to another container. My issue is that both containers >>>>> are session based, and hence, need to be able to retrieve a session from a >>>>> sessionId. However, I also want to make sure that sessions don't expire - >>>>> that is if I am working in container 2, that my session in container 1 >>>>> continues to live (if the user gets redirected back to container 1). >>>>> >>>>> So, in essence, I am looking to be able to extract my SessionId from a >>>>> mechanism other than the standard JSESSIONID cookie, but yet, still >>>>> continue to use the sessions seamlessly. >>>>> >>>>> I figure I could potentially hack around the design using the >>>>> SessionConfigWrapper in which I use the wrap() method to return my own >>>>> SessionConfig object, but that does not seem to fit in the spirit or design >>>>> of the wrapper. >>>>> >>>>> Is there another/better way to accomplish something like this? Or is >>>>> undertow designed with only the JSESSIONID cookie in mind? I did notice >>>>> the >>>>> SessionConfig.SessionCookieSource enum with value OTHER, but cannot >>>>> seem to see/figure out where that is used, or how to leverage that >>>>> setting. I looked through the ServletContextImpl class but only see the >>>>> SessionTrackingMode of COOKIE, SSL and URL available. >>>>> >>>>> Any help/insight would be greatly appreciated. >>>>> >>>>> Thanks, >>>>> >>>>> Eric >>>>> >>>>> >>>>> On Tue, Mar 28, 2017 at 7:57 PM, Stuart Douglas >>>>> wrote: >>>>> >>>>>> Why do you need a custom SessionConfig? In general Servlet will use >>>>>> its own SessionConfig that matches the configuration of the deployed >>>>>> application (generally just using a JSESSIONID cookie, unless it has >>>>>> been customized). >>>>>> >>>>>> Stuart >>>>>> >>>>>> On Tue, Mar 28, 2017 at 2:19 PM, Eric B wrote: >>>>>> > I've been trying to figure out how to build my own custom >>>>>> SessionManager to >>>>>> > push my sessions into Redis with a custom SessionConfig >>>>>> implementation, but >>>>>> > am having trouble finding any documentation to that extent. >>>>>> > >>>>>> > For the SesisonManager, I've read that I need to: >>>>>> > >>>>>> > Develop SessionManager which implements >>>>>> > io.undertow.server.session.SessionManager >>>>>> > Develop SessionManagerFactory which implements >>>>>> > io.undertow.servlet.api.SessionManagerFactory >>>>>> > Develop startup extension which implements >>>>>> > io.undertow.servlet.ServletExtension, and in >>>>>> handleDeployment(Deployment) >>>>>> > method change sessionManagerFactory with new SessionManagerFactory. >>>>>> > Register new ServletExtension by adding >>>>>> > ../META-INF/services/io.undertow.servlet.ServletExtension file >>>>>> (file should >>>>>> > contain the name of new ServletExtension. for example >>>>>> > com.my.utils.StartupExtension) >>>>>> > >>>>>> > >>>>>> > But I can't seem to find anything that indicates how to provide my >>>>>> own >>>>>> > SessionConfig implementation. How do I register a custom >>>>>> SessionConfig >>>>>> > implementation? Is there any documentation to that extent? >>>>>> > >>>>>> > Are there any examples that can show me how to create my own >>>>>> SessionManager >>>>>> > and SessionConfig object? >>>>>> > >>>>>> > Thanks, >>>>>> > >>>>>> > Eric >>>>>> > >>>>>> > _______________________________________________ >>>>>> > undertow-dev mailing list >>>>>> > undertow-dev at lists.jboss.org >>>>>> > https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> undertow-dev mailing list >>>>> undertow-dev at lists.jboss.org >>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> undertow-dev mailing list >>>> undertow-dev at lists.jboss.org >>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>> >>> >>> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/9e9255bb/attachment-0001.html From ebenzacar at gmail.com Wed Mar 29 09:01:06 2017 From: ebenzacar at gmail.com (Eric B) Date: Wed, 29 Mar 2017 09:01:06 -0400 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: Agreed, but I want to use my own SessionConfig implementation in which the Sessionid is stored in a different cookie structure then the default implementation. I was looking for something that allows me to specify the SessionConfig implementation I want undertow to use, but can't find that config option anywhere. Thanks, Eric On Mar 29, 2017 8:44 AM, "Antoine Girard" wrote: A SessionConfig is just an interface for the SessionManager to retrieve the session ID. You do want to store session IDs in cookies, is that correct? In that case, simply use the default SessionCookieConfig: https://github.com/undertow-io/undertow/blob/master/core/ src/main/java/io/undertow/server/session/SessionCookieConfig.java Cheers, Antoine On Wed, Mar 29, 2017 at 2:19 PM, Eric B wrote: > Thanks for the link; that is definitely going to be a big help for the > redis bridge. > > But I'm still unclear as to the "right" way to use/define my own > SessionConfig implementation. In the link you sent, they instantiate the > RedisManager with the existing SessionConfig object, and use whatever > undertow passes in the parameters. > > As I mentioned in my earlier post, I suspect I can hack around it using > the SessionConfigWrapper but that does not seem to respect the spirit or > intent of the wrapper, so I'm trying to figure out if there is > another/better way to do this. > > Or is the only solution to completely ignore the SessionConfig object and > build my solution independent of it? But then it will not respect the > contract of the SessionManager to retrieve the Sessionid from the SC object > > Thanks, > > Eric > > On Mar 29, 2017 8:00 AM, "Antoine Girard" > wrote: > > Hi Eric, > > Unfortunately I cannot share that code as it's company property. > As far as I can remember, it was really easy. I used the java redis > library: Jedis. > Oh, and look what I found: > https://github.com/coat/undertow-redis-session/blob/master/s > rc/main/java/com/pedanticprogrammer/undertow/RedisSessionManager.java > > That's a good starting point, if not the complete solution right there. > > Cheers, > Antoine > > On Wed, Mar 29, 2017 at 1:48 PM, Eric B wrote: > >> Antoine, >> >> That's exactly where I am heading too. Is there any chance you still >> have our can share the code you used to do that? >> >> Thanks, >> >> Eric >> >> On Mar 29, 2017 7:24 AM, "Antoine Girard" >> wrote: >> >>> I did a similar thing once: persisting sessions into a Redis data store >>> My starting point was the InMemorySessionManager. >>> >>> Good luck to you! >>> >>> Cheers, >>> Antoine >>> >>> On Wed, Mar 29, 2017 at 1:09 PM, Eric B wrote: >>> >>>> From my understanding, I was thinking/planning to create my own >>>> SessionManager to handle the Session loading. And from the docs, it >>>> indicates that the SessionManager must delegate retrieving the sessionId to >>>> the SessionConfig object >>>> >>>> Am I heading down the wrong path? Is there an easier/another way to >>>> load/persist the session? >>>> >>>> Thanks >>>> >>>> Eric >>>> >>>> >>>> >>>> On Mar 29, 2017 7:01 AM, "Bill O'Neil" wrote: >>>> >>>> If you want such a custom solution why not just use a cookie and ignore >>>> all of the SessionConfig code. You can write a handler that checks for >>>> the cookie and attaches your own custom session object to the exchange >>>> based on the cookie. >>>> >>>> On Tue, Mar 28, 2017 at 9:41 PM, Eric B wrote: >>>> >>>>> Stuart, >>>>> >>>>> My goal is to actually replace the JSESSIONID cookie/mechanism with my >>>>> own mechanism. I am looking to use a JsonWebToken (JWT) to pass my >>>>> JSESSIONID to the application for a few different reasons: >>>>> 1) I would like to sign the JSESSIONID >>>>> 2) I would like to pass additional data along with the JSESSIONID (ex: >>>>> some auth claims) >>>>> 3) I want to be able to share this information between different >>>>> containers >>>>> 4) I want to pass a TTL with my token >>>>> >>>>> >>>>> At some level, I am trying to hack together an SSO solution >>>>> temporarily which would allow me to log into one container, and have some >>>>> credentials pass to another container. My issue is that both containers >>>>> are session based, and hence, need to be able to retrieve a session from a >>>>> sessionId. However, I also want to make sure that sessions don't expire - >>>>> that is if I am working in container 2, that my session in container 1 >>>>> continues to live (if the user gets redirected back to container 1). >>>>> >>>>> So, in essence, I am looking to be able to extract my SessionId from a >>>>> mechanism other than the standard JSESSIONID cookie, but yet, still >>>>> continue to use the sessions seamlessly. >>>>> >>>>> I figure I could potentially hack around the design using the >>>>> SessionConfigWrapper in which I use the wrap() method to return my own >>>>> SessionConfig object, but that does not seem to fit in the spirit or design >>>>> of the wrapper. >>>>> >>>>> Is there another/better way to accomplish something like this? Or is >>>>> undertow designed with only the JSESSIONID cookie in mind? I did notice >>>>> the >>>>> SessionConfig.SessionCookieSource enum with value OTHER, but cannot >>>>> seem to see/figure out where that is used, or how to leverage that >>>>> setting. I looked through the ServletContextImpl class but only see the >>>>> SessionTrackingMode of COOKIE, SSL and URL available. >>>>> >>>>> Any help/insight would be greatly appreciated. >>>>> >>>>> Thanks, >>>>> >>>>> Eric >>>>> >>>>> >>>>> On Tue, Mar 28, 2017 at 7:57 PM, Stuart Douglas >>>>> wrote: >>>>> >>>>>> Why do you need a custom SessionConfig? In general Servlet will use >>>>>> its own SessionConfig that matches the configuration of the deployed >>>>>> application (generally just using a JSESSIONID cookie, unless it has >>>>>> been customized). >>>>>> >>>>>> Stuart >>>>>> >>>>>> On Tue, Mar 28, 2017 at 2:19 PM, Eric B wrote: >>>>>> > I've been trying to figure out how to build my own custom >>>>>> SessionManager to >>>>>> > push my sessions into Redis with a custom SessionConfig >>>>>> implementation, but >>>>>> > am having trouble finding any documentation to that extent. >>>>>> > >>>>>> > For the SesisonManager, I've read that I need to: >>>>>> > >>>>>> > Develop SessionManager which implements >>>>>> > io.undertow.server.session.SessionManager >>>>>> > Develop SessionManagerFactory which implements >>>>>> > io.undertow.servlet.api.SessionManagerFactory >>>>>> > Develop startup extension which implements >>>>>> > io.undertow.servlet.ServletExtension, and in >>>>>> handleDeployment(Deployment) >>>>>> > method change sessionManagerFactory with new SessionManagerFactory. >>>>>> > Register new ServletExtension by adding >>>>>> > ../META-INF/services/io.undertow.servlet.ServletExtension file >>>>>> (file should >>>>>> > contain the name of new ServletExtension. for example >>>>>> > com.my.utils.StartupExtension) >>>>>> > >>>>>> > >>>>>> > But I can't seem to find anything that indicates how to provide my >>>>>> own >>>>>> > SessionConfig implementation. How do I register a custom >>>>>> SessionConfig >>>>>> > implementation? Is there any documentation to that extent? >>>>>> > >>>>>> > Are there any examples that can show me how to create my own >>>>>> SessionManager >>>>>> > and SessionConfig object? >>>>>> > >>>>>> > Thanks, >>>>>> > >>>>>> > Eric >>>>>> > >>>>>> > _______________________________________________ >>>>>> > undertow-dev mailing list >>>>>> > undertow-dev at lists.jboss.org >>>>>> > https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> undertow-dev mailing list >>>>> undertow-dev at lists.jboss.org >>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> undertow-dev mailing list >>>> undertow-dev at lists.jboss.org >>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>> >>> >>> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/8490c222/attachment.html From bill at dartalley.com Wed Mar 29 09:35:48 2017 From: bill at dartalley.com (Bill O'Neil) Date: Wed, 29 Mar 2017 09:35:48 -0400 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: What exactly will you gain from reusing SessionConfig if you are going to hack around a lot of it? If not much then just write your own handler that handles the cookies and talking to Redis it might be less work then customizing and hacking around SessionConfig. On Wed, Mar 29, 2017 at 9:01 AM, Eric B wrote: > Agreed, but I want to use my own SessionConfig implementation in which the > Sessionid is stored in a different cookie structure then the default > implementation. > > I was looking for something that allows me to specify the SessionConfig > implementation I want undertow to use, but can't find that config option > anywhere. > > Thanks, > > Eric > > On Mar 29, 2017 8:44 AM, "Antoine Girard" > wrote: > > A SessionConfig is just an interface for the SessionManager to retrieve > the session ID. > You do want to store session IDs in cookies, is that correct? > In that case, simply use the default SessionCookieConfig: > https://github.com/undertow-io/undertow/blob/master/core/src > /main/java/io/undertow/server/session/SessionCookieConfig.java > > Cheers, > Antoine > > > On Wed, Mar 29, 2017 at 2:19 PM, Eric B wrote: > >> Thanks for the link; that is definitely going to be a big help for the >> redis bridge. >> >> But I'm still unclear as to the "right" way to use/define my own >> SessionConfig implementation. In the link you sent, they instantiate the >> RedisManager with the existing SessionConfig object, and use whatever >> undertow passes in the parameters. >> >> As I mentioned in my earlier post, I suspect I can hack around it using >> the SessionConfigWrapper but that does not seem to respect the spirit or >> intent of the wrapper, so I'm trying to figure out if there is >> another/better way to do this. >> >> Or is the only solution to completely ignore the SessionConfig object and >> build my solution independent of it? But then it will not respect the >> contract of the SessionManager to retrieve the Sessionid from the SC object >> >> Thanks, >> >> Eric >> >> On Mar 29, 2017 8:00 AM, "Antoine Girard" >> wrote: >> >> Hi Eric, >> >> Unfortunately I cannot share that code as it's company property. >> As far as I can remember, it was really easy. I used the java redis >> library: Jedis. >> Oh, and look what I found: >> https://github.com/coat/undertow-redis-session/blob/master/s >> rc/main/java/com/pedanticprogrammer/undertow/RedisSessionManager.java >> >> That's a good starting point, if not the complete solution right there. >> >> Cheers, >> Antoine >> >> On Wed, Mar 29, 2017 at 1:48 PM, Eric B wrote: >> >>> Antoine, >>> >>> That's exactly where I am heading too. Is there any chance you still >>> have our can share the code you used to do that? >>> >>> Thanks, >>> >>> Eric >>> >>> On Mar 29, 2017 7:24 AM, "Antoine Girard" >>> wrote: >>> >>>> I did a similar thing once: persisting sessions into a Redis data store >>>> My starting point was the InMemorySessionManager. >>>> >>>> Good luck to you! >>>> >>>> Cheers, >>>> Antoine >>>> >>>> On Wed, Mar 29, 2017 at 1:09 PM, Eric B wrote: >>>> >>>>> From my understanding, I was thinking/planning to create my own >>>>> SessionManager to handle the Session loading. And from the docs, it >>>>> indicates that the SessionManager must delegate retrieving the sessionId to >>>>> the SessionConfig object >>>>> >>>>> Am I heading down the wrong path? Is there an easier/another way to >>>>> load/persist the session? >>>>> >>>>> Thanks >>>>> >>>>> Eric >>>>> >>>>> >>>>> >>>>> On Mar 29, 2017 7:01 AM, "Bill O'Neil" wrote: >>>>> >>>>> If you want such a custom solution why not just use a cookie and >>>>> ignore all of the SessionConfig code. You can write a handler that >>>>> checks for the cookie and attaches your own custom session object to the >>>>> exchange based on the cookie. >>>>> >>>>> On Tue, Mar 28, 2017 at 9:41 PM, Eric B wrote: >>>>> >>>>>> Stuart, >>>>>> >>>>>> My goal is to actually replace the JSESSIONID cookie/mechanism with >>>>>> my own mechanism. I am looking to use a JsonWebToken (JWT) to pass my >>>>>> JSESSIONID to the application for a few different reasons: >>>>>> 1) I would like to sign the JSESSIONID >>>>>> 2) I would like to pass additional data along with the JSESSIONID >>>>>> (ex: some auth claims) >>>>>> 3) I want to be able to share this information between different >>>>>> containers >>>>>> 4) I want to pass a TTL with my token >>>>>> >>>>>> >>>>>> At some level, I am trying to hack together an SSO solution >>>>>> temporarily which would allow me to log into one container, and have some >>>>>> credentials pass to another container. My issue is that both containers >>>>>> are session based, and hence, need to be able to retrieve a session from a >>>>>> sessionId. However, I also want to make sure that sessions don't expire - >>>>>> that is if I am working in container 2, that my session in container 1 >>>>>> continues to live (if the user gets redirected back to container 1). >>>>>> >>>>>> So, in essence, I am looking to be able to extract my SessionId from >>>>>> a mechanism other than the standard JSESSIONID cookie, but yet, still >>>>>> continue to use the sessions seamlessly. >>>>>> >>>>>> I figure I could potentially hack around the design using the >>>>>> SessionConfigWrapper in which I use the wrap() method to return my own >>>>>> SessionConfig object, but that does not seem to fit in the spirit or design >>>>>> of the wrapper. >>>>>> >>>>>> Is there another/better way to accomplish something like this? Or is >>>>>> undertow designed with only the JSESSIONID cookie in mind? I did notice >>>>>> the >>>>>> SessionConfig.SessionCookieSource enum with value OTHER, but cannot >>>>>> seem to see/figure out where that is used, or how to leverage that >>>>>> setting. I looked through the ServletContextImpl class but only see the >>>>>> SessionTrackingMode of COOKIE, SSL and URL available. >>>>>> >>>>>> Any help/insight would be greatly appreciated. >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Eric >>>>>> >>>>>> >>>>>> On Tue, Mar 28, 2017 at 7:57 PM, Stuart Douglas >>>>>> wrote: >>>>>> >>>>>>> Why do you need a custom SessionConfig? In general Servlet will use >>>>>>> its own SessionConfig that matches the configuration of the deployed >>>>>>> application (generally just using a JSESSIONID cookie, unless it has >>>>>>> been customized). >>>>>>> >>>>>>> Stuart >>>>>>> >>>>>>> On Tue, Mar 28, 2017 at 2:19 PM, Eric B wrote: >>>>>>> > I've been trying to figure out how to build my own custom >>>>>>> SessionManager to >>>>>>> > push my sessions into Redis with a custom SessionConfig >>>>>>> implementation, but >>>>>>> > am having trouble finding any documentation to that extent. >>>>>>> > >>>>>>> > For the SesisonManager, I've read that I need to: >>>>>>> > >>>>>>> > Develop SessionManager which implements >>>>>>> > io.undertow.server.session.SessionManager >>>>>>> > Develop SessionManagerFactory which implements >>>>>>> > io.undertow.servlet.api.SessionManagerFactory >>>>>>> > Develop startup extension which implements >>>>>>> > io.undertow.servlet.ServletExtension, and in >>>>>>> handleDeployment(Deployment) >>>>>>> > method change sessionManagerFactory with new SessionManagerFactory. >>>>>>> > Register new ServletExtension by adding >>>>>>> > ../META-INF/services/io.undertow.servlet.ServletExtension file >>>>>>> (file should >>>>>>> > contain the name of new ServletExtension. for example >>>>>>> > com.my.utils.StartupExtension) >>>>>>> > >>>>>>> > >>>>>>> > But I can't seem to find anything that indicates how to provide my >>>>>>> own >>>>>>> > SessionConfig implementation. How do I register a custom >>>>>>> SessionConfig >>>>>>> > implementation? Is there any documentation to that extent? >>>>>>> > >>>>>>> > Are there any examples that can show me how to create my own >>>>>>> SessionManager >>>>>>> > and SessionConfig object? >>>>>>> > >>>>>>> > Thanks, >>>>>>> > >>>>>>> > Eric >>>>>>> > >>>>>>> > _______________________________________________ >>>>>>> > undertow-dev mailing list >>>>>>> > undertow-dev at lists.jboss.org >>>>>>> > https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> undertow-dev mailing list >>>>>> undertow-dev at lists.jboss.org >>>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> undertow-dev mailing list >>>>> undertow-dev at lists.jboss.org >>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>> >>>> >>>> >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/8f6e68ec/attachment-0001.html From antoine.girard at ymail.com Wed Mar 29 09:53:41 2017 From: antoine.girard at ymail.com (Antoine Girard) Date: Wed, 29 Mar 2017 15:53:41 +0200 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: Look here: https://github.com/undertow-io/undertow/blob/master/examples/src/main/java/io/undertow/examples/sessionhandling/SessionServer.java Remember that the SessionManager interface has a createSession method that takes a SessionConfig. That's where you give it. You can see this operation being done throughout the example above. Cheers, Antoine On Wed, Mar 29, 2017 at 3:01 PM, Eric B wrote: > Agreed, but I want to use my own SessionConfig implementation in which the > Sessionid is stored in a different cookie structure then the default > implementation. > > I was looking for something that allows me to specify the SessionConfig > implementation I want undertow to use, but can't find that config option > anywhere. > > Thanks, > > Eric > > On Mar 29, 2017 8:44 AM, "Antoine Girard" > wrote: > > A SessionConfig is just an interface for the SessionManager to retrieve > the session ID. > You do want to store session IDs in cookies, is that correct? > In that case, simply use the default SessionCookieConfig: > https://github.com/undertow-io/undertow/blob/master/core/src > /main/java/io/undertow/server/session/SessionCookieConfig.java > > Cheers, > Antoine > > > On Wed, Mar 29, 2017 at 2:19 PM, Eric B wrote: > >> Thanks for the link; that is definitely going to be a big help for the >> redis bridge. >> >> But I'm still unclear as to the "right" way to use/define my own >> SessionConfig implementation. In the link you sent, they instantiate the >> RedisManager with the existing SessionConfig object, and use whatever >> undertow passes in the parameters. >> >> As I mentioned in my earlier post, I suspect I can hack around it using >> the SessionConfigWrapper but that does not seem to respect the spirit or >> intent of the wrapper, so I'm trying to figure out if there is >> another/better way to do this. >> >> Or is the only solution to completely ignore the SessionConfig object and >> build my solution independent of it? But then it will not respect the >> contract of the SessionManager to retrieve the Sessionid from the SC object >> >> Thanks, >> >> Eric >> >> On Mar 29, 2017 8:00 AM, "Antoine Girard" >> wrote: >> >> Hi Eric, >> >> Unfortunately I cannot share that code as it's company property. >> As far as I can remember, it was really easy. I used the java redis >> library: Jedis. >> Oh, and look what I found: >> https://githubcom/coat/undertow-redis-session/blob/master/sr >> c/main/java/com/pedanticprogrammer/undertow/RedisSessionManager.java >> >> >> That's a good starting point, if not the complete solution right there. >> >> Cheers, >> Antoine >> >> On Wed, Mar 29, 2017 at 1:48 PM, Eric B wrote: >> >>> Antoine, >>> >>> That's exactly where I am heading too. Is there any chance you still >>> have our can share the code you used to do that? >>> >>> Thanks, >>> >>> Eric >>> >>> On Mar 29, 2017 7:24 AM, "Antoine Girard" >>> wrote: >>> >>>> I did a similar thing once: persisting sessions into a Redis data store >>>> My starting point was the InMemorySessionManager. >>>> >>>> Good luck to you! >>>> >>>> Cheers, >>>> Antoine >>>> >>>> On Wed, Mar 29, 2017 at 1:09 PM, Eric B wrote: >>>> >>>>> From my understanding, I was thinking/planning to create my own >>>>> SessionManager to handle the Session loading. And from the docs, it >>>>> indicates that the SessionManager must delegate retrieving the sessionId to >>>>> the SessionConfig object >>>>> >>>>> Am I heading down the wrong path? Is there an easier/another way to >>>>> load/persist the session? >>>>> >>>>> Thanks >>>>> >>>>> Eric >>>>> >>>>> >>>>> >>>>> On Mar 29, 2017 7:01 AM, "Bill O'Neil" wrote: >>>>> >>>>> If you want such a custom solution why not just use a cookie and >>>>> ignore all of the SessionConfig code. You can write a handler that >>>>> checks for the cookie and attaches your own custom session object to the >>>>> exchange based on the cookie. >>>>> >>>>> On Tue, Mar 28, 2017 at 9:41 PM, Eric B wrote: >>>>> >>>>>> Stuart, >>>>>> >>>>>> My goal is to actually replace the JSESSIONID cookie/mechanism with >>>>>> my own mechanism. I am looking to use a JsonWebToken (JWT) to pass my >>>>>> JSESSIONID to the application for a few different reasons: >>>>>> 1) I would like to sign the JSESSIONID >>>>>> 2) I would like to pass additional data along with the JSESSIONID >>>>>> (ex: some auth claims) >>>>>> 3) I want to be able to share this information between different >>>>>> containers >>>>>> 4) I want to pass a TTL with my token >>>>>> >>>>>> >>>>>> At some level, I am trying to hack together an SSO solution >>>>>> temporarily which would allow me to log into one container, and have some >>>>>> credentials pass to another container. My issue is that both containers >>>>>> are session based, and hence, need to be able to retrieve a session from a >>>>>> sessionId. However, I also want to make sure that sessions don't expire - >>>>>> that is if I am working in container 2, that my session in container 1 >>>>>> continues to live (if the user gets redirected back to container 1). >>>>>> >>>>>> So, in essence, I am looking to be able to extract my SessionId from >>>>>> a mechanism other than the standard JSESSIONID cookie, but yet, still >>>>>> continue to use the sessions seamlessly. >>>>>> >>>>>> I figure I could potentially hack around the design using the >>>>>> SessionConfigWrapper in which I use the wrap() method to return my own >>>>>> SessionConfig object, but that does not seem to fit in the spirit or design >>>>>> of the wrapper. >>>>>> >>>>>> Is there another/better way to accomplish something like this? Or is >>>>>> undertow designed with only the JSESSIONID cookie in mind? I did notice >>>>>> the >>>>>> SessionConfig.SessionCookieSource enum with value OTHER, but cannot >>>>>> seem to see/figure out where that is used, or how to leverage that setting >>>>>> I looked through the ServletContextImpl class but only see the >>>>>> SessionTrackingMode of COOKIE, SSL and URL available. >>>>>> >>>>>> Any help/insight would be greatly appreciated. >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Eric >>>>>> >>>>>> >>>>>> On Tue, Mar 28, 2017 at 7:57 PM, Stuart Douglas >>>>>> wrote: >>>>>> >>>>>>> Why do you need a custom SessionConfig? In general Servlet will use >>>>>>> its own SessionConfig that matches the configuration of the deployed >>>>>>> application (generally just using a JSESSIONID cookie, unless it has >>>>>>> been customized). >>>>>>> >>>>>>> Stuart >>>>>>> >>>>>>> On Tue, Mar 28, 2017 at 2:19 PM, Eric B wrote: >>>>>>> > I've been trying to figure out how to build my own custom >>>>>>> SessionManager to >>>>>>> > push my sessions into Redis with a custom SessionConfig >>>>>>> implementation, but >>>>>>> > am having trouble finding any documentation to that extent. >>>>>>> > >>>>>>> > For the SesisonManager, I've read that I need to: >>>>>>> > >>>>>>> > Develop SessionManager which implements >>>>>>> > io.undertow.server.session.SessionManager >>>>>>> > Develop SessionManagerFactory which implements >>>>>>> > io.undertow.servlet.api.SessionManagerFactory >>>>>>> > Develop startup extension which implements >>>>>>> > io.undertow.servlet.ServletExtension, and in >>>>>>> handleDeployment(Deployment) >>>>>>> > method change sessionManagerFactory with new SessionManagerFactory. >>>>>>> > Register new ServletExtension by adding >>>>>>> > ../META-INF/services/io.undertow.servlet.ServletExtension file >>>>>>> (file should >>>>>>> > contain the name of new ServletExtension. for example >>>>>>> > com.my.utils.StartupExtension) >>>>>>> > >>>>>>> > >>>>>>> > But I can't seem to find anything that indicates how to provide my >>>>>>> own >>>>>>> > SessionConfig implementation. How do I register a custom >>>>>>> SessionConfig >>>>>>> > implementation? Is there any documentation to that extent? >>>>>>> > >>>>>>> > Are there any examples that can show me how to create my own >>>>>>> SessionManager >>>>>>> > and SessionConfig object? >>>>>>> > >>>>>>> > Thanks, >>>>>>> > >>>>>>> > Eric >>>>>>> > >>>>>>> > _______________________________________________ >>>>>>> > undertow-dev mailing list >>>>>>> > undertow-dev at lists.jboss.org >>>>>>> > https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> undertow-dev mailing list >>>>>> undertow-dev at lists.jboss.org >>>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> undertow-dev mailing list >>>>> undertow-dev at lists.jboss.org >>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>> >>>> >>>> >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/30b3c5fc/attachment-0001.html From ebenzacar at gmail.com Wed Mar 29 09:55:00 2017 From: ebenzacar at gmail.com (Eric B) Date: Wed, 29 Mar 2017 09:55:00 -0400 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: I'm not actually trying to reusue the SessionCookieConfigImpl. But in the SessionManager javadoc, it clearly states that: * As part of session creation the session manager MUST attempt to retrieve the {@link SessionCookieConfig} from * the {@link HttpServerExchange} and use it to set the session cookie. The frees up the session manager from * needing to know details of the cookie configuration. When invalidating a session the session manager MUST * also use this to clear the session cookie. So while I can create my own SessionManager that completely ignores the SessionConfig object, as per the SessionManager javadocs, the manager must attempt to retrieve the SessionConfig object from the exchange to set the session cookie. I am just trying to fulfill the SessionManager requirements. But there is missing documentation indicating how/where one can specify the SessionCookieConfig implementation that I want undertow to use. I would like undertow to use my own custom implementation. Thanks, Eric On Mar 29, 2017 9:35 AM, "Bill O'Neil" wrote: > What exactly will you gain from reusing SessionConfig if you are going to > hack around a lot of it? If not much then just write your own handler that > handles the cookies and talking to Redis it might be less work then > customizing and hacking around SessionConfig. > > On Wed, Mar 29, 2017 at 9:01 AM, Eric B wrote: > >> Agreed, but I want to use my own SessionConfig implementation in which >> the Sessionid is stored in a different cookie structure then the default >> implementation. >> >> I was looking for something that allows me to specify the SessionConfig >> implementation I want undertow to use, but can't find that config option >> anywhere. >> >> Thanks, >> >> Eric >> >> On Mar 29, 2017 8:44 AM, "Antoine Girard" >> wrote: >> >> A SessionConfig is just an interface for the SessionManager to retrieve >> the session ID. >> You do want to store session IDs in cookies, is that correct? >> In that case, simply use the default SessionCookieConfig: >> https://github.com/undertow-io/undertow/blob/master/core/src >> /main/java/io/undertow/server/session/SessionCookieConfig.java >> >> Cheers, >> Antoine >> >> >> On Wed, Mar 29, 2017 at 2:19 PM, Eric B wrote: >> >>> Thanks for the link; that is definitely going to be a big help for the >>> redis bridge. >>> >>> But I'm still unclear as to the "right" way to use/define my own >>> SessionConfig implementation. In the link you sent, they instantiate the >>> RedisManager with the existing SessionConfig object, and use whatever >>> undertow passes in the parameters. >>> >>> As I mentioned in my earlier post, I suspect I can hack around it using >>> the SessionConfigWrapper but that does not seem to respect the spirit or >>> intent of the wrapper, so I'm trying to figure out if there is >>> another/better way to do this. >>> >>> Or is the only solution to completely ignore the SessionConfig object >>> and build my solution independent of it? But then it will not respect the >>> contract of the SessionManager to retrieve the Sessionid from the SC object >>> >>> Thanks, >>> >>> Eric >>> >>> On Mar 29, 2017 8:00 AM, "Antoine Girard" >>> wrote: >>> >>> Hi Eric, >>> >>> Unfortunately I cannot share that code as it's company property. >>> As far as I can remember, it was really easy. I used the java redis >>> library: Jedis. >>> Oh, and look what I found: >>> https://github.com/coat/undertow-redis-session/blob/master/s >>> rc/main/java/com/pedanticprogrammer/undertow/RedisSessionManager.java >>> >>> That's a good starting point, if not the complete solution right there. >>> >>> Cheers, >>> Antoine >>> >>> On Wed, Mar 29, 2017 at 1:48 PM, Eric B wrote: >>> >>>> Antoine, >>>> >>>> That's exactly where I am heading too. Is there any chance you still >>>> have our can share the code you used to do that? >>>> >>>> Thanks, >>>> >>>> Eric >>>> >>>> On Mar 29, 2017 7:24 AM, "Antoine Girard" >>>> wrote: >>>> >>>>> I did a similar thing once: persisting sessions into a Redis data store >>>>> My starting point was the InMemorySessionManager. >>>>> >>>>> Good luck to you! >>>>> >>>>> Cheers, >>>>> Antoine >>>>> >>>>> On Wed, Mar 29, 2017 at 1:09 PM, Eric B wrote: >>>>> >>>>>> From my understanding, I was thinking/planning to create my own >>>>>> SessionManager to handle the Session loading. And from the docs, it >>>>>> indicates that the SessionManager must delegate retrieving the sessionId to >>>>>> the SessionConfig object >>>>>> >>>>>> Am I heading down the wrong path? Is there an easier/another way to >>>>>> load/persist the session? >>>>>> >>>>>> Thanks >>>>>> >>>>>> Eric >>>>>> >>>>>> >>>>>> >>>>>> On Mar 29, 2017 7:01 AM, "Bill O'Neil" wrote: >>>>>> >>>>>> If you want such a custom solution why not just use a cookie and >>>>>> ignore all of the SessionConfig code. You can write a handler that >>>>>> checks for the cookie and attaches your own custom session object to the >>>>>> exchange based on the cookie. >>>>>> >>>>>> On Tue, Mar 28, 2017 at 9:41 PM, Eric B wrote: >>>>>> >>>>>>> Stuart, >>>>>>> >>>>>>> My goal is to actually replace the JSESSIONID cookie/mechanism with >>>>>>> my own mechanism. I am looking to use a JsonWebToken (JWT) to pass my >>>>>>> JSESSIONID to the application for a few different reasons: >>>>>>> 1) I would like to sign the JSESSIONID >>>>>>> 2) I would like to pass additional data along with the JSESSIONID >>>>>>> (ex: some auth claims) >>>>>>> 3) I want to be able to share this information between different >>>>>>> containers >>>>>>> 4) I want to pass a TTL with my token >>>>>>> >>>>>>> >>>>>>> At some level, I am trying to hack together an SSO solution >>>>>>> temporarily which would allow me to log into one container, and have some >>>>>>> credentials pass to another container. My issue is that both containers >>>>>>> are session based, and hence, need to be able to retrieve a session from a >>>>>>> sessionId. However, I also want to make sure that sessions don't expire - >>>>>>> that is if I am working in container 2, that my session in container 1 >>>>>>> continues to live (if the user gets redirected back to container 1). >>>>>>> >>>>>>> So, in essence, I am looking to be able to extract my SessionId from >>>>>>> a mechanism other than the standard JSESSIONID cookie, but yet, still >>>>>>> continue to use the sessions seamlessly. >>>>>>> >>>>>>> I figure I could potentially hack around the design using the >>>>>>> SessionConfigWrapper in which I use the wrap() method to return my own >>>>>>> SessionConfig object, but that does not seem to fit in the spirit or design >>>>>>> of the wrapper. >>>>>>> >>>>>>> Is there another/better way to accomplish something like this? Or >>>>>>> is undertow designed with only the JSESSIONID cookie in mind? I did notice >>>>>>> the >>>>>>> SessionConfig.SessionCookieSource enum with value OTHER, but >>>>>>> cannot seem to see/figure out where that is used, or how to leverage that >>>>>>> setting. I looked through the ServletContextImpl class but only see the >>>>>>> SessionTrackingMode of COOKIE, SSL and URL available. >>>>>>> >>>>>>> Any help/insight would be greatly appreciated. >>>>>>> >>>>>>> Thanks, >>>>>>> >>>>>>> Eric >>>>>>> >>>>>>> >>>>>>> On Tue, Mar 28, 2017 at 7:57 PM, Stuart Douglas >>>>>> > wrote: >>>>>>> >>>>>>>> Why do you need a custom SessionConfig? In general Servlet will use >>>>>>>> its own SessionConfig that matches the configuration of the deployed >>>>>>>> application (generally just using a JSESSIONID cookie, unless it has >>>>>>>> been customized). >>>>>>>> >>>>>>>> Stuart >>>>>>>> >>>>>>>> On Tue, Mar 28, 2017 at 2:19 PM, Eric B >>>>>>>> wrote: >>>>>>>> > I've been trying to figure out how to build my own custom >>>>>>>> SessionManager to >>>>>>>> > push my sessions into Redis with a custom SessionConfig >>>>>>>> implementation, but >>>>>>>> > am having trouble finding any documentation to that extent. >>>>>>>> > >>>>>>>> > For the SesisonManager, I've read that I need to: >>>>>>>> > >>>>>>>> > Develop SessionManager which implements >>>>>>>> > io.undertow.server.session.SessionManager >>>>>>>> > Develop SessionManagerFactory which implements >>>>>>>> > io.undertow.servlet.api.SessionManagerFactory >>>>>>>> > Develop startup extension which implements >>>>>>>> > io.undertow.servlet.ServletExtension, and in >>>>>>>> handleDeployment(Deployment) >>>>>>>> > method change sessionManagerFactory with new >>>>>>>> SessionManagerFactory. >>>>>>>> > Register new ServletExtension by adding >>>>>>>> > ../META-INF/services/io.undertow.servlet.ServletExtension file >>>>>>>> (file should >>>>>>>> > contain the name of new ServletExtension. for example >>>>>>>> > com.my.utils.StartupExtension) >>>>>>>> > >>>>>>>> > >>>>>>>> > But I can't seem to find anything that indicates how to provide >>>>>>>> my own >>>>>>>> > SessionConfig implementation. How do I register a custom >>>>>>>> SessionConfig >>>>>>>> > implementation? Is there any documentation to that extent? >>>>>>>> > >>>>>>>> > Are there any examples that can show me how to create my own >>>>>>>> SessionManager >>>>>>>> > and SessionConfig object? >>>>>>>> > >>>>>>>> > Thanks, >>>>>>>> > >>>>>>>> > Eric >>>>>>>> > >>>>>>>> > _______________________________________________ >>>>>>>> > undertow-dev mailing list >>>>>>>> > undertow-dev at lists.jboss.org >>>>>>>> > https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>>>> >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> undertow-dev mailing list >>>>>>> undertow-dev at lists.jboss.org >>>>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> undertow-dev mailing list >>>>>> undertow-dev at lists.jboss.org >>>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>> >>>>> >>>>> >>> >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/6cb95407/attachment-0001.html From antoine.girard at ymail.com Wed Mar 29 10:05:42 2017 From: antoine.girard at ymail.com (Antoine Girard) Date: Wed, 29 Mar 2017 16:05:42 +0200 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: The SessionManager#createSession() method takes a SessionConfig as second argument. I don't understand what more do you need! Cheers, Antoine On Wed, Mar 29, 2017 at 3:55 PM, Eric B wrote: > I'm not actually trying to reusue the SessionCookieConfigImpl. But in the > SessionManager javadoc, it clearly states that: > > * As part of session creation the session manager MUST attempt to > retrieve the {@link SessionCookieConfig} from > * the {@link HttpServerExchange} and use it to set the session cookie. > The frees up the session manager from > * needing to know details of the cookie configuration. When invalidating > a session the session manager MUST > * also use this to clear the session cookie. > > So while I can create my own SessionManager that completely ignores the > SessionConfig object, as per the SessionManager javadocs, the manager must > attempt to retrieve the SessionConfig object from the exchange to set the > session cookie. I am just trying to fulfill the SessionManager > requirements. > > But there is missing documentation indicating how/where one can specify > the SessionCookieConfig implementation that I want undertow to use. I > would like undertow to use my own custom implementation. > > Thanks, > > Eric > > > On Mar 29, 2017 9:35 AM, "Bill O'Neil" wrote: > >> What exactly will you gain from reusing SessionConfig if you are going to >> hack around a lot of it? If not much then just write your own handler that >> handles the cookies and talking to Redis it might be less work then >> customizing and hacking around SessionConfig. >> >> On Wed, Mar 29, 2017 at 9:01 AM, Eric B wrote: >> >>> Agreed, but I want to use my own SessionConfig implementation in which >>> the Sessionid is stored in a different cookie structure then the default >>> implementation. >>> >>> I was looking for something that allows me to specify the SessionConfig >>> implementation I want undertow to use, but can't find that config option >>> anywhere. >>> >>> Thanks, >>> >>> Eric >>> >>> On Mar 29, 2017 8:44 AM, "Antoine Girard" >>> wrote: >>> >>> A SessionConfig is just an interface for the SessionManager to retrieve >>> the session ID. >>> You do want to store session IDs in cookies, is that correct? >>> In that case, simply use the default SessionCookieConfig: >>> https://github.com/undertow-io/undertow/blob/master/core/src >>> /main/java/io/undertow/server/session/SessionCookieConfig.java >>> >>> Cheers, >>> Antoine >>> >>> >>> On Wed, Mar 29, 2017 at 2:19 PM, Eric B wrote: >>> >>>> Thanks for the link; that is definitely going to be a big help for the >>>> redis bridge. >>>> >>>> But I'm still unclear as to the "right" way to use/define my own >>>> SessionConfig implementation. In the link you sent, they instantiate the >>>> RedisManager with the existing SessionConfig object, and use whatever >>>> undertow passes in the parameters. >>>> >>>> As I mentioned in my earlier post, I suspect I can hack around it using >>>> the SessionConfigWrapper but that does not seem to respect the spirit or >>>> intent of the wrapper, so I'm trying to figure out if there is >>>> another/better way to do this. >>>> >>>> Or is the only solution to completely ignore the SessionConfig object >>>> and build my solution independent of it? But then it will not respect the >>>> contract of the SessionManager to retrieve the Sessionid from the SC object >>>> >>>> Thanks, >>>> >>>> Eric >>>> >>>> On Mar 29, 2017 8:00 AM, "Antoine Girard" >>>> wrote: >>>> >>>> Hi Eric, >>>> >>>> Unfortunately I cannot share that code as it's company property. >>>> As far as I can remember, it was really easy. I used the java redis >>>> library: Jedis. >>>> Oh, and look what I found: >>>> https://github.com/coat/undertow-redis-session/blob/master/s >>>> rc/main/java/com/pedanticprogrammer/undertow/RedisSessionManager.java >>>> >>>> That's a good starting point, if not the complete solution right there. >>>> >>>> Cheers, >>>> Antoine >>>> >>>> On Wed, Mar 29, 2017 at 1:48 PM, Eric B wrote: >>>> >>>>> Antoine, >>>>> >>>>> That's exactly where I am heading too. Is there any chance you still >>>>> have our can share the code you used to do that? >>>>> >>>>> Thanks, >>>>> >>>>> Eric >>>>> >>>>> On Mar 29, 2017 7:24 AM, "Antoine Girard" >>>> > wrote: >>>>> >>>>>> I did a similar thing once: persisting sessions into a Redis data >>>>>> store >>>>>> My starting point was the InMemorySessionManager. >>>>>> >>>>>> Good luck to you! >>>>>> >>>>>> Cheers, >>>>>> Antoine >>>>>> >>>>>> On Wed, Mar 29, 2017 at 1:09 PM, Eric B wrote: >>>>>> >>>>>>> From my understanding, I was thinking/planning to create my own >>>>>>> SessionManager to handle the Session loading. And from the docs, it >>>>>>> indicates that the SessionManager must delegate retrieving the sessionId to >>>>>>> the SessionConfig object >>>>>>> >>>>>>> Am I heading down the wrong path? Is there an easier/another way to >>>>>>> load/persist the session? >>>>>>> >>>>>>> Thanks >>>>>>> >>>>>>> Eric >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Mar 29, 2017 7:01 AM, "Bill O'Neil" wrote: >>>>>>> >>>>>>> If you want such a custom solution why not just use a cookie and >>>>>>> ignore all of the SessionConfig code. You can write a handler that >>>>>>> checks for the cookie and attaches your own custom session object to the >>>>>>> exchange based on the cookie. >>>>>>> >>>>>>> On Tue, Mar 28, 2017 at 9:41 PM, Eric B wrote: >>>>>>> >>>>>>>> Stuart, >>>>>>>> >>>>>>>> My goal is to actually replace the JSESSIONID cookie/mechanism with >>>>>>>> my own mechanism. I am looking to use a JsonWebToken (JWT) to pass my >>>>>>>> JSESSIONID to the application for a few different reasons: >>>>>>>> 1) I would like to sign the JSESSIONID >>>>>>>> 2) I would like to pass additional data along with the JSESSIONID >>>>>>>> (ex: some auth claims) >>>>>>>> 3) I want to be able to share this information between different >>>>>>>> containers >>>>>>>> 4) I want to pass a TTL with my token >>>>>>>> >>>>>>>> >>>>>>>> At some level, I am trying to hack together an SSO solution >>>>>>>> temporarily which would allow me to log into one container, and have some >>>>>>>> credentials pass to another container. My issue is that both containers >>>>>>>> are session based, and hence, need to be able to retrieve a session from a >>>>>>>> sessionId. However, I also want to make sure that sessions don't expire - >>>>>>>> that is if I am working in container 2, that my session in container 1 >>>>>>>> continues to live (if the user gets redirected back to container 1). >>>>>>>> >>>>>>>> So, in essence, I am looking to be able to extract my SessionId >>>>>>>> from a mechanism other than the standard JSESSIONID cookie, but yet, still >>>>>>>> continue to use the sessions seamlessly. >>>>>>>> >>>>>>>> I figure I could potentially hack around the design using the >>>>>>>> SessionConfigWrapper in which I use the wrap() method to return my own >>>>>>>> SessionConfig object, but that does not seem to fit in the spirit or design >>>>>>>> of the wrapper. >>>>>>>> >>>>>>>> Is there another/better way to accomplish something like this? Or >>>>>>>> is undertow designed with only the JSESSIONID cookie in mind? I did notice >>>>>>>> the >>>>>>>> SessionConfig.SessionCookieSource enum with value OTHER, but >>>>>>>> cannot seem to see/figure out where that is used, or how to leverage that >>>>>>>> setting. I looked through the ServletContextImpl class but only see the >>>>>>>> SessionTrackingMode of COOKIE, SSL and URL available. >>>>>>>> >>>>>>>> Any help/insight would be greatly appreciated. >>>>>>>> >>>>>>>> Thanks, >>>>>>>> >>>>>>>> Eric >>>>>>>> >>>>>>>> >>>>>>>> On Tue, Mar 28, 2017 at 7:57 PM, Stuart Douglas < >>>>>>>> sdouglas at redhat.com> wrote: >>>>>>>> >>>>>>>>> Why do you need a custom SessionConfig? In general Servlet will use >>>>>>>>> its own SessionConfig that matches the configuration of the >>>>>>>>> deployed >>>>>>>>> application (generally just using a JSESSIONID cookie, unless it >>>>>>>>> has >>>>>>>>> been customized). >>>>>>>>> >>>>>>>>> Stuart >>>>>>>>> >>>>>>>>> On Tue, Mar 28, 2017 at 2:19 PM, Eric B >>>>>>>>> wrote: >>>>>>>>> > I've been trying to figure out how to build my own custom >>>>>>>>> SessionManager to >>>>>>>>> > push my sessions into Redis with a custom SessionConfig >>>>>>>>> implementation, but >>>>>>>>> > am having trouble finding any documentation to that extent. >>>>>>>>> > >>>>>>>>> > For the SesisonManager, I've read that I need to: >>>>>>>>> > >>>>>>>>> > Develop SessionManager which implements >>>>>>>>> > io.undertow.server.session.SessionManager >>>>>>>>> > Develop SessionManagerFactory which implements >>>>>>>>> > io.undertow.servlet.api.SessionManagerFactory >>>>>>>>> > Develop startup extension which implements >>>>>>>>> > io.undertow.servlet.ServletExtension, and in >>>>>>>>> handleDeployment(Deployment) >>>>>>>>> > method change sessionManagerFactory with new >>>>>>>>> SessionManagerFactory. >>>>>>>>> > Register new ServletExtension by adding >>>>>>>>> > ../META-INF/services/io.undertow.servlet.ServletExtension file >>>>>>>>> (file should >>>>>>>>> > contain the name of new ServletExtension. for example >>>>>>>>> > com.my.utils.StartupExtension) >>>>>>>>> > >>>>>>>>> > >>>>>>>>> > But I can't seem to find anything that indicates how to provide >>>>>>>>> my own >>>>>>>>> > SessionConfig implementation. How do I register a custom >>>>>>>>> SessionConfig >>>>>>>>> > implementation? Is there any documentation to that extent? >>>>>>>>> > >>>>>>>>> > Are there any examples that can show me how to create my own >>>>>>>>> SessionManager >>>>>>>>> > and SessionConfig object? >>>>>>>>> > >>>>>>>>> > Thanks, >>>>>>>>> > >>>>>>>>> > Eric >>>>>>>>> > >>>>>>>>> > _______________________________________________ >>>>>>>>> > undertow-dev mailing list >>>>>>>>> > undertow-dev at lists.jboss.org >>>>>>>>> > https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> undertow-dev mailing list >>>>>>>> undertow-dev at lists.jboss.org >>>>>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> undertow-dev mailing list >>>>>>> undertow-dev at lists.jboss.org >>>>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>>> >>>>>> >>>>>> >>>> >>>> >>> >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/d92a7d6f/attachment-0001.html From geethdr at gmail.com Wed Mar 29 13:55:04 2017 From: geethdr at gmail.com (Geetha D R) Date: Wed, 29 Mar 2017 13:55:04 -0400 Subject: [undertow-dev] Reverse proxy Message-ID: Hi All, I want to reverse proxy a bunch of different internal applications using Undertow . For example my applications are: - https://secure.stage.org/application1/index.jsp - https://cee.stage.org/application2/default.aspx Every request to these applications should go through the proxy server - The proxy server in turn sets the authentication token on these requests and fulfils the request, the response is sent back to the client browser without exposing the authentication token to the client browser i.e., the single sign on cookie is not sent to the browser. When I setup my proxy to say localhost:7001 and try to hit any of the applications for example https://cee.stage.org/application2/default.aspx - this request should go through proxy server and the proxy is responsible to inject to single sign on cookie and request the target application - proxy sends back the response from the target app. I am not sure how to implement this in undertow? Can you please provide your suggestions -- Thanks Geetha DR -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/c818e9df/attachment.html From ebenzacar at gmail.com Wed Mar 29 14:04:22 2017 From: ebenzacar at gmail.com (Eric B) Date: Wed, 29 Mar 2017 14:04:22 -0400 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: Agreed, but what calls that createSession() method? >From what I can tell looking at the code, it's the io.undertow.servlet.spec.ServletContextImpl.getSession(ServletContextImpl, HttpServerExchange, boolean) which calls the createSession() method, getting the SessionConfig object from the SessionCookieConfig object, which is instantiated in the constructor: public ServletContextImpl(final ServletContainer servletContainer, final Deployment deployment) { this.servletContainer = servletContainer; this.deployment = deployment; this.deploymentInfo = deployment.getDeploymentInfo(); * sessionCookieConfig = new SessionCookieConfigImpl(this);* sessionCookieConfig.setPath(deploymentInfo.getContextPath()); ... ... } public HttpSessionImpl getSession(final ServletContextImpl originalServletContext, final HttpServerExchange exchange, boolean create) { SessionConfig c = originalServletContext.getSessionConfig(); ... ... ... ... final Session newSession = sessionManager.createSession(exchange, c); httpSession = SecurityActions.forSession(newSession, this, true); exchange.putAttachment(sessionAttachmentKey, httpSession); } } return httpSession; } So like I said, I can override the behaviour, but then I am not adhering to the spirit of the Manager which specifies that it must defer calls to the SessionConfig object. Thanks, Eric On Wed, Mar 29, 2017 at 10:05 AM, Antoine Girard wrote: > The SessionManager#createSession() method takes a SessionConfig as second > argument. > I don't understand what more do you need! > > Cheers, > Antoine > > On Wed, Mar 29, 2017 at 3:55 PM, Eric B wrote: > >> I'm not actually trying to reusue the SessionCookieConfigImpl. But in >> the SessionManager javadoc, it clearly states that: >> >> * As part of session creation the session manager MUST attempt to >> retrieve the {@link SessionCookieConfig} from >> * the {@link HttpServerExchange} and use it to set the session cookie. >> The frees up the session manager from >> * needing to know details of the cookie configuration. When invalidating >> a session the session manager MUST >> * also use this to clear the session cookie. >> >> So while I can create my own SessionManager that completely ignores the >> SessionConfig object, as per the SessionManager javadocs, the manager must >> attempt to retrieve the SessionConfig object from the exchange to set the >> session cookie. I am just trying to fulfill the SessionManager >> requirements. >> >> But there is missing documentation indicating how/where one can specify >> the SessionCookieConfig implementation that I want undertow to use. I >> would like undertow to use my own custom implementation. >> >> Thanks, >> >> Eric >> >> >> On Mar 29, 2017 9:35 AM, "Bill O'Neil" wrote: >> >>> What exactly will you gain from reusing SessionConfig if you are going >>> to hack around a lot of it? If not much then just write your own handler >>> that handles the cookies and talking to Redis it might be less work then >>> customizing and hacking around SessionConfig. >>> >>> On Wed, Mar 29, 2017 at 9:01 AM, Eric B wrote: >>> >>>> Agreed, but I want to use my own SessionConfig implementation in which >>>> the Sessionid is stored in a different cookie structure then the default >>>> implementation. >>>> >>>> I was looking for something that allows me to specify the SessionConfig >>>> implementation I want undertow to use, but can't find that config option >>>> anywhere. >>>> >>>> Thanks, >>>> >>>> Eric >>>> >>>> On Mar 29, 2017 8:44 AM, "Antoine Girard" >>>> wrote: >>>> >>>> A SessionConfig is just an interface for the SessionManager to retrieve >>>> the session ID. >>>> You do want to store session IDs in cookies, is that correct? >>>> In that case, simply use the default SessionCookieConfig: >>>> https://github.com/undertow-io/undertow/blob/master/core/src >>>> /main/java/io/undertow/server/session/SessionCookieConfig.java >>>> >>>> Cheers, >>>> Antoine >>>> >>>> >>>> On Wed, Mar 29, 2017 at 2:19 PM, Eric B wrote: >>>> >>>>> Thanks for the link; that is definitely going to be a big help for the >>>>> redis bridge. >>>>> >>>>> But I'm still unclear as to the "right" way to use/define my own >>>>> SessionConfig implementation. In the link you sent, they instantiate the >>>>> RedisManager with the existing SessionConfig object, and use whatever >>>>> undertow passes in the parameters. >>>>> >>>>> As I mentioned in my earlier post, I suspect I can hack around it >>>>> using the SessionConfigWrapper but that does not seem to respect the spirit >>>>> or intent of the wrapper, so I'm trying to figure out if there is >>>>> another/better way to do this. >>>>> >>>>> Or is the only solution to completely ignore the SessionConfig object >>>>> and build my solution independent of it? But then it will not respect the >>>>> contract of the SessionManager to retrieve the Sessionid from the SC object >>>>> >>>>> Thanks, >>>>> >>>>> Eric >>>>> >>>>> On Mar 29, 2017 8:00 AM, "Antoine Girard" >>>>> wrote: >>>>> >>>>> Hi Eric, >>>>> >>>>> Unfortunately I cannot share that code as it's company property. >>>>> As far as I can remember, it was really easy. I used the java redis >>>>> library: Jedis. >>>>> Oh, and look what I found: >>>>> https://github.com/coat/undertow-redis-session/blob/master/s >>>>> rc/main/java/com/pedanticprogrammer/undertow/RedisSessionManager.java >>>>> >>>>> That's a good starting point, if not the complete solution right there. >>>>> >>>>> Cheers, >>>>> Antoine >>>>> >>>>> On Wed, Mar 29, 2017 at 1:48 PM, Eric B wrote: >>>>> >>>>>> Antoine, >>>>>> >>>>>> That's exactly where I am heading too. Is there any chance you still >>>>>> have our can share the code you used to do that? >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Eric >>>>>> >>>>>> On Mar 29, 2017 7:24 AM, "Antoine Girard" >>>>> > wrote: >>>>>> >>>>>>> I did a similar thing once: persisting sessions into a Redis data >>>>>>> store >>>>>>> My starting point was the InMemorySessionManager. >>>>>>> >>>>>>> Good luck to you! >>>>>>> >>>>>>> Cheers, >>>>>>> Antoine >>>>>>> >>>>>>> On Wed, Mar 29, 2017 at 1:09 PM, Eric B wrote: >>>>>>> >>>>>>>> From my understanding, I was thinking/planning to create my own >>>>>>>> SessionManager to handle the Session loading. And from the docs, it >>>>>>>> indicates that the SessionManager must delegate retrieving the sessionId to >>>>>>>> the SessionConfig object >>>>>>>> >>>>>>>> Am I heading down the wrong path? Is there an easier/another way >>>>>>>> to load/persist the session? >>>>>>>> >>>>>>>> Thanks >>>>>>>> >>>>>>>> Eric >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Mar 29, 2017 7:01 AM, "Bill O'Neil" wrote: >>>>>>>> >>>>>>>> If you want such a custom solution why not just use a cookie and >>>>>>>> ignore all of the SessionConfig code. You can write a handler that >>>>>>>> checks for the cookie and attaches your own custom session object to the >>>>>>>> exchange based on the cookie. >>>>>>>> >>>>>>>> On Tue, Mar 28, 2017 at 9:41 PM, Eric B >>>>>>>> wrote: >>>>>>>> >>>>>>>>> Stuart, >>>>>>>>> >>>>>>>>> My goal is to actually replace the JSESSIONID cookie/mechanism >>>>>>>>> with my own mechanism. I am looking to use a JsonWebToken (JWT) to pass my >>>>>>>>> JSESSIONID to the application for a few different reasons: >>>>>>>>> 1) I would like to sign the JSESSIONID >>>>>>>>> 2) I would like to pass additional data along with the JSESSIONID >>>>>>>>> (ex: some auth claims) >>>>>>>>> 3) I want to be able to share this information between different >>>>>>>>> containers >>>>>>>>> 4) I want to pass a TTL with my token >>>>>>>>> >>>>>>>>> >>>>>>>>> At some level, I am trying to hack together an SSO solution >>>>>>>>> temporarily which would allow me to log into one container, and have some >>>>>>>>> credentials pass to another container. My issue is that both containers >>>>>>>>> are session based, and hence, need to be able to retrieve a session from a >>>>>>>>> sessionId. However, I also want to make sure that sessions don't expire - >>>>>>>>> that is if I am working in container 2, that my session in container 1 >>>>>>>>> continues to live (if the user gets redirected back to container 1). >>>>>>>>> >>>>>>>>> So, in essence, I am looking to be able to extract my SessionId >>>>>>>>> from a mechanism other than the standard JSESSIONID cookie, but yet, still >>>>>>>>> continue to use the sessions seamlessly. >>>>>>>>> >>>>>>>>> I figure I could potentially hack around the design using the >>>>>>>>> SessionConfigWrapper in which I use the wrap() method to return my own >>>>>>>>> SessionConfig object, but that does not seem to fit in the spirit or design >>>>>>>>> of the wrapper. >>>>>>>>> >>>>>>>>> Is there another/better way to accomplish something like this? Or >>>>>>>>> is undertow designed with only the JSESSIONID cookie in mind? I did notice >>>>>>>>> the >>>>>>>>> SessionConfig.SessionCookieSource enum with value OTHER, but >>>>>>>>> cannot seem to see/figure out where that is used, or how to leverage that >>>>>>>>> setting. I looked through the ServletContextImpl class but only see the >>>>>>>>> SessionTrackingMode of COOKIE, SSL and URL available. >>>>>>>>> >>>>>>>>> Any help/insight would be greatly appreciated. >>>>>>>>> >>>>>>>>> Thanks, >>>>>>>>> >>>>>>>>> Eric >>>>>>>>> >>>>>>>>> >>>>>>>>> On Tue, Mar 28, 2017 at 7:57 PM, Stuart Douglas < >>>>>>>>> sdouglas at redhat.com> wrote: >>>>>>>>> >>>>>>>>>> Why do you need a custom SessionConfig? In general Servlet will >>>>>>>>>> use >>>>>>>>>> its own SessionConfig that matches the configuration of the >>>>>>>>>> deployed >>>>>>>>>> application (generally just using a JSESSIONID cookie, unless it >>>>>>>>>> has >>>>>>>>>> been customized). >>>>>>>>>> >>>>>>>>>> Stuart >>>>>>>>>> >>>>>>>>>> On Tue, Mar 28, 2017 at 2:19 PM, Eric B >>>>>>>>>> wrote: >>>>>>>>>> > I've been trying to figure out how to build my own custom >>>>>>>>>> SessionManager to >>>>>>>>>> > push my sessions into Redis with a custom SessionConfig >>>>>>>>>> implementation, but >>>>>>>>>> > am having trouble finding any documentation to that extent. >>>>>>>>>> > >>>>>>>>>> > For the SesisonManager, I've read that I need to: >>>>>>>>>> > >>>>>>>>>> > Develop SessionManager which implements >>>>>>>>>> > io.undertow.server.session.SessionManager >>>>>>>>>> > Develop SessionManagerFactory which implements >>>>>>>>>> > io.undertow.servlet.api.SessionManagerFactory >>>>>>>>>> > Develop startup extension which implements >>>>>>>>>> > io.undertow.servlet.ServletExtension, and in >>>>>>>>>> handleDeployment(Deployment) >>>>>>>>>> > method change sessionManagerFactory with new >>>>>>>>>> SessionManagerFactory. >>>>>>>>>> > Register new ServletExtension by adding >>>>>>>>>> > ../META-INF/services/io.undertow.servlet.ServletExtension file >>>>>>>>>> (file should >>>>>>>>>> > contain the name of new ServletExtension. for example >>>>>>>>>> > com.my.utils.StartupExtension) >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> > But I can't seem to find anything that indicates how to provide >>>>>>>>>> my own >>>>>>>>>> > SessionConfig implementation. How do I register a custom >>>>>>>>>> SessionConfig >>>>>>>>>> > implementation? Is there any documentation to that extent? >>>>>>>>>> > >>>>>>>>>> > Are there any examples that can show me how to create my own >>>>>>>>>> SessionManager >>>>>>>>>> > and SessionConfig object? >>>>>>>>>> > >>>>>>>>>> > Thanks, >>>>>>>>>> > >>>>>>>>>> > Eric >>>>>>>>>> > >>>>>>>>>> > _______________________________________________ >>>>>>>>>> > undertow-dev mailing list >>>>>>>>>> > undertow-dev at lists.jboss.org >>>>>>>>>> > https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> undertow-dev mailing list >>>>>>>>> undertow-dev at lists.jboss.org >>>>>>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> undertow-dev mailing list >>>>>>>> undertow-dev at lists.jboss.org >>>>>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>>>> >>>>>>> >>>>>>> >>>>> >>>>> >>>> >>>> >>> > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/db075ace/attachment-0001.html From antoine.girard at ymail.com Wed Mar 29 15:19:59 2017 From: antoine.girard at ymail.com (Antoine Girard) Date: Wed, 29 Mar 2017 21:19:59 +0200 Subject: [undertow-dev] Reverse proxy In-Reply-To: References: Message-ID: Hi Geetha, I guess you are the author of this stackoverflow post: http://stackoverflow.com/questions/43029785/how-to-make-undertow-work-as-a-reverse-proxy-to-a-bunch-of-internal-applications I already posted a comment with a suggestion, isn't it enough? Also, please add some code so that we can see what you are doing. Cheers, Antoine On Wed, Mar 29, 2017 at 7:55 PM, Geetha D R wrote: > Hi All, > > I want to reverse proxy a bunch of different internal applications using > Undertow . > > For example my applications are: > > - https://secure.stage.org/application1/index.jsp > - https://cee.stage.org/application2/default.aspx > > Every request to these applications should go through the proxy server - > The proxy server in turn sets the authentication token on these requests > and fulfils the request, the response is sent back to the client browser > without exposing the authentication token to the client browser i.e., the > single sign on cookie is not sent to the browser > > When I setup my proxy to say localhost:7001 and try to hit any of the > applications for example https://cee.stage.org/application2/default.aspx > - this request should go > through proxy server and the proxy is responsible to inject to single sign > on cookie and request the target application - proxy sends back the > response from the target app. > > I am not sure how to implement this in undertow? Can you please provide > your suggestions > -- > Thanks > Geetha DR > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/cfa380e6/attachment.html From antoine.girard at ymail.com Wed Mar 29 15:42:32 2017 From: antoine.girard at ymail.com (Antoine Girard) Date: Wed, 29 Mar 2017 21:42:32 +0200 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: What spirit are you referring to? If you are talking about the javadoc bit you quoted earlier, it simply says that if you implement the *createSession *method, you must make sure to first search for an existing *sessionId *in the exchange and use it in case you find it. This is achieved by calling the *findSessionId *method on the SessionConfig object. This is exactly what is done in the redis example I sent earlier ( https://github.com/coat/undertow-redis-session/blob/ master/src/main/java/com/pedanticprogrammer/undertow/ RedisSessionManager.java line 69): String sessionId = sessionConfig.findSessionId(serverExchange); So to summarize, what you need to do: - Create a Redis based session manager (following the above example) - Set it up in your servlet Deployment via a *SessionManagerFactory*. You do not even have to care about a *SessionConfig*. Since you are using the servlet api with undertow, a *SessionCookieConfigImpl *(it implements *SessionConfig*) will be created automatically for you when the *ServletContext *is created. That's it! Cheers, Antoine On Wed, Mar 29, 2017 at 8:04 PM, Eric B wrote: > Agreed, but what calls that createSession() method? > > From what I can tell looking at the code, it's the ioundertow.servlet.spec. > ServletContextImpl.getSession(ServletContextImpl, HttpServerExchange, > boolean) which calls the createSession() method, getting the SessionConfig > object from the SessionCookieConfig object, which is instantiated in the > constructor: > > public ServletContextImpl(final ServletContainer servletContainer, > final Deployment deployment) { > this.servletContainer = servletContainer; > this.deployment = deployment; > this.deploymentInfo = deployment.getDeploymentInfo(); > * sessionCookieConfig = new SessionCookieConfigImpl(this);* > sessionCookieConfig.setPath(deploymentInfo.getContextPath()); > > ... > ... > > } > > > > public HttpSessionImpl getSession(final ServletContextImpl > originalServletContext, final HttpServerExchange exchange, boolean create) { > > SessionConfig c = originalServletContext.getSessionConfig(); > ... > ... > ... > ... > > final Session newSession = sessionManager.createSession(exchange, > c); > httpSession = SecurityActions.forSession(newSession, > this, true); > exchange.putAttachment(sessionAttachmentKey, httpSession); > } > } > return httpSession; > } > > > > So like I said, I can override the behaviour, but then I am not adhering > to the spirit of the Manager which specifies that it must defer calls to > the SessionConfig object. > > Thanks, > > Eric > > On Wed, Mar 29, 2017 at 10:05 AM, Antoine Girard > wrote: > >> The SessionManager#createSession() method takes a SessionConfig as second >> argument. >> I don't understand what more do you need! >> >> Cheers, >> Antoine >> >> On Wed, Mar 29, 2017 at 3:55 PM, Eric B wrote: >> >>> I'm not actually trying to reusue the SessionCookieConfigImpl. But in >>> the SessionManager javadoc, it clearly states that: >>> >>> * As part of session creation the session manager MUST attempt to >>> retrieve the {@link SessionCookieConfig} from >>> * the {@link HttpServerExchange} and use it to set the session cookie. >>> The frees up the session manager from >>> * needing to know details of the cookie configuration. When >>> invalidating a session the session manager MUST >>> * also use this to clear the session cookie. >>> >>> So while I can create my own SessionManager that completely ignores the >>> SessionConfig object, as per the SessionManager javadocs, the manager must >>> attempt to retrieve the SessionConfig object from the exchange to set the >>> session cookie. I am just trying to fulfill the SessionManager >>> requirements. >>> >>> But there is missing documentation indicating how/where one can specify >>> the SessionCookieConfig implementation that I want undertow to use. I >>> would like undertow to use my own custom implementation. >>> >>> Thanks, >>> >>> Eric >>> >>> >>> On Mar 29, 2017 9:35 AM, "Bill O'Neil" wrote: >>> >>>> What exactly will you gain from reusing SessionConfig if you are going >>>> to hack around a lot of it? If not much then just write your own handler >>>> that handles the cookies and talking to Redis it might be less work then >>>> customizing and hacking around SessionConfig. >>>> >>>> On Wed, Mar 29, 2017 at 9:01 AM, Eric B wrote: >>>> >>>>> Agreed, but I want to use my own SessionConfig implementation in which >>>>> the Sessionid is stored in a different cookie structure then the default >>>>> implementation. >>>>> >>>>> I was looking for something that allows me to specify the >>>>> SessionConfig implementation I want undertow to use, but can't find that >>>>> config option anywhere. >>>>> >>>>> Thanks, >>>>> >>>>> Eric >>>>> >>>>> On Mar 29, 2017 8:44 AM, "Antoine Girard" >>>>> wrote: >>>>> >>>>> A SessionConfig is just an interface for the SessionManager to >>>>> retrieve the session ID. >>>>> You do want to store session IDs in cookies, is that correct? >>>>> In that case, simply use the default SessionCookieConfig: >>>>> https://github.com/undertow-io/undertow/blob/master/core/src >>>>> /main/java/io/undertow/server/session/SessionCookieConfig.java >>>>> >>>>> Cheers, >>>>> Antoine >>>>> >>>>> >>>>> On Wed, Mar 29, 2017 at 2:19 PM, Eric B wrote: >>>>> >>>>>> Thanks for the link; that is definitely going to be a big help for >>>>>> the redis bridge. >>>>>> >>>>>> But I'm still unclear as to the "right" way to use/define my own >>>>>> SessionConfig implementation. In the link you sent, they instantiate the >>>>>> RedisManager with the existing SessionConfig object, and use whatever >>>>>> undertow passes in the parameters. >>>>>> >>>>>> As I mentioned in my earlier post, I suspect I can hack around it >>>>>> using the SessionConfigWrapper but that does not seem to respect the spirit >>>>>> or intent of the wrapper, so I'm trying to figure out if there is >>>>>> another/better way to do this. >>>>>> >>>>>> Or is the only solution to completely ignore the SessionConfig object >>>>>> and build my solution independent of it? But then it will not respect the >>>>>> contract of the SessionManager to retrieve the Sessionid from the SC object >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Eric >>>>>> >>>>>> On Mar 29, 2017 8:00 AM, "Antoine Girard" >>>>>> wrote: >>>>>> >>>>>> Hi Eric, >>>>>> >>>>>> Unfortunately I cannot share that code as it's company property. >>>>>> As far as I can remember, it was really easy. I used the java redis >>>>>> library: Jedis >>>>>> Oh, and look what I found: >>>>>> https://github.com/coat/undertow-redis-session/blob/master/s >>>>>> rc/main/java/com/pedanticprogrammer/undertow/RedisSessionManager.java >>>>>> >>>>>> That's a good starting point, if not the complete solution right >>>>>> there. >>>>>> >>>>>> Cheers, >>>>>> Antoine >>>>>> >>>>>> On Wed, Mar 29, 2017 at 1:48 PM, Eric B wrote: >>>>>> >>>>>>> Antoine, >>>>>>> >>>>>>> That's exactly where I am heading too. Is there any chance you >>>>>>> still have our can share the code you used to do that? >>>>>>> >>>>>>> Thanks, >>>>>>> >>>>>>> Eric >>>>>>> >>>>>>> On Mar 29, 2017 7:24 AM, "Antoine Girard" >>>>>> > wrote: >>>>>>> >>>>>>>> I did a similar thing once: persisting sessions into a Redis data >>>>>>>> store >>>>>>>> My starting point was the InMemorySessionManager. >>>>>>>> >>>>>>>> Good luck to you! >>>>>>>> >>>>>>>> Cheers, >>>>>>>> Antoine >>>>>>>> >>>>>>>> On Wed, Mar 29, 2017 at 1:09 PM, Eric B >>>>>>>> wrote: >>>>>>>> >>>>>>>>> From my understanding, I was thinking/planning to create my own >>>>>>>>> SessionManager to handle the Session loading. And from the docs, it >>>>>>>>> indicates that the SessionManager must delegate retrieving the sessionId to >>>>>>>>> the SessionConfig object >>>>>>>>> >>>>>>>>> Am I heading down the wrong path? Is there an easier/another way >>>>>>>>> to load/persist the session? >>>>>>>>> >>>>>>>>> Thanks >>>>>>>>> >>>>>>>>> Eric >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Mar 29, 2017 7:01 AM, "Bill O'Neil" wrote: >>>>>>>>> >>>>>>>>> If you want such a custom solution why not just use a cookie and >>>>>>>>> ignore all of the SessionConfig code. You can write a handler >>>>>>>>> that checks for the cookie and attaches your own custom session object to >>>>>>>>> the exchange based on the cookie. >>>>>>>>> >>>>>>>>> On Tue, Mar 28, 2017 at 9:41 PM, Eric B >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>>> Stuart, >>>>>>>>>> >>>>>>>>>> My goal is to actually replace the JSESSIONID cookie/mechanism >>>>>>>>>> with my own mechanism. I am looking to use a JsonWebToken (JWT) to pass my >>>>>>>>>> JSESSIONID to the application for a few different reasons: >>>>>>>>>> 1) I would like to sign the JSESSIONID >>>>>>>>>> 2) I would like to pass additional data along with the JSESSIONID >>>>>>>>>> (ex: some auth claims) >>>>>>>>>> 3) I want to be able to share this information between different >>>>>>>>>> containers >>>>>>>>>> 4) I want to pass a TTL with my token >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> At some level, I am trying to hack together an SSO solution >>>>>>>>>> temporarily which would allow me to log into one container, and have some >>>>>>>>>> credentials pass to another container. My issue is that both containers >>>>>>>>>> are session based, and hence, need to be able to retrieve a session from a >>>>>>>>>> sessionId. However, I also want to make sure that sessions don't expire - >>>>>>>>>> that is if I am working in container 2, that my session in container 1 >>>>>>>>>> continues to live (if the user gets redirected back to container 1). >>>>>>>>>> >>>>>>>>>> So, in essence, I am looking to be able to extract my SessionId >>>>>>>>>> from a mechanism other than the standard JSESSIONID cookie, but yet, still >>>>>>>>>> continue to use the sessions seamlessly. >>>>>>>>>> >>>>>>>>>> I figure I could potentially hack around the design using the >>>>>>>>>> SessionConfigWrapper in which I use the wrap() method to return my own >>>>>>>>>> SessionConfig object, but that does not seem to fit in the spirit or design >>>>>>>>>> of the wrapper. >>>>>>>>>> >>>>>>>>>> Is there another/better way to accomplish something like this? >>>>>>>>>> Or is undertow designed with only the JSESSIONID cookie in mind? I did >>>>>>>>>> notice the >>>>>>>>>> SessionConfig.SessionCookieSource enum with value OTHER, but >>>>>>>>>> cannot seem to see/figure out where that is used, or how to leverage that >>>>>>>>>> setting. I looked through the ServletContextImpl class but only see the >>>>>>>>>> SessionTrackingMode of COOKIE, SSL and URL available. >>>>>>>>>> >>>>>>>>>> Any help/insight would be greatly appreciated. >>>>>>>>>> >>>>>>>>>> Thanks, >>>>>>>>>> >>>>>>>>>> Eric >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Tue, Mar 28, 2017 at 7:57 PM, Stuart Douglas < >>>>>>>>>> sdouglas at redhat.com> wrote: >>>>>>>>>> >>>>>>>>>>> Why do you need a custom SessionConfig? In general Servlet will >>>>>>>>>>> use >>>>>>>>>>> its own SessionConfig that matches the configuration of the >>>>>>>>>>> deployed >>>>>>>>>>> application (generally just using a JSESSIONID cookie, unless it >>>>>>>>>>> has >>>>>>>>>>> been customized). >>>>>>>>>>> >>>>>>>>>>> Stuart >>>>>>>>>>> >>>>>>>>>>> On Tue, Mar 28, 2017 at 2:19 PM, Eric B >>>>>>>>>>> wrote: >>>>>>>>>>> > I've been trying to figure out how to build my own custom >>>>>>>>>>> SessionManager to >>>>>>>>>>> > push my sessions into Redis with a custom SessionConfig >>>>>>>>>>> implementation, but >>>>>>>>>>> > am having trouble finding any documentation to that extent. >>>>>>>>>>> > >>>>>>>>>>> > For the SesisonManager, I've read that I need to: >>>>>>>>>>> > >>>>>>>>>>> > Develop SessionManager which implements >>>>>>>>>>> > io.undertow.server.session.SessionManager >>>>>>>>>>> > Develop SessionManagerFactory which implements >>>>>>>>>>> > io.undertow.servlet.api.SessionManagerFactory >>>>>>>>>>> > Develop startup extension which implements >>>>>>>>>>> > io.undertow.servlet.ServletExtension, and in >>>>>>>>>>> handleDeployment(Deployment) >>>>>>>>>>> > method change sessionManagerFactory with new >>>>>>>>>>> SessionManagerFactory. >>>>>>>>>>> > Register new ServletExtension by adding >>>>>>>>>>> > ../META-INF/services/io.undertow.servlet.ServletExtension >>>>>>>>>>> file (file should >>>>>>>>>>> > contain the name of new ServletExtension. for example >>>>>>>>>>> > com.my.utils.StartupExtension) >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> > But I can't seem to find anything that indicates how to >>>>>>>>>>> provide my own >>>>>>>>>>> > SessionConfig implementation. How do I register a custom >>>>>>>>>>> SessionConfig >>>>>>>>>>> > implementation? Is there any documentation to that extent? >>>>>>>>>>> > >>>>>>>>>>> > Are there any examples that can show me how to create my own >>>>>>>>>>> SessionManager >>>>>>>>>>> > and SessionConfig object? >>>>>>>>>>> > >>>>>>>>>>> > Thanks, >>>>>>>>>>> > >>>>>>>>>>> > Eric >>>>>>>>>>> > >>>>>>>>>>> > _______________________________________________ >>>>>>>>>>> > undertow-dev mailing list >>>>>>>>>>> > undertow-dev at lists.jboss.org >>>>>>>>>>> > https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> undertow-dev mailing list >>>>>>>>>> undertow-dev at lists.jboss.org >>>>>>>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> undertow-dev mailing list >>>>>>>>> undertow-dev at lists.jboss.org >>>>>>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/84e39c5e/attachment-0001.html From geethdr at gmail.com Wed Mar 29 15:43:58 2017 From: geethdr at gmail.com (Geetha D R) Date: Wed, 29 Mar 2017 15:43:58 -0400 Subject: [undertow-dev] Reverse proxy In-Reply-To: References: Message-ID: Hi Antoine, Yes I posted the same question in stackoverflow. Attached my test file. I set my browser proxy to localhost:8080 and try to hit this url in the browser 'http://stage-server1:8557/testService/sys/ refreshConfiguration.jsp ' - This goes through either one of the servers - 1,2,3 but Im not able to send response from this actual request url (this url sends back plain text response) to the browser. Thank you for your help. Thanks GeethaDR On Wed, Mar 29, 2017 at 3:19 PM, Antoine Girard wrote: > Hi Geetha, > > I guess you are the author of this stackoverflow post: > http://stackoverflow.com/questions/43029785/how-to- > make-undertow-work-as-a-reverse-proxy-to-a-bunch-of-internal-applications > > I already posted a comment with a suggestion, isn't it enough? > Also, please add some code so that we can see what you are doing. > > Cheers, > Antoine > > On Wed, Mar 29, 2017 at 7:55 PM, Geetha D R wrote: > >> Hi All, >> >> I want to reverse proxy a bunch of different internal applications using >> Undertow . >> >> For example my applications are: >> >> - https://secure.stage.org/application1/index.jsp >> - https://cee.stage.org/application2/default.aspx >> >> Every request to these applications should go through the proxy server - >> The proxy server in turn sets the authentication token on these requests >> and fulfils the request, the response is sent back to the client browser >> without exposing the authentication token to the client browser i.e., the >> single sign on cookie is not sent to the browser >> >> When I setup my proxy to say localhost:7001 and try to hit any of the >> applications for example https://cee.stage.org/application2/default.aspx >> - this request should >> go through proxy server and the proxy is responsible to inject to single >> sign on cookie and request the target application - proxy sends back the >> response from the target app. >> >> I am not sure how to implement this in undertow? Can you please provide >> your suggestions >> -- >> Thanks >> Geetha DR >> >> _______________________________________________ >> undertow-dev mailing list >> undertow-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/undertow-dev >> > > -- Thanks Geetha DR -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/3efeb35f/attachment.html From geethdr at gmail.com Wed Mar 29 15:45:24 2017 From: geethdr at gmail.com (Geetha D R) Date: Wed, 29 Mar 2017 15:45:24 -0400 Subject: [undertow-dev] Reverse proxy In-Reply-To: References: Message-ID: Sorry forgot to attach the source file. On Wed, Mar 29, 2017 at 3:43 PM, Geetha D R wrote: > Hi Antoine, > > Yes I posted the same question in stackoverflow. > > Attached my test file. I set my browser proxy to localhost:8080 and try to > hit this url in the browser 'http://stage-server1:8557/ > testService/sys/refreshConfiguration.jsp > ' > - This goes through either one of the servers - 1,2,3 but Im not able to > send response from this actual request url (this url sends back plain text > response) to the browser. > > Thank you for your help. > > Thanks > GeethaDR > > On Wed, Mar 29, 2017 at 3:19 PM, Antoine Girard > wrote: > >> Hi Geetha, >> >> I guess you are the author of this stackoverflow post: >> http://stackoverflow.com/questions/43029785/how-to-make- >> undertow-work-as-a-reverse-proxy-to-a-bunch-of-internal-applications >> >> I already posted a comment with a suggestion, isn't it enough? >> Also, please add some code so that we can see what you are doing. >> >> Cheers, >> Antoine >> >> On Wed, Mar 29, 2017 at 7:55 PM, Geetha D R wrote: >> >>> Hi All, >>> >>> I want to reverse proxy a bunch of different internal applications using >>> Undertow . >>> >>> For example my applications are: >>> >>> - https://secure.stage.org/application1/index.jsp >>> - https://cee.stage.org/application2/default.aspx >>> >>> Every request to these applications should go through the proxy server - >>> The proxy server in turn sets the authentication token on these requests >>> and fulfils the request, the response is sent back to the client browser >>> without exposing the authentication token to the client browser i.e., the >>> single sign on cookie is not sent to the browser >>> >>> When I setup my proxy to say localhost:7001 and try to hit any of the >>> applications for example https://cee.stage.org/application2/default.aspx >>> - this request should >>> go through proxy server and the proxy is responsible to inject to single >>> sign on cookie and request the target application - proxy sends back the >>> response from the target app. >>> >>> I am not sure how to implement this in undertow? Can you please provide >>> your suggestions >>> -- >>> Thanks >>> Geetha DR >>> >>> _______________________________________________ >>> undertow-dev mailing list >>> undertow-dev at lists.jboss.org >>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>> >> >> > > > -- > Thanks > Geetha DR > -- Thanks Geetha DR -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/61462947/attachment-0001.html -------------- next part -------------- A non-text attachment was scrubbed... Name: Main.java Type: application/octet-stream Size: 5487 bytes Desc: not available Url : http://lists.jboss.org/pipermail/undertow-dev/attachments/20170329/61462947/attachment-0001.obj From sdouglas at redhat.com Wed Mar 29 20:16:46 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Thu, 30 Mar 2017 11:16:46 +1100 Subject: [undertow-dev] Howto create/configure a custom SessionManager and SessionConfig implementation? In-Reply-To: References: Message-ID: SessionConfig does not really enforce a cookie structure (unless you want to use multiple cookies). If you are only using a single cookie just set the cookie name, and then pass whatever cookie value you want to use in as the value. Otherwise just ignore SessionConfig, it sounds like you don't want this to be configurable anyway. SessionConfig is basically just an abstraction around retrieving the session id so the manager does not need to know about how to retrieve it, it sounds like in your implementation you want the manager to be more closely tied to how the session id is stored in the exchange so you don't really need the abstraction. Stuart On Thu, Mar 30, 2017 at 5:04 AM, Eric B wrote: > Agreed, but what calls that createSession() method? > > From what I can tell looking at the code, it's the > io.undertow.servlet.spec.ServletContextImpl.getSession(ServletContextImpl, > HttpServerExchange, boolean) which calls the createSession() method, getting > the SessionConfig object from the SessionCookieConfig object, which is > instantiated in the constructor: > > public ServletContextImpl(final ServletContainer servletContainer, final > Deployment deployment) { > this.servletContainer = servletContainer; > this.deployment = deployment; > this.deploymentInfo = deployment.getDeploymentInfo(); > sessionCookieConfig = new SessionCookieConfigImpl(this); > sessionCookieConfig.setPath(deploymentInfo.getContextPath()); > > ... > ... > > } > > > > public HttpSessionImpl getSession(final ServletContextImpl > originalServletContext, final HttpServerExchange exchange, boolean create) { > > SessionConfig c = originalServletContext.getSessionConfig(); > ... > ... > ... > ... > > final Session newSession = > sessionManager.createSession(exchange, c); > httpSession = SecurityActions.forSession(newSession, this, > true); > exchange.putAttachment(sessionAttachmentKey, httpSession); > } > } > return httpSession; > } > > > > So like I said, I can override the behaviour, but then I am not adhering to > the spirit of the Manager which specifies that it must defer calls to the > SessionConfig object. > > Thanks, > > Eric > > On Wed, Mar 29, 2017 at 10:05 AM, Antoine Girard > wrote: >> >> The SessionManager#createSession() method takes a SessionConfig as second >> argument. >> I don't understand what more do you need! >> >> Cheers, >> Antoine >> >> On Wed, Mar 29, 2017 at 3:55 PM, Eric B wrote: >>> >>> I'm not actually trying to reusue the SessionCookieConfigImpl. But in >>> the SessionManager javadoc, it clearly states that: >>> >>> * As part of session creation the session manager MUST attempt to >>> retrieve the {@link SessionCookieConfig} from >>> * the {@link HttpServerExchange} and use it to set the session cookie. >>> The frees up the session manager from >>> * needing to know details of the cookie configuration. When invalidating >>> a session the session manager MUST >>> * also use this to clear the session cookie. >>> >>> So while I can create my own SessionManager that completely ignores the >>> SessionConfig object, as per the SessionManager javadocs, the manager must >>> attempt to retrieve the SessionConfig object from the exchange to set the >>> session cookie. I am just trying to fulfill the SessionManager >>> requirements. >>> >>> But there is missing documentation indicating how/where one can specify >>> the SessionCookieConfig implementation that I want undertow to use. I would >>> like undertow to use my own custom implementation. >>> >>> Thanks, >>> >>> Eric >>> >>> >>> On Mar 29, 2017 9:35 AM, "Bill O'Neil" wrote: >>>> >>>> What exactly will you gain from reusing SessionConfig if you are going >>>> to hack around a lot of it? If not much then just write your own handler >>>> that handles the cookies and talking to Redis it might be less work then >>>> customizing and hacking around SessionConfig. >>>> >>>> On Wed, Mar 29, 2017 at 9:01 AM, Eric B wrote: >>>>> >>>>> Agreed, but I want to use my own SessionConfig implementation in which >>>>> the Sessionid is stored in a different cookie structure then the default >>>>> implementation. >>>>> >>>>> I was looking for something that allows me to specify the SessionConfig >>>>> implementation I want undertow to use, but can't find that config option >>>>> anywhere. >>>>> >>>>> Thanks, >>>>> >>>>> Eric >>>>> >>>>> On Mar 29, 2017 8:44 AM, "Antoine Girard" >>>>> wrote: >>>>> >>>>> A SessionConfig is just an interface for the SessionManager to retrieve >>>>> the session ID. >>>>> You do want to store session IDs in cookies, is that correct? >>>>> In that case, simply use the default SessionCookieConfig: >>>>> >>>>> https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/session/SessionCookieConfig.java >>>>> >>>>> Cheers, >>>>> Antoine >>>>> >>>>> >>>>> On Wed, Mar 29, 2017 at 2:19 PM, Eric B wrote: >>>>>> >>>>>> Thanks for the link; that is definitely going to be a big help for the >>>>>> redis bridge. >>>>>> >>>>>> But I'm still unclear as to the "right" way to use/define my own >>>>>> SessionConfig implementation. In the link you sent, they instantiate the >>>>>> RedisManager with the existing SessionConfig object, and use whatever >>>>>> undertow passes in the parameters. >>>>>> >>>>>> As I mentioned in my earlier post, I suspect I can hack around it >>>>>> using the SessionConfigWrapper but that does not seem to respect the spirit >>>>>> or intent of the wrapper, so I'm trying to figure out if there is >>>>>> another/better way to do this. >>>>>> >>>>>> Or is the only solution to completely ignore the SessionConfig object >>>>>> and build my solution independent of it? But then it will not respect the >>>>>> contract of the SessionManager to retrieve the Sessionid from the SC object >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Eric >>>>>> >>>>>> On Mar 29, 2017 8:00 AM, "Antoine Girard" >>>>>> wrote: >>>>>> >>>>>> Hi Eric, >>>>>> >>>>>> Unfortunately I cannot share that code as it's company property. >>>>>> As far as I can remember, it was really easy. I used the java redis >>>>>> library: Jedis. >>>>>> Oh, and look what I found: >>>>>> >>>>>> https://github.com/coat/undertow-redis-session/blob/master/src/main/java/com/pedanticprogrammer/undertow/RedisSessionManager.java >>>>>> >>>>>> That's a good starting point, if not the complete solution right >>>>>> there. >>>>>> >>>>>> Cheers, >>>>>> Antoine >>>>>> >>>>>> On Wed, Mar 29, 2017 at 1:48 PM, Eric B wrote: >>>>>>> >>>>>>> Antoine, >>>>>>> >>>>>>> That's exactly where I am heading too. Is there any chance you still >>>>>>> have our can share the code you used to do that? >>>>>>> >>>>>>> Thanks, >>>>>>> >>>>>>> Eric >>>>>>> >>>>>>> On Mar 29, 2017 7:24 AM, "Antoine Girard" >>>>>>> wrote: >>>>>>>> >>>>>>>> I did a similar thing once: persisting sessions into a Redis data >>>>>>>> store >>>>>>>> My starting point was the InMemorySessionManager. >>>>>>>> >>>>>>>> Good luck to you! >>>>>>>> >>>>>>>> Cheers, >>>>>>>> Antoine >>>>>>>> >>>>>>>> On Wed, Mar 29, 2017 at 1:09 PM, Eric B wrote: >>>>>>>>> >>>>>>>>> From my understanding, I was thinking/planning to create my own >>>>>>>>> SessionManager to handle the Session loading. And from the docs, it >>>>>>>>> indicates that the SessionManager must delegate retrieving the sessionId to >>>>>>>>> the SessionConfig object >>>>>>>>> >>>>>>>>> Am I heading down the wrong path? Is there an easier/another way >>>>>>>>> to load/persist the session? >>>>>>>>> >>>>>>>>> Thanks >>>>>>>>> >>>>>>>>> Eric >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Mar 29, 2017 7:01 AM, "Bill O'Neil" wrote: >>>>>>>>> >>>>>>>>> If you want such a custom solution why not just use a cookie and >>>>>>>>> ignore all of the SessionConfig code. You can write a handler that checks >>>>>>>>> for the cookie and attaches your own custom session object to the exchange >>>>>>>>> based on the cookie. >>>>>>>>> >>>>>>>>> On Tue, Mar 28, 2017 at 9:41 PM, Eric B >>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>> Stuart, >>>>>>>>>> >>>>>>>>>> My goal is to actually replace the JSESSIONID cookie/mechanism >>>>>>>>>> with my own mechanism. I am looking to use a JsonWebToken (JWT) to pass my >>>>>>>>>> JSESSIONID to the application for a few different reasons: >>>>>>>>>> 1) I would like to sign the JSESSIONID >>>>>>>>>> 2) I would like to pass additional data along with the JSESSIONID >>>>>>>>>> (ex: some auth claims) >>>>>>>>>> 3) I want to be able to share this information between different >>>>>>>>>> containers >>>>>>>>>> 4) I want to pass a TTL with my token >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> At some level, I am trying to hack together an SSO solution >>>>>>>>>> temporarily which would allow me to log into one container, and have some >>>>>>>>>> credentials pass to another container. My issue is that both containers are >>>>>>>>>> session based, and hence, need to be able to retrieve a session from a >>>>>>>>>> sessionId. However, I also want to make sure that sessions don't expire - >>>>>>>>>> that is if I am working in container 2, that my session in container 1 >>>>>>>>>> continues to live (if the user gets redirected back to container 1). >>>>>>>>>> >>>>>>>>>> So, in essence, I am looking to be able to extract my SessionId >>>>>>>>>> from a mechanism other than the standard JSESSIONID cookie, but yet, still >>>>>>>>>> continue to use the sessions seamlessly. >>>>>>>>>> >>>>>>>>>> I figure I could potentially hack around the design using the >>>>>>>>>> SessionConfigWrapper in which I use the wrap() method to return my own >>>>>>>>>> SessionConfig object, but that does not seem to fit in the spirit or design >>>>>>>>>> of the wrapper. >>>>>>>>>> >>>>>>>>>> Is there another/better way to accomplish something like this? Or >>>>>>>>>> is undertow designed with only the JSESSIONID cookie in mind? I did notice >>>>>>>>>> the >>>>>>>>>> SessionConfig.SessionCookieSource enum with value OTHER, but >>>>>>>>>> cannot seem to see/figure out where that is used, or how to leverage that >>>>>>>>>> setting. I looked through the ServletContextImpl class but only see the >>>>>>>>>> SessionTrackingMode of COOKIE, SSL and URL available. >>>>>>>>>> >>>>>>>>>> Any help/insight would be greatly appreciated. >>>>>>>>>> >>>>>>>>>> Thanks, >>>>>>>>>> >>>>>>>>>> Eric >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Tue, Mar 28, 2017 at 7:57 PM, Stuart Douglas >>>>>>>>>> wrote: >>>>>>>>>>> >>>>>>>>>>> Why do you need a custom SessionConfig? In general Servlet will >>>>>>>>>>> use >>>>>>>>>>> its own SessionConfig that matches the configuration of the >>>>>>>>>>> deployed >>>>>>>>>>> application (generally just using a JSESSIONID cookie, unless it >>>>>>>>>>> has >>>>>>>>>>> been customized). >>>>>>>>>>> >>>>>>>>>>> Stuart >>>>>>>>>>> >>>>>>>>>>> On Tue, Mar 28, 2017 at 2:19 PM, Eric B >>>>>>>>>>> wrote: >>>>>>>>>>> > I've been trying to figure out how to build my own custom >>>>>>>>>>> > SessionManager to >>>>>>>>>>> > push my sessions into Redis with a custom SessionConfig >>>>>>>>>>> > implementation, but >>>>>>>>>>> > am having trouble finding any documentation to that extent. >>>>>>>>>>> > >>>>>>>>>>> > For the SesisonManager, I've read that I need to: >>>>>>>>>>> > >>>>>>>>>>> > Develop SessionManager which implements >>>>>>>>>>> > io.undertow.server.session.SessionManager >>>>>>>>>>> > Develop SessionManagerFactory which implements >>>>>>>>>>> > io.undertow.servlet.api.SessionManagerFactory >>>>>>>>>>> > Develop startup extension which implements >>>>>>>>>>> > io.undertow.servlet.ServletExtension, and in >>>>>>>>>>> > handleDeployment(Deployment) >>>>>>>>>>> > method change sessionManagerFactory with new >>>>>>>>>>> > SessionManagerFactory. >>>>>>>>>>> > Register new ServletExtension by adding >>>>>>>>>>> > ../META-INF/services/io.undertow.servlet.ServletExtension file >>>>>>>>>>> > (file should >>>>>>>>>>> > contain the name of new ServletExtension. for example >>>>>>>>>>> > com.my.utils.StartupExtension) >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> > But I can't seem to find anything that indicates how to provide >>>>>>>>>>> > my own >>>>>>>>>>> > SessionConfig implementation. How do I register a custom >>>>>>>>>>> > SessionConfig >>>>>>>>>>> > implementation? Is there any documentation to that extent? >>>>>>>>>>> > >>>>>>>>>>> > Are there any examples that can show me how to create my own >>>>>>>>>>> > SessionManager >>>>>>>>>>> > and SessionConfig object? >>>>>>>>>>> > >>>>>>>>>>> > Thanks, >>>>>>>>>>> > >>>>>>>>>>> > Eric >>>>>>>>>>> > >>>>>>>>>>> > _______________________________________________ >>>>>>>>>>> > undertow-dev mailing list >>>>>>>>>>> > undertow-dev at lists.jboss.org >>>>>>>>>>> > https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> undertow-dev mailing list >>>>>>>>>> undertow-dev at lists.jboss.org >>>>>>>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> undertow-dev mailing list >>>>>>>>> undertow-dev at lists.jboss.org >>>>>>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>>>>>> >>>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >> > > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From mike at stardog.com Thu Mar 30 15:58:13 2017 From: mike at stardog.com (Michael Grove) Date: Thu, 30 Mar 2017 15:58:13 -0400 Subject: [undertow-dev] Is it ok to do a blocking action from a Receiver callback? Message-ID: If I have some code ala theRequest.getRequestReceiver().receiveFullString((theExchange, str) -> { ... }); Is it ok to perform a time consuming task w/ the body of the request in the callback, or is it better to move off the io thread and use `HttpServerExchange.getInputStream`? Cheers, Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170330/628ed8b8/attachment.html From sdouglas at redhat.com Thu Mar 30 17:48:46 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Fri, 31 Mar 2017 08:48:46 +1100 Subject: [undertow-dev] Is it ok to do a blocking action from a Receiver callback? In-Reply-To: References: Message-ID: No, the callback is invoked by the IO thread, so you would need to dispatch to a worker thread. Stuart On Fri, Mar 31, 2017 at 6:58 AM, Michael Grove wrote: > If I have some code ala > > theRequest.getRequestReceiver().receiveFullString((theExchange, str) -> { > ... > }); > > Is it ok to perform a time consuming task w/ the body of the request in the > callback, or is it better to move off the io thread and use > `HttpServerExchange.getInputStream`? > > Cheers, > > Mike > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From antoine.girard at ymail.com Fri Mar 31 05:05:54 2017 From: antoine.girard at ymail.com (Antoine Girard) Date: Fri, 31 Mar 2017 11:05:54 +0200 Subject: [undertow-dev] Is it ok to do a blocking action from a Receiver callback? In-Reply-To: References: Message-ID: Correct me if I am wrong Stuart but if the request was already dispatched before calling the getRequestReceiver(), then the callback will be handled by a worker thread. Cheers, Antoine On Thu, Mar 30, 2017 at 11:48 PM, Stuart Douglas wrote: > No, the callback is invoked by the IO thread, so you would need to > dispatch to a worker thread. > > Stuart > > On Fri, Mar 31, 2017 at 6:58 AM, Michael Grove wrote: > > If I have some code ala > > > > theRequest.getRequestReceiver().receiveFullString((theExchange, str) -> > { > > ... > > }); > > > > Is it ok to perform a time consuming task w/ the body of the request in > the > > callback, or is it better to move off the io thread and use > > `HttpServerExchange.getInputStream`? > > > > Cheers, > > > > Mike > > > > _______________________________________________ > > undertow-dev mailing list > > undertow-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/undertow-dev > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170331/f5862431/attachment-0001.html From sdouglas at redhat.com Fri Mar 31 06:30:47 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Fri, 31 Mar 2017 21:30:47 +1100 Subject: [undertow-dev] Is it ok to do a blocking action from a Receiver callback? In-Reply-To: References: Message-ID: It will generally be handled by an IO thread, although it can depend on how large the request is. If a request is small enough that it gets read immediately then the request will be handled in the same thread, otherwise it will be handled by the IO thread to full read the request. Stuart On Fri, Mar 31, 2017 at 8:05 PM, Antoine Girard wrote: > Correct me if I am wrong Stuart but if the request was already dispatched > before calling the getRequestReceiver(), then the callback will be handled > by a worker thread. > > Cheers, > Antoine > > On Thu, Mar 30, 2017 at 11:48 PM, Stuart Douglas > wrote: >> >> No, the callback is invoked by the IO thread, so you would need to >> dispatch to a worker thread. >> >> Stuart >> >> On Fri, Mar 31, 2017 at 6:58 AM, Michael Grove wrote: >> > If I have some code ala >> > >> > theRequest.getRequestReceiver().receiveFullString((theExchange, str) -> >> > { >> > ... >> > }); >> > >> > Is it ok to perform a time consuming task w/ the body of the request in >> > the >> > callback, or is it better to move off the io thread and use >> > `HttpServerExchange.getInputStream`? >> > >> > Cheers, >> > >> > Mike >> > >> > _______________________________________________ >> > undertow-dev mailing list >> > undertow-dev at lists.jboss.org >> > https://lists.jboss.org/mailman/listinfo/undertow-dev >> _______________________________________________ >> undertow-dev mailing list >> undertow-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/undertow-dev > > From mike at stardog.com Fri Mar 31 08:10:58 2017 From: mike at stardog.com (Michael Grove) Date: Fri, 31 Mar 2017 08:10:58 -0400 Subject: [undertow-dev] Is it ok to do a blocking action from a Receiver callback? In-Reply-To: References: Message-ID: So what would be the right workflow using Receiver to read a large request, do something time-consuming, and send back a response? Use Receiver callbacks to write partial payloads to disk, and the last callback then dispatch to a worker thread? Cheers, Mike On Fri, Mar 31, 2017 at 6:30 AM, Stuart Douglas wrote: > It will generally be handled by an IO thread, although it can depend > on how large the request is. If a request is small enough that it gets > read immediately then the request will be handled in the same thread, > otherwise it will be handled by the IO thread to full read the > request. > > Stuart > > On Fri, Mar 31, 2017 at 8:05 PM, Antoine Girard > wrote: > > Correct me if I am wrong Stuart but if the request was already dispatched > > before calling the getRequestReceiver(), then the callback will be > handled > > by a worker thread. > > > > Cheers, > > Antoine > > > > On Thu, Mar 30, 2017 at 11:48 PM, Stuart Douglas > > wrote: > >> > >> No, the callback is invoked by the IO thread, so you would need to > >> dispatch to a worker thread. > >> > >> Stuart > >> > >> On Fri, Mar 31, 2017 at 6:58 AM, Michael Grove > wrote: > >> > If I have some code ala > >> > > >> > theRequest.getRequestReceiver().receiveFullString((theExchange, str) > -> > >> > { > >> > ... > >> > }); > >> > > >> > Is it ok to perform a time consuming task w/ the body of the request > in > >> > the > >> > callback, or is it better to move off the io thread and use > >> > `HttpServerExchange.getInputStream`? > >> > > >> > Cheers, > >> > > >> > Mike > >> > > >> > _______________________________________________ > >> > undertow-dev mailing list > >> > undertow-dev at lists.jboss.org > >> > https://lists.jboss.org/mailman/listinfo/undertow-dev > >> _______________________________________________ > >> undertow-dev mailing list > >> undertow-dev at lists.jboss.org > >> https://lists.jboss.org/mailman/listinfo/undertow-dev > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170331/091917dc/attachment.html