smart-http 1.0.10 release, 7 lines of code can run HTTP server

smart-http

smart-http is a relatively simple http server, the communication core uses smart-socket latest version v1.4.4.

And because of the use of smart-socket, the server's performance is still very good, in my 4-core CPU can run out of 73W qps +.

smart-socket performance of each test are based on the server, we believe that smart-http performance will not let you down.

function list

  1. Supports GET, POST HTTP request.
  2. Provide a URL routing component, you can quickly set up a static server.
  3. Support section RFC2612 specification, follow-up will gradually improve.
  4. Https protocol support, enabling the smart-socket for.
  5. Have the ability to upload files.

Fast Experience

  1. The introduction of smart-http depend on your Maven project.
    <dependency>
        <groupId>org.smartboot.http</groupId>
        <artifactId>smart-http-parent</artifactId>
        <version>1.0.10</version>
        <type>pom</type>
    </dependency>

     

  2. Copy the code and start.
    public class SimpleSmartHttp {
        public static void main(String[] args) {
            HttpBootstrap bootstrap = new HttpBootstrap();
            bootstrap.pipeline().next(new HttpHandle() {
                public void doHandle(HttpRequest request, HttpResponse response) throws IOException {
                    response.write("hello world".getBytes());
                }
            });
            bootstrap.setPort(8080).start();
        }
    }

     

  3. Browser access: HTTP: // localhost: 8080 /

Within the project also provides an example of a static file server, welcomed into the pit experience.

Guess you like

Origin www.oschina.net/news/111049/smart-http-1-0-10-released