smart-http 1.0.18 released, a lightweight domestic HTTP server

smart-http is an Http server written in Java language, which is different from the well-known web containers in the industry: Tomcat, Undertow, smart-http does not support the Servlet specification, but it has all the capabilities required by the Http server .

smart-http is born an asynchronous non-blocking I/O model, because its communication core uses  smart-socket . Therefore, both performance and stability are excellent.

update content

  1. Http decoding algorithm is optimized for readability and slightly optimized for performance.
  2. Open abstract class Handle, compatible with Kotlin.
  3. Response supports removing the header value.
  4. Add smart-http start banner, support switch control.
  5. Fix the mask parsing bug in the websocket sticky package scenario, thanks to netizens: the most grueling feedback over the years.
  6. WebSocketRequest new interface to obtain local/remote address: getRemoteAddress, getLocalAddress

Quick experience

  1. Introduce smart-http dependency in your Maven project.
    <dependency>
        <groupId>org.smartboot.http</groupId>
        <artifactId>smart-http-server</artifactId>
        <version>1.0.18</version>
    </dependency>

     

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

     

  3. Browser access: http://localhost:8080/  or use ws client to request ws://127.0.0.1:8080

For more documents, please visit: https://smartboot.gitee.io/book/smart-http/

Welfare moment: The Servlet container based on smart-http implementation may also be the first self-developed Servlet container in China: smart-servlet   is now open source. For this project, we will try to invite developers from the community to participate in the joint construction. Interested friends are welcome to join us and do something awesome together.

Guess you like

Origin www.oschina.net/news/120877/smart-http-1-0-18-released