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

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

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 78W qps +.

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

update content

  1. Smart-socket upgrade to the latest version: 1.4.6, improve service performance.

  2. Http protocol parsing algorithm optimization process for Post request.

  3. Example code module with the split core http function, project structure is more reasonable.
  4. Streamline dependence, after packing smart-http-server module is only 88KB, all rely on a total of only 171KB.
  5. Fix some PMD, checkstyle scanned out of the question.
  6. Adjust HttpRequest interface design, adaptation commons-fileupload provide analytical support for file uploads.

Fast Experience

  1. The introduction of smart-http depend on your Maven project.
    <dependency>
        <groupId>org.smartboot.http</groupId>
        <artifactId>smart-http-server</artifactId>
        <version>1.0.12</version>
    </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 /

At last

smart-http still in its infancy, as long as you are good enough you can guide its development path, and interested welcome into the pit.

Guess you like

Origin www.oschina.net/news/111679/smart-http-1-0-12-released