{"id":41152016,"url":"https://github.com/codemonstur/httpserver","last_synced_at":"2026-01-22T19:07:18.550Z","repository":{"id":65507712,"uuid":"379028121","full_name":"codemonstur/httpserver","owner":"codemonstur","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-05T18:03:01.000Z","size":152,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-06T21:24:28.657Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/codemonstur.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}},"created_at":"2021-06-21T18:31:37.000Z","updated_at":"2024-08-05T18:03:05.000Z","dependencies_parsed_at":"2024-05-15T21:42:39.928Z","dependency_job_id":"587da569-5049-46ee-a5b7-89cc9dac2182","html_url":"https://github.com/codemonstur/httpserver","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/codemonstur/httpserver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemonstur%2Fhttpserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemonstur%2Fhttpserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemonstur%2Fhttpserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemonstur%2Fhttpserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codemonstur","download_url":"https://codeload.github.com/codemonstur/httpserver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemonstur%2Fhttpserver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28668888,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T17:07:18.858Z","status":"ssl_error","status_checked_at":"2026-01-22T17:05:02.040Z","response_time":144,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":"2026-01-22T19:04:56.124Z","updated_at":"2026-01-22T19:07:18.534Z","avatar_url":"https://github.com/codemonstur.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n[![GitHub Release](https://img.shields.io/github/release/codemonstur/httpserver.svg)](https://github.com/codemonstur/httpserver/releases)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.codemonstur/httpserver/badge.svg)](http://mvnrepository.com/artifact/com.github.codemonstur/httpserver)\n[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)\n\n# HTTP server\n\nA standalone embedded HTTP server.\n\nFeatures it has:\n- Support for HTTP/0.9\n- Support for HTTP/1.0\n- Support for HTTP/1.1\n- Common headers and status codes\n- Parsing url encoded forms\n- Parsing multipart forms\n- Helpers for request parsing\n- Helpers for response sending\n- Session store\n- Routing handler based on method and path\n- Compression using gz and deflate\n- Compilable with Graal\n\nMissing features:\n- No SSE\n- No websockets\n- No HTTP/2\n\n## Usage\n\nAdd the maven dependency:\n\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.github.codemonstur\u003c/groupId\u003e\n        \u003cartifactId\u003ehttpserver\u003c/artifactId\u003e\n        \u003cversion\u003e1.5.0\u003c/version\u003e\n    \u003c/dependency\u003e\n\nInstantiate the server from somewhere (your main() probably):\n\n    HttpServer.newHttpServer()\n        .bind(8080, \"0.0.0.0\")\n        .handler(handler)\n        .build()\n        .start();\n\nOptionally define some routes:\n\n    MethodPathRouting.methodPathRouting()\n        .put(\"/api/v1/endpoint\", putEndpoint())\n        .post(\"/api/v1/endpoint\", postEndpoint())\n        .get(\"/api/v1/endpoint\", getEndpoint())\n        .delete(\"/api/v1/endpoint\", deleteEndpoint())\n\nDefine a handler by implementing this interface:\n\n    public interface HttpHandler {\n        void handleRequest(HttpServerExchange exchange) throws Exception;\n    }\n\nThrow an Exception, and the server will return a 500 Internal Server Error.\nParse your request and send your response using the HttpServerExchange object.\n\nAn example of a handler:\n\n    public static HttpHandler postEndpoint() {\n        return exchange -\u003e {\n            final var form = parseForm(exchange, UTF_8);\n            final long id = getMandatoryLong(form, \"id\");\n            ... do something here ...\n            respond(exchange).status(NO_CONTENT).send();\n        };\n    }\n\n## Threading\n\nWe create a new virtual Thread for each incoming connection.\nThis should be sufficient to use in production.\n\n## Testing\n\nThere is no test harness yet.\nNo benchmarks have been run.\n\n## Security\n\n- Form parsing has a Denial of Service issue.\n- There are no limits on resource use.\n- There is no protection against header injection\n\n## Graal support\n\nGraal doesn't support Java 19 yet.\n\nThis library isn't very complicated, it should just work by the time Graal support for virtual threads comes along.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemonstur%2Fhttpserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodemonstur%2Fhttpserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemonstur%2Fhttpserver/lists"}