{"id":29706801,"url":"https://github.com/jhannes/kata-http-server","last_synced_at":"2025-10-12T09:35:31.165Z","repository":{"id":66982010,"uuid":"574706166","full_name":"jhannes/kata-http-server","owner":"jhannes","description":"performances and reference implementations of an http server build from scratch","archived":false,"fork":false,"pushed_at":"2023-10-19T22:30:28.000Z","size":163,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-23T19:47:21.359Z","etag":null,"topics":["http","java","java-17","junit","test-driven-development"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/jhannes.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}},"created_at":"2022-12-05T22:38:56.000Z","updated_at":"2023-10-19T14:53:37.000Z","dependencies_parsed_at":"2023-05-16T12:46:08.621Z","dependency_job_id":"9551f7b2-1ca9-420f-846d-8d3cc7c2e186","html_url":"https://github.com/jhannes/kata-http-server","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jhannes/kata-http-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhannes%2Fkata-http-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhannes%2Fkata-http-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhannes%2Fkata-http-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhannes%2Fkata-http-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jhannes","download_url":"https://codeload.github.com/jhannes/kata-http-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhannes%2Fkata-http-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010939,"owners_count":26084837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","java-17","junit","test-driven-development"],"created_at":"2025-07-23T16:17:59.465Z","updated_at":"2025-10-12T09:35:31.160Z","avatar_url":"https://github.com/jhannes.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTTP server kata\n\nThis project contains the result and notes for Johannes Brodwall's presentation on Building an HTTP Server with Nothing\nUp My Sleeves.\n\nThe presentation builds a (more or less) working HTTP server from scratch in one hour with no real dependencies. It only\nuses the following:\n\n* The Java 19 programming language\n* java.lang, java.util, java.nio and java.io packages\n* java.net.Socket and java.net.ServerSocket\n* java.net.URL for testing\n* JUnit 5 for testing\n\nWe use [RFC 7230](https://www.rfc-editor.org/rfc/rfc7230) for reference (it's not the newest, but it's the one I know\nbest)\n\nDuring the presentation we build a server that can:\n\n* Respond to HTTP requests\n* Serve files from disk\n* Respond to API requests\n* Handle login and user sessions\n* Unit tests for all the functionality\n\nDuring the presentation, we highlight many important developer lessons:\n\n* HTTP is only text sent to and from the server - you can parse and build it just like with files\n* *How* you approach the task of coding is as important as the code you write\n* The structure of code is best grown gradually as the code solves more and more functionality\n* The process is most engaging then you minimize the time spent with code that doesn't compile or tests that fail\n* Refactoring support in your IDE can increase your productivity incredibly\n\n## Contents\n\nThis repository contains several iterations of building the code bases, each living on a separate branch\n\n### Performances\n\n* [Performance starting point](https://github.com/jhannes/kata-http-server/tags)\n* [JavaBin Christmas Lecture, 2022](https://github.com/jhannes/kata-http-server/tree/performance/javabin-2022-M12)\n* [Sopra Steria DevMeetup, 2023](https://github.com/jhannes/kata-http-server/tree/performance/soprasteria-2023-M2)\n* [Norwegian Police, 2023](https://github.com/jhannes/kata-http-server/tree/performance/politiet-2023M03)\n* [JavaBin Sørlandet in Kristiansand, 2023](https://github.com/jhannes/kata-http-server/tree/performance/2023-M06-kristiansand)\n* [Fredrikstad tech community, 2023](https://github.com/jhannes/kata-http-server/tree/performance/2023-fredrikstad)\n\n### Reference implementations\n\n* [A comprehensive server](https://github.com/jhannes/kata-http-server/tree/reference/comprehensive-server) - includes\n  routing and a `HttpRequestHandler` framework, SSL support, a strong `HttpServerRequest` class with header parsing,\n  request parsing and cookie parsing, and a fluid `HttpServerResponse`. This lets you see a fairly comprehensive result\n* [A stepwise commit log](https://github.com/jhannes/kata-http-server/commits/reference/stepwise-commits) with 50\n  commits showing a step-by-step approach with each new failing test, each completed test and each refactor as a new\n  commit. This lets you follow the process as I build a fairly functioning server.\n\n## Programmer tips\n\nI often get asked how to learn how to work effectively with IntelliJ. Like everything, it's always a matter of practice,\nbut I have a few recommendations as to what to focus on when you practice\n\n### IntellJ shortcuts\n\nThese are some of the most versatile keyboard shortcuts in IntelliJ. There are many more, but learning these 12 will\nreally speed up your code\n\n| Shortcut (Windows)   | Shortcut (Mac)      | Command                                          |\n|----------------------|---------------------|--------------------------------------------------|\n| alt-enter            | opt-enter           | Show content action (quick fix)                  |\n| ctrl-alt-shift-t     | ctrl-t              | Refactor this (show refactor menu)               |\n| alt-insert           | cmd-n               | New... (add some content)                        |\n| ctrl-w               | opt-up              | Expand selection (add shift to go the other way) |\n| shift-alt-f10        | ctrl-opt-r          | Run....                                          |\n| shift-alt-f9         | ctrl-opt-d          | Debug....                                        |\n| shift-f10            | ctrl-d              | Rerun last....                                   |\n| ctrl-b               | cmd-b               | Navigate to symbol                               |\n| alt-ctrl-left        | cmd-opt-b           | Navigate back                                    |\n| alt-j                | ctrl-g              | Add next match to selection (multi-cursor)       |\n| shift-ctrl-backspace | shift-cmd-backspace | Goto last edit location                          |\n| shift, shift         | shift, shift        | Search anywhere                                  |\n\nMake yourself familiar with `Refactor this` (ctrl-alt-shift-t / ctrl-t) and use it to learn the shortcut keys for your\nfavorite refactorings like Extract method, Rename and Inline. Also, make sure you explore what's available on the\nContent Action (alt-enter).\n\nAlso remember basic cursor navigation like ctrl-left and ctrl-right to jump one word at a time, home and end and holding\nshift to expand selection while you move the cursor.\n\n### IntelliJ Live Templates\n\nLess used than the shortcuts, these shorthand ways of writing common bits of Java code can save a bit of time. Write the\nname of the code template in the right spot and press Tab to have IntelliJ expand it\n\n| Template | Result                                     |\n|----------|--------------------------------------------|\n| `fori`   | `for (int i=0; i\u003c...; i++) {}`             |\n| `main`   | `public static void main(String[] args) {` |\n| `sout`   | `System.out.println();`                    |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhannes%2Fkata-http-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjhannes%2Fkata-http-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhannes%2Fkata-http-server/lists"}