smart-servlet is a web container that implements the Servlet 3.1 specification and supports isolated deployment of multiple applications. At the same time, smart-servlet is also a plug-in container, based on the built-in sandbox environment to ensure that smart-servlet has the most streamlined operation capabilities, and users can also expand the service capabilities of the container through custom plug-ins.

1. Architecture design

smart-servlet implements the Servlet specification by inheriting HttpHandle on the basis of smart-http. This means that any smart-http service can transform an ordinary http application into a servlet application by separately introducing the smart-servlet core package, and the cost is extremely low.

feature of product

  • Domestic pedigree: 100% full-stack self-developed core technology.
  • Superior performance: Equipped with the latest version of the communication microkernel smart-socket.
  • Safe and reliable: strictly follow the protocol specifications; support encrypted transmission.
  • Concise and easy to use: it supports War package, springboot, maven-plugin and other operating modes, and the user experience is 100% compatible with Tomcat.

2. Update content

  1. [New Features]Implement the file upload specification of servlet 3.1.
  2. [New Features]Implement the HttpServletRequest#getRemoteUser interface specification.
  3. [New Features]Added War package decompression tool.
  4. [Optimization]Developed three-party dependent storage packages, which are now integrated: bcel, commons-fileupload, and commons-io.
  5. [Optimization]Http response header Server display: smart-servlet
  6. [Optimization]Temporary files are stored in the path specified by the system parameter java.io.tmpdir.
  7. [Optimization]The springboot starter module disables the debug mode.

3. Get started quickly

We provide three ways to enable smart-servlet, you can choose one of them according to the actual situation.

Method 1: maven plugin

Here’s something like:tomcat-maven-pluginIt is usually used in the local development environment of Java Web projects. To integrate the plug-in, just add the following code in pom.xml to start the servlet service in the IDE.


<build>
    <plugins>
        <plugin>
            <groupId>org.smartboot.servlet</groupId>
            <artifactId>smart-servlet-maven-plugin</artifactId>
            <version>0.1.9</version><!--最新版本 -->
            <configuration>
                <port>8080</port>
                <path>/portal</path>
            </configuration>
        </plugin>
    </plugins>
</build>

It is recommended to use the latest version of the plug-in version. In addition, the main configuration items include:

  • port: The listening port on which the servlet service starts
  • path: Servlet container context path, namely ContextPath, usually ends with/express.Of course, customization is also supported, but it must be/beginning

After completing the configuration, enter in the console:mvn package smart-servlet:runThat’s it.

Method 2: smart-servlet-spring-boot-starter

Friends who have used springboot’s spring-boot-starter-tomcat or spring-boot-starter-undertow should be familiar with this.

smart-servlet-spring-boot-starter is essentially another adaptation of smart-servlet to spring-boot-starter-web.

Simply adjust the configuration of the pom.xml file in the springboot project as follows to replace the default Servlet container of springboot with smart-servlet.


<dependencys>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <!-- Exclude the Tomcat dependency -->
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <!-- Use smart-servlet instead -->
    <dependency>
        <groupId>org.smartboot.servlet</groupId>
        <artifactId>smart-servlet-spring-boot-starter</artifactId>
        <version>0.1.9</version><!--最新版本 -->
    </dependency>
</dependencys>

Method 3: release package

The release package is suitable for the deployment of the War package, and it is also a form commonly used in the production environment.

Download address: https://gitee.com/smartboot/smart-servlet/releases

Four, finally

smart-servlet has implemented the more commonly used Servlet specifications, and most applications can be seamlessly transplanted. Some details are also being continuously improved. At present, we have deployed two applications running on smart-servlet for public testing on the whole network. Users in the community are welcome to come and experience.

Document address: https://smartboot.gitee.io/smart-servlet/

Warehouse address: https://gitee.com/smartboot/smart-servlet

#Servlet #released #server #localized #road #long #road #coming #News Fast Delivery

Leave a Comment

Your email address will not be published. Required fields are marked *