{"id":15350813,"url":"https://github.com/grobmeier/lionbeast","last_synced_at":"2025-08-10T10:07:21.616Z","repository":{"id":12393163,"uuid":"15045801","full_name":"grobmeier/lionbeast","owner":"grobmeier","description":"Simple server in Java","archived":false,"fork":false,"pushed_at":"2023-08-07T19:51:29.000Z","size":693,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-04-09T12:14:30.268Z","etag":null,"topics":[],"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/grobmeier.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}},"created_at":"2013-12-09T11:45:04.000Z","updated_at":"2023-08-07T19:51:27.000Z","dependencies_parsed_at":"2024-12-23T05:44:23.243Z","dependency_job_id":"2d17afef-884d-4b6e-8856-83fe8ad15ea7","html_url":"https://github.com/grobmeier/lionbeast","commit_stats":{"total_commits":135,"total_committers":3,"mean_commits":45.0,"dds":"0.18518518518518523","last_synced_commit":"aceea68a36a1b288b46a2089300e5cccbfb2d205"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/grobmeier/lionbeast","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grobmeier%2Flionbeast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grobmeier%2Flionbeast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grobmeier%2Flionbeast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grobmeier%2Flionbeast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grobmeier","download_url":"https://codeload.github.com/grobmeier/lionbeast/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grobmeier%2Flionbeast/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269706969,"owners_count":24462278,"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-08-10T02:00:08.965Z","response_time":71,"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":[],"created_at":"2024-10-01T11:59:16.875Z","updated_at":"2025-08-10T10:07:21.584Z","avatar_url":"https://github.com/grobmeier.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lionbeast\n\nThis is a small web server demonstrating some basic features on Java NIO.\n\nPlease cd into ./server to carry out most operations. The parent pom is not utilized that much,\nexcept for dependency management.\n\nBuild the distribution with:\n\n```\n$\u003e mvn package\n```\n\nThis will also run the assembly:single goal, which creates a ZIP package with a ready-to-go server.\n\n## Introduction\n\nThe server first creates a single thread which listens to a specific interface with a specific port (the Dispatcher).\nConfiguration of these values is done in lionbeast-server.xml.\n\nIncoming requests are then dispatched to various other threads, called Workers. Workers get already\nthe read header information, but are responsible themselves to take care on HTTP methods or content.\n\nFor the moment, only GET without content is supported.\n\nThe Worker selects an appropriate Handler for a request, based on either complete path\n(like: http://localhost:10000/helloworld) or on file extension (like: .html). This selection is done by\nMatchers; they are configured in lionbeast-matchers.xml. When a matcher is found, the handler will be selected\nbased on Matcher information. Handlers are defined in lionbeast-handlers.xml.\n\nFor the configuration, Apache Commons Configuration has been used. Currently its implemented as Singleton; it is\nusually a better Idea to use a dependency injection framework for that. At the moment the Configuration class\nis coupled to tightly and has cause some annoyance when writing unit tests.\n\nThe Handlers are written in the NIO vein. A pipe has been used to read the content from disk (in case of\na FileHandler). Since a Pipe.sink would not accept more bytes once it is full, a new Thread just for reading\nthe content from disc was necessary. It needs to be considered if this is actually a benefit or not; usually\nit is said one should keep the number of threads as low as possible. Also the FileHandler has become a bit\nmore complex than necessary. Instead of a NIO Pipe a classic InputStream could have been used.\n\nThe JRuby handler is just for demonstration and should not be taken to serious. The instantiation\nof the ScriptingEngine does need a good amount of time and could be done somewhere else. Also setting\nof the WriterWrapper does take its time; in addition the WriterWrapper class is just a skeleton and could\nbe improved a lot. Anyway it works and shows that JRuby - or maybe Groovy et al - is easily possible\nto use with Lionbeast.\n\nThe HelloWorldHandler is another demonstration of in-memory-processing of a request. Instead of just\nprinting \"Hello World\", this handler could connect to a database/content-repository. As it does not serve\nand purpose, it would make a good fit for the testing package. Its there for demonstration purposes.\n\nThe ServerStatusHandler is being called if something goes wrong, for example a file has not been found on hard disc.\nIn this case an exception is thrown and the handler is stopped. The Worker is in charge to resolve the situation.\nIt is a problem, when headers have already been sent. In this case nothing can be done anymore, especially\nthen Content-Length is critical. If the actual content does not match this number of bytes, the client is waiting\nfor ever for input. So it has been decided to just close the connection when some or all headers are sent.\n\nIf headers are not sent, the ServerStatusHandler can chime in; the connection can be kept open if Keep-Alive has\nbeen requested. The Handler will take care an appropriate message is being sent to the Browser.\n\n## Webdir configuration\n\nIn the distribution package and in src/test is a folder called \"webdir\". This is the folder from which the\ncontent is served. The exact location of the webdir can be defined in lionbeast-server.xml.\n\n## Testing\n\nFor testing some JUnit tests has been established. They are all pretty basic and could be more specific.\nThe most difficult test was the WorkerTest. Mockito helped already to mock some objects, but it was not possible\nto mock final methods, even not with Powermock. Powermock is being said to work well with final-Methods which\nI cannot confirm.\n\nTesting and development has been done on OS X 10.6.8. Browsers were Firefox, Safari and Chrome, all recent versions.\n\nAs I do not have a Windows-Box for work, I could not test a start.bat. It should be similar to the provided start.sh\nin src/cli.\n\n## Development\n\nThese tools have been used: Bitbucket, Git, IntelliJ IDEA.\n\nDependencies are SLF4J, Log4j 2.0 (beta), Apache Commons Configuration.\n\n## License\n\n/*\n *   Copyright 2013 Christian Grobmeier\n *\n *   Licensed under the Apache License, Version 2.0 (the \"License\");\n *   you may not use this file except in compliance with the License.\n *   You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n *   Unless required by applicable law or agreed to in writing, software\n *   distributed under the License is distributed on an \"AS IS\" BASIS,\n *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *   See the License for the specific language governing permissions and\n *   limitations under the License.\n */\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrobmeier%2Flionbeast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrobmeier%2Flionbeast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrobmeier%2Flionbeast/lists"}