{"id":21098778,"url":"https://github.com/tinyadapter/raizerugu","last_synced_at":"2026-03-17T08:38:44.195Z","repository":{"id":83076979,"uuid":"162688815","full_name":"tinyAdapter/raizerugu","owner":"tinyAdapter","description":"Web Server on the Fantasy Island","archived":false,"fork":false,"pushed_at":"2018-12-21T08:50:16.000Z","size":2698,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-01T02:39:20.115Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tinyAdapter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-12-21T08:37:49.000Z","updated_at":"2019-05-18T14:12:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"cde39b31-6616-4956-b080-c399fb9b25a0","html_url":"https://github.com/tinyAdapter/raizerugu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tinyAdapter/raizerugu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyAdapter%2Fraizerugu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyAdapter%2Fraizerugu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyAdapter%2Fraizerugu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyAdapter%2Fraizerugu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinyAdapter","download_url":"https://codeload.github.com/tinyAdapter/raizerugu/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyAdapter%2Fraizerugu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30619218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T08:10:05.930Z","status":"ssl_error","status_checked_at":"2026-03-17T08:10:04.972Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T22:56:37.641Z","updated_at":"2026-03-17T08:38:44.190Z","avatar_url":"https://github.com/tinyAdapter.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raizerugu - 幻想岛上的 Web 服务器\n\n## 项目说明\n\nRaizerugu 是以计算机网络课程设计为目的，使用 Java 语言实现的简易 Web 服务器，拥有正确相应 HTTP 请求并返回 HTML，CSS，JS 和图片对象、支持多用户同时访问的多线程处理机制、对象缓存池、错误请求返回页面、条件 GET 等功能。\n\n## 使用方式\n\n与其它多数 Web 服务器一样，Raizerugu 以位于服务器的文件系统为基础，通过映射文件夹下的 HTML、CSS、JS 和其他对象至 URL 目录进行内容提供。\n\nRaizerugu 使用 Java 语言实现，提供了预编译版本。最新版本号为 0.2.1。\n\n测试方法为：在安装 Java Runtime 后，进入项目的 `target\\`目录，在命令提示符中输入\n\n    java -jar raizerugu-0.2.1.jar\n\n命令，此时返回如下结果：\n\n![](.github/img/2-1.png)\n\n此时程序运行成功，但服务器并没有启动，原因在于必须指定服务器根目录的位置。\n\nRaizerugu 提供了测试文件夹，可通过\n\n    java -jar raizerugu-0.2.1.jar -r ..\\test\n\n命令指定服务器根目录为项目的 `test\\`目录。此时服务器运行成功。\n\n![](.github/img/2-2.png)\n\n打开浏览器，输入`http://127.0.0.1:5020/`，即可看到服务器返回了正常的内容。\n\n![](.github/img/2-3.png)\n\n此时服务器端显示了浏览器的访问日志。\n\n![](.github/img/2-4.png)\n\n当试图访问一个不存在的对象时，服务器返回 404 Not Found：\n\n![](.github/img/2-5.png)\n\n当多次访问相同的对象时，服务器根据浏览器发送的 IF-MODIFIED-SINCE 报头检查对象是否更新，如未更新，则返回 304 Not Modified：\n\n![](.github/img/2-6.png)\n\n## 命令行参数\n\n| 参数 | 功能                                                                                                                              |\n| ---- | --------------------------------------------------------------------------------------------------------------------------------- |\n| -r   | 指定服务器的根目录                                                                                                                |\n| -h   | 指定服务器绑定的 IP。\u003cbr\u003e如果绑定为 127.0.0.1，则只能通过本地回环访问；\u003cbr\u003e如果绑定为 0.0.0.0，则可通过本机被分配的任意 IP 访问。 |\n| -p   | 指定服务器绑定的端口                                                                                                              |\n\n## 项目结构\n\n由于 Raizerugu 的功能较为简单，因此项目结构不甚复杂。\n\n`Main.java` 包含程序的入口函数。通过构造新的 `Server` 实例，解析命令行参数后传入 `Configuration` 实例配置，最后调用 `server.start()`启用服务器。\n\n`Server.java` 包含 `Server` 类的实现，其中 `start()`函数通过 `socket.accept()`监听 TCP 连接，对新的 TCP 连接将其分发给新的 `ServiceThread` 线程处理，从而实现了多用户同时访问。\n\n`ServiceThread.java` 包含对连接的读取、处理、响应的过程。其首先通过 `HTTPRequest.parseFrom()`函数解析 HTTP 请求的内容，并将生成的 `HTTPRequest` 对象传入 `makeResponse()`中进行 HTTP 响应的构造，最终将构造的内容通过 `getBytes()`转换为字节流，从 socket 连接传回客户端。之后关闭 socket 连接，结束本次交互。\n\n## 其他说明\n\nRaizerugu 使用 Eclipse for Java EE 编码，可以通过 Eclipse for Java EE 打开项目所在的目录，查看源代码。\n\n如需编译，可通过右键项目文件夹，选择 Run as -\u003e Maven build，进行编译。\n\n![](.github/img/5-1.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinyadapter%2Fraizerugu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinyadapter%2Fraizerugu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinyadapter%2Fraizerugu/lists"}