https://github.com/wususu/toy-http-server
A toy http server power by java | 简单的web服务器
https://github.com/wususu/toy-http-server
http-server servlet-container web
Last synced: 4 months ago
JSON representation
A toy http server power by java | 简单的web服务器
- Host: GitHub
- URL: https://github.com/wususu/toy-http-server
- Owner: wususu
- Created: 2018-03-10T09:21:26.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-13T01:22:52.000Z (over 8 years ago)
- Last Synced: 2025-10-28T03:32:11.191Z (8 months ago)
- Topics: http-server, servlet-container, web
- Language: HTML
- Homepage:
- Size: 42 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# toy-http-server
A toy http server power by java | 简单的web服务器 | Java NIO
USE:
### 1. 运行BootStrap.java
打开浏览器输入 http://127.0.0.1:8888/{file_name}
{file_name}为请求的文件名,程序将会解析webroot目录下相应文件并输出到浏览器
例如: 输入 http://127.0.0.1:8888/index.html 就能看到我的github主页啦
### 2. Servlet解析及注解支持:
在http.servlet下创建servlet并使用@HashService注解(支持深度递归搜索servlet),
地址加上servlet对应uri即可得到相应输出
例如: 输入 http://127.0.0.1:8888/index 就能看到该servlet名
### 3. POST/GET参数和Cookie支持:
在请求Servlet地址时加上GET/POST参数,页面会显示发送参数的map
例如: 输入 http://127.0.0.1:8888/index?name=hasher 就能看到该{"name"="hasher"}