{"id":50100068,"url":"https://github.com/barcellos-pedro/java-http-server","last_synced_at":"2026-05-23T07:04:53.620Z","repository":{"id":325854918,"uuid":"1102243131","full_name":"barcellos-pedro/java-http-server","owner":"barcellos-pedro","description":"Simple Web Server with zero dependencies. From TCP to HTTP. ","archived":false,"fork":false,"pushed_at":"2026-01-29T01:43:14.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-29T17:18:33.007Z","etag":null,"topics":["http","java","server","study","tcp"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/barcellos-pedro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-11-23T04:42:40.000Z","updated_at":"2026-01-29T01:43:17.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/barcellos-pedro/java-http-server","commit_stats":null,"previous_names":["barcellos-pedro/java-echo-server","barcellos-pedro/java-http-server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/barcellos-pedro/java-http-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barcellos-pedro%2Fjava-http-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barcellos-pedro%2Fjava-http-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barcellos-pedro%2Fjava-http-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barcellos-pedro%2Fjava-http-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barcellos-pedro","download_url":"https://codeload.github.com/barcellos-pedro/java-http-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barcellos-pedro%2Fjava-http-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33386079,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T04:15:53.637Z","status":"ssl_error","status_checked_at":"2026-05-23T04:15:53.242Z","response_time":53,"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":["http","java","server","study","tcp"],"created_at":"2026-05-23T07:04:52.916Z","updated_at":"2026-05-23T07:04:53.615Z","avatar_url":"https://github.com/barcellos-pedro.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Java HTTP Server\n\nThis project implements a minimal, educational HTTP server in Java.  \nThe goal is to understand low-level request handling, routing, controllers, and response building without relying on large frameworks.\n\nIt includes:\n\n- Socket-based HTTP server  \n- Basic router and mapping system  \n- Controllers implementing a `RequestHandler` interface  \n- Request parsing (method, path, headers, body)  \n- Response builder with support for multiple formats  \n- A complete class diagram for architecture visibility\n\n---\n\n## 🚀 Overview\n\nThe server listens on a configurable port and processes each incoming socket by:\n\n1. Parsing the HTTP request into a `Request` object  \n2. Passing it to the `Router`  \n3. Resolving the appropriate `RequestHandler` via `Routes`  \n4. Building the HTTP response with `Response` helpers  \n5. Sending the result back through the socket\n\nThe structure is intentionally simple so you can extend it — adding controllers, middleware, or even template rendering.\n\n---\n\n## 📦 Project Structure\n\n```text\njava-echo-server/\n├── README.md\n├── src\n│   └── main\n│       └── java\n│           └── com\n│               └── server\n│                   ├── controller\n│                   │   ├── EchoController.java\n│                   │   ├── GreetingController.java\n│                   │   ├── NotFoundController.java\n│                   │   └── RequestHandler.java\n│                   ├── http\n│                   │   ├── HttpMethod.java\n│                   │   ├── HttpServer.java\n│                   │   ├── Request.java\n│                   │   └── Response.java\n│                   ├── Main.java\n│                   ├── router\n│                   │   ├── Router.java\n│                   │   └── Routes.java\n│                   └── utils\n│                       └── ResponseTemplate.java\n└── tests\n    ├── load_get_greeting.sh\n    ├── load_post_message.sh\n    └── run_all_load_tests.sh\n```\n\n## 🧩 Class Diagram\n\nBelow is a full Mermaid UML diagram representing the architecture:\n\n```mermaid\nsequenceDiagram\n    autonumber\n\n    participant Client\n    participant HttpServer\n    participant Router\n    participant Routes\n    participant Controller\n    participant Response\n\n    Client -\u003e\u003e HttpServer: HTTP request\n    HttpServer -\u003e\u003e Router: handle(socket)\n    Router -\u003e\u003e Routes: getOrNotFound(request)\n    Routes --\u003e\u003e Router: handler\n    Router -\u003e\u003e Controller: handle(request)\n    Controller --\u003e\u003e Router: body\n    Router -\u003e\u003e Response: build response\n    Response --\u003e\u003e Router: http string\n    Router --\u003e\u003e Client: http response\n```\n\n## 🧱Architecture Overview\n\n```mermaid\nflowchart LR\n\n    Client[\"Client(curl / browser)\"]\n\n    subgraph Server[\"Java Echo Server\"]\n        HttpServer[\"HttpServer(Socket listener)\"]\n        Router[\"Router(Request dispatcher)\"]\n        Routes[\"Routes(Path → Handler mapping)\"]\n\n        subgraph Controllers\n            Greeting[\"GreetingController\"]\n            Echo[\"EchoController\"]\n            NotFound[\"NotFoundController\"]\n        end\n\n        subgraph HTTP\n            Request[\"Request(Parsed HTTP)\"]\n            Response[\"Response(HTTP builder)\"]\n            Templates[\"ResponseTemplate\"]\n        end\n    end\n\n    Client --\u003e HttpServer\n    HttpServer --\u003e Router\n    Router --\u003e Request\n    Router --\u003e Routes\n    Routes --\u003e Greeting\n    Routes --\u003e Echo\n    Routes --\u003e NotFound\n    Router --\u003e Response\n    Response --\u003e Templates\n    Response --\u003e Client\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarcellos-pedro%2Fjava-http-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarcellos-pedro%2Fjava-http-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarcellos-pedro%2Fjava-http-server/lists"}