http2-examples | Example code for the blog posts on http : //fstab | Blog library

 by   fstab Java Version: Current License: Apache-2.0

kandi X-RAY | http2-examples Summary

kandi X-RAY | http2-examples Summary

http2-examples is a Java library typically used in Web Site, Blog applications. http2-examples has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. However http2-examples build file is not available. You can download it from GitHub.

Example code for the blog posts on [
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              http2-examples has a low active ecosystem.
              It has 46 star(s) with 40 fork(s). There are 3 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 2 open issues and 1 have been closed. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of http2-examples is current.

            kandi-Quality Quality

              http2-examples has 0 bugs and 0 code smells.

            kandi-Security Security

              http2-examples has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              http2-examples code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              http2-examples is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              http2-examples releases are not available. You will need to build from source code and install.
              http2-examples has no build file. You will be need to create the build yourself to build the component from source.
              http2-examples saves you 540 person hours of effort in developing the same functionality from scratch.
              It has 1265 lines of code, 49 functions and 28 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed http2-examples and discovered the below as its top functions. This is intended to give you an instant insight into http2-examples implemented functionality, and help decide if they suit your requirements.
            • Handle a GET request .
            • Handle the incoming request .
            • Initialize HTTP2 connection .
            • Main method .
            • Creates the SSL context .
            • Waits for all responses to complete .
            • Handle a GET request .
            • Waits for the settings to complete .
            • Get the current time in seconds .
            • Get the singleton instance
            Get all kandi verified functions for this library.

            http2-examples Key Features

            No Key Features are available at this moment for http2-examples.

            http2-examples Examples and Code Snippets

            No Code Snippets are available at this moment for http2-examples.

            Community Discussions

            QUESTION

            Recycling Jetty Http2 Client streams -- best practice?
            Asked 2017-Jul-26 at 09:28

            We have a Jetty Http2 Client constructed roughly as the example here.

            Each request processed by the client calls session.newStream(...). It appears that old streams are not GC-ed. However, we can't seem to find a good way, in the API, to either recycle them, or close them.

            Should we set a very small idle timeout using streamPromise.get().setIdleTimeout(t)?

            Should we keep the Stream object, mark it when an exchange finishes, then reuse it? In this case though, we also need to recycle the listener, which makes is stateful.

            Is there a way to "close" a Stream object, or mark it for GC? Simply setting it to null doesn't seem very API-ish.

            ...

            ANSWER

            Answered 2017-Jul-26 at 09:28

            Streams that are closed are GCed.

            Streams support half closes, so in order for a stream to be closed you need to send a frame with the end_stream flag set, and receive a frame with the end_stream flag set.

            If you use HTTP2Client directly, chances are that you're not ending the stream on your side (i.e. you send frames, but forget to set the end_stream flag on the last frame you send), or the server does not end the stream (which would be a server bug).

            Either case, turning on DEBUG logging for category org.eclipse.jetty.http2 on the client will tell you whether the frames have the end_stream flag set, and report when streams are removed - you just need to parse the possibly large-ish log files.

            Source https://stackoverflow.com/questions/45322070

            QUESTION

            HTTP/2 client - associate response to request - can rely on stream id?
            Asked 2017-Jun-04 at 21:42

            I'm trying to use netty to implement HTTP/2 client. In this example (line 93) they manually increment streamId and put it to the map. When response comes they look for HttpConversionUtil.ExtensionHeaderNames.STREAM_ID header parameter and thus associate the response with the request.

            I don't like the idea of increasing streamId by myself. Can I somehow get the id netty's going to use to writeAndFlush the request?

            Also, does it take much resources to create a new stream? Or is it just an identifier?

            ...

            ANSWER

            Answered 2017-Jun-04 at 21:42

            I'm pretty sure, at this moment you can't get streamId generated and used by Netty. Also, I don't like the idea of increasing streamId by myself too, but looks like it's okay to do this with current API.

            I've checked Netty sources and found next things:

            1. HttpToHttp2ConnectionHandler is used for writing requests. It has private method getStreamId which is used in write method for getting value of currentStreamId. But we doesn't have any access to this variable.
            2. getStreamId method uses another method called incrementAndGetNextStreamId. So, again, we can only increment and get new streamId value but can't get the current one.

            Both of these classes marked with annotation @UnstableApi, so maybe this behavior will be change in the future.

            Here's some related links:

            1. A little bit updated HTTP 2 client example from Netty repository.
            2. HTTP/2 Java Client Examples.
            3. Why netty http2 server always use odd number for streamId.

            Source https://stackoverflow.com/questions/44334155

            QUESTION

            What is the best way to implement an HTTP2 servlet in Jetty?
            Asked 2017-Feb-05 at 22:32

            I understand that HTTP2 in Jetty is mostly at the Connector, Transport and Channel levels.

            I'm trying to decide which combination would be the best to transport binary data between client and server:

            1. Jetty HTTP2 server with async servlet + Jetty HTTP2 client
            2. Jetty HTTP2 server with sync servlet + Jetty HTTP2 client
            3. Jetty HTTP2 server with async servlet + Netty HTTP2 client
            4. GRPC client and server (both are default Netty based)

            Details:

            I would like to send binary data to my client and I would like the connections to be non-blocking/async. The number of concurrent client requests can be high and the server could take a few seconds (some times) to respond to some requests.

            Each response is small chunk of binary data. I would've liked it if I could send Netty's ByteBufs directly as the response instead of copying to byte[] or ByteBuffer but that is not directly related to this particular question.

            Method #4 is not my favorite because of the ProtoBuf wrapping (link) limitation (link).

            Jetty references:

            ...

            ANSWER

            Answered 2017-Feb-05 at 22:32

            Disclaimer, I am the Jetty HTTP/2 maintainer.

            Given that you have a large number of clients and that processing could take seconds, I would recommend to go with option 1 - async servlet and Jetty HTTP/2 client.

            With "async servlet" you have 2 flavors: 1) async processing with blocking I/O, or 2) async processing + async I/O.

            Servlet async processing is triggered by the use of HttpServletRequest.startAsync().

            Servlet async I/O is triggered by using ReadListener and WriteListener respectively with the ServletInputStream and ServletOutputStream.

            You definitely want async processing because you have a large number of clients and processing in the order of seconds - this will optimize the use of server threads.

            Whether or not to use async I/O should probably be measured, since you have small binary responses. Blocking I/O is much much easier to code and debug, while async I/O is definitely more complicated to code and debug. Async I/O really shines when you have large contents and slow clients that may congest the TCP connection.

            If you want to be fully async, go with async I/O. If you can tolerate a bit of blocking in exchange of simpler code, stay on blocking I/O. Worth repeating, in both cases - either async I/O or blocking I/O - you want to use async processing.

            Regarding the issue of copying data, if you are willing to cast down to Jetty classes, you can avoid the copy by directly writing a ByteBuffer to the ServletOutputStream subclass, see this example.

            Finally, with the Jetty client you can use the high-level HttpClient with the HTTP/2 transport as detailed here. The benefit would be a high-level API that only deals with HTTP concepts, rather than using the low-level HTTP2Client that deals with HTTP/2 frames, streams and such.

            Report back what you end up choosing, and how it goes for you !

            Source https://stackoverflow.com/questions/42056792

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install http2-examples

            You can download it from GitHub.
            You can use http2-examples like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the http2-examples component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/fstab/http2-examples.git

          • CLI

            gh repo clone fstab/http2-examples

          • sshUrl

            git@github.com:fstab/http2-examples.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Blog Libraries

            hexo

            by hexojs

            mastodon

            by mastodon

            mastodon

            by tootsuite

            halo

            by halo-dev

            vuepress

            by vuejs

            Try Top Libraries by fstab

            grok_exporter

            by fstabGo

            h2c

            by fstabGo

            cifs

            by fstabShell

            promagent

            by fstabJava

            fosdem-2023

            by fstabShell