package org.voovan;

import org.voovan.http.message.HttpStatic;
import org.voovan.http.server.HttpRequest;
import org.voovan.http.server.HttpResponse;
import org.voovan.http.server.HttpRouter;
import org.voovan.http.server.WebServer;
import org.voovan.http.server.context.WebContext;
import org.voovan.http.server.context.WebServerConfig;
import org.voovan.tools.TEnv;
import org.voovan.tools.TObject;
import org.voovan.tools.json.JSON;
import org.voovan.tools.log.Logger;
import org.voovan.tools.reflect.TReflect;

import java.io.IOException;
import java.util.Arrays;
import java.util.Map;
import java.util.Objects;


public class VoovanTFB {
        private static final String HELLO_WORLD_STR = "Hello, World!";
        private static final byte[] HELLO_WORLD_BYTES = "Hello, World!".getBytes();

        public static class Message {
                private final String message;

                public Message(String message) {
                        this.message = message;
                }

                public String getMessage() {
                        return message;
                }
        }

        private static final Message msg = new Message(HELLO_WORLD_STR);

        public static void main(String[] args) {
                TReflect.register(Message.class);

                WebServerConfig webServerConfig = WebContext.buildWebServerConfig();
                webServerConfig.setGzip(false);
                webServerConfig.setAccessLog(false);
                webServerConfig.setKeepAliveTimeout(1000);
                webServerConfig.setHost("0.0.0.0");
                webServerConfig.setPort(8080);
                webServerConfig.setHotSwapInterval(0);
                webServerConfig.setCache(true);
                webServerConfig.getModuleonfigs().clear();
                webServerConfig.getRouterConfigs().clear();
                webServerConfig.setEnablePathVariables(false);
                webServerConfig.setEnableWebSocket(false);
                WebServer webServer = WebServer.newInstance(webServerConfig);

                //性能测试请求;
                webServer.get("/plaintext", new HttpRouter() {
                        public void process(HttpRequest req, HttpResponse resp) throws Exception {
                                resp.header().put(HttpStatic.CONTENT_TYPE_STRING, HttpStatic.TEXT_PLAIN_STRING);
                                resp.write(HELLO_WORLD_BYTES);
                        }
                });
                //性能测试请求
                webServer.get("/json", new HttpRouter() {
                        public void process(HttpRequest req, HttpResponse resp) throws Exception {
                                resp.header().put(HttpStatic.CONTENT_TYPE_STRING, HttpStatic.APPLICATION_JSON_STRING);
                                resp.write(JSON.toJSON(msg, false, false));
                        }
                });

                Logger.setEnable(false);

                webServer.serve();
        }
}

@@ -462,24 +462,57 @@
 log.Logger;%0A
+import org.voovan.tools.TString;%0A
 import org.v
@@ -1140,25 +1140,24 @@
       %7D%0A
-%0A
         
 private 
@@ -1152,73 +1152,8 @@
     
-private static final Message msg = new Message(HELLO_WORLD_STR);%0A
 %0A   
@@ -2774,23 +2774,69 @@
 ite(
-JSON.toJSON(msg
+TString.toAsciiBytes(JSON.toJSON(new Message(HELLO_WORLD_STR)
 , fa
@@ -2847,16 +2847,17 @@
  false))
+)
 ;%0A      

Update VoovanTFB.java (#5891)