从Test cases.launch 来解读play 源码 - play3
来源:互联网 发布:蚂蚁城堡淘宝 编辑:程序博客网 时间:2024/05/01 04:57
首先这个是从play.server.Server.main函数中启动的(端口号时9000,使用netty来实现连接的)
Server
public static void main(String[] args) throws Exception { //获取项目路径 C:\Users\Administrator\Test File root = new File(System.getProperty("application.path")); //初始化 Play.init(root, System.getProperty("play.id", "")); //创建 if (System.getProperty("precompile") == null) new Server(args); }
下面来看具体的操作(netty 端口号9000)
public static int httpPort;//http端口号 public static int httpsPort;//https端口号 public Server() { httpPort = Integer.parseInt(p.getProperty("http.port", "-1")); httpsPort = Integer.parseInt(p.getProperty("https.port", "-1")); if (httpPort == -1 && httpsPort == -1) httpPort = 9000; //地址 InetAddress address = null; InetAddress secureAddress = null; if (p.getProperty("http.address") != null) address = InetAddress.getByName(p.getProperty("http.address")); if (p.getProperty("https.address") != null) secureAddress = InetAddress.getByName(p.getProperty("https.address")); //开启服务 if (httpPort != -1) openNettyServer(httpPort, address ,false); if (httpsPort != -1) openNettyServer(httpsPort, address ,true); } //开启服务private void openNettyServer(int port,InetAddress address, boolean isHttps) { ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool()); bootstrap.setPipelineFactory(isHttps ? new SslHttpServerPipelineFactory() : newHttpServerPipelineFactory()); bootstrap.bind(new InetSocketAddress(address, port)); bootstrap.setOption("child.tcpNoDelay", true);}
http是HttpServerPipelineFactory,https是SslHttpServerPipelineFactory
0 0
- 从Test cases.launch 来解读play 源码 - play3
- Create new test cases
- Unit test cases
- Test Cases Level
- 从tomcat角度解读play源代码
- Top 10 Negative Test Cases
- Top 10 Negative Test Cases
- Python unittest parametrized test cases
- TestNG Priority in Test Cases
- 编译curl 源码包出现"TESTFAIL: These test cases failed: 20 172 507 "等相关的错误
- quote:Why do we write test cases?
- Automatic test cases level and strategy
- How to add CTS test cases
- JUNIT4如何按顺序执行test cases
- Android CTS Verifier Sensor Test Cases (1)
- Android CTS Verifier Sensor Test Cases (2)
- Android CTS Verifier Sensor Test Cases (3)
- Android CTS Verifier Sensor Test Cases (4)
- Tomcat支持中文名和不区分大小写!
- 面向对象之抽象
- thinkphp 结合memcache 使用
- 用Map实现简单缓存
- GIT常见命令详解
- 从Test cases.launch 来解读play 源码 - play3
- SSH 显示中文乱码
- CodeForces 687B Remainders Game
- Java CRC16算法校验
- js中数组的复制
- android6.0 ueventd
- 高仿腾讯QQ即时通讯IM项目
- HTTP访问的两种方式
- Android 读取res文件中raw的json文件 的工具类StreamUtils