{"id":19792135,"url":"https://github.com/making/new-controller","last_synced_at":"2025-09-10T19:35:13.274Z","repository":{"id":28806243,"uuid":"32329326","full_name":"making/new-controller","owner":"making","description":"Lambda based extensible \"New Controller\" for Spring MVC insipired by Spark Java, Siden (aka Sinatra like framework)","archived":false,"fork":false,"pushed_at":"2015-03-30T10:54:42.000Z","size":188,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-19T14:59:19.927Z","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/making.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}},"created_at":"2015-03-16T14:10:56.000Z","updated_at":"2024-12-09T19:53:20.000Z","dependencies_parsed_at":"2022-09-05T01:20:20.133Z","dependency_job_id":null,"html_url":"https://github.com/making/new-controller","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/making/new-controller","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/making%2Fnew-controller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/making%2Fnew-controller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/making%2Fnew-controller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/making%2Fnew-controller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/making","download_url":"https://codeload.github.com/making/new-controller/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/making%2Fnew-controller/sbom","scorecard":{"id":613677,"data":{"date":"2025-08-11","repo":{"name":"github.com/making/new-controller","commit":"15d4481da1cb09977c4bf559b25952630d702a0e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/16 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"18 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-36p3-wjmg-h94x","Warn: Project is vulnerable to: GHSA-hh26-6xwr-ggv7","Warn: Project is vulnerable to: GHSA-4gc7-5j7h-4qph","Warn: Project is vulnerable to: GHSA-4wp7-92pw-q264","Warn: Project is vulnerable to: GHSA-g5mm-vmx4-3rg7","Warn: Project is vulnerable to: GHSA-4487-x383-qpph","Warn: Project is vulnerable to: GHSA-45vg-2v73-vm62","Warn: Project is vulnerable to: GHSA-8crv-49fr-2h6j","Warn: Project is vulnerable to: GHSA-g8hw-794c-4j9g","Warn: Project is vulnerable to: GHSA-pgf9-h69p-pcgf","Warn: Project is vulnerable to: GHSA-rcpf-vj53-7h2m","Warn: Project is vulnerable to: GHSA-2rmj-mq67-h97g","Warn: Project is vulnerable to: GHSA-2wrp-6fg6-hmc5","Warn: Project is vulnerable to: GHSA-4wrc-f8pq-fpqp","Warn: Project is vulnerable to: GHSA-6v7w-535j-rq5m","Warn: Project is vulnerable to: GHSA-ccgv-vj62-xf9h","Warn: Project is vulnerable to: GHSA-hgjh-9rj2-g67j","Warn: Project is vulnerable to: GHSA-g5vr-rgqm-vf78"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T03:18:04.291Z","repository_id":28806243,"created_at":"2025-08-21T03:18:04.291Z","updated_at":"2025-08-21T03:18:04.291Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274511966,"owners_count":25299343,"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-09-10T02:00:12.551Z","response_time":83,"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-11-12T07:06:06.399Z","updated_at":"2025-09-10T19:35:13.243Z","avatar_url":"https://github.com/making.png","language":"Java","readme":"# new-controller\nLambda based extensible \"New Controller\" for Spring MVC insipired by [Spark Java](http://sparkjava.com/), [Siden](https://github.com/taichi/siden) (aka Sinatra like framework)\n\n## How to use\n\n``` xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eam.ik.springmvc\u003c/groupId\u003e\n    \u003cartifactId\u003enew-controller\u003c/artifactId\u003e\n    \u003cversion\u003e0.2.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Sample\n\n### Simple Case (using Servlet API)\nThis sample uses `org.springframework.web.HttpRequestHandler` as handler for simplicity but this is not mandatory.\n\n[Code](./example/simple)\n\n``` java\nimport newcontroller.RouterDefinition;\nimport newcontroller.RouterHandlerMapping;\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.core.Ordered;\nimport org.springframework.core.annotation.Order;\nimport org.springframework.web.HttpRequestHandler;\nimport org.springframework.web.servlet.HandlerAdapter;\n\n@SpringBootApplication\npublic class App {\n    public static void main(String[] args) {\n        SpringApplication.run(App.class, args);\n    }\n\n    @Bean\n    RouterHandlerMapping\u003cHttpRequestHandler\u003e routerHandlerMapping() {\n        RouterHandlerMapping\u003cHttpRequestHandler\u003e handlerMapping = new RouterHandlerMapping\u003c\u003e(\n                (handler, request, response) -\u003e {\n                    handler.handleRequest(request, response);\n                    return null;\n                });\n        handlerMapping.setOrder(Ordered.HIGHEST_PRECEDENCE);\n        return handlerMapping;\n    }\n\n    @Bean\n    @Order(Ordered.HIGHEST_PRECEDENCE)\n    HandlerAdapter routerHandlerAdapter(RouterHandlerMapping\u003cHttpRequestHandler\u003e handlerMapping) {\n        return handlerMapping.handlerAdapter();\n    }\n\n    // Define request mapping using lambda\n    @Bean\n    RouterDefinition\u003cHttpRequestHandler\u003e routerDef() {\n        return router -\u003e router\n                .get(\"/\", (req, res) -\u003e {\n                    // curl -X GET localhost:8080 =\u003e Sample\n                    res.getWriter().print(\"Sample\");\n                    res.getWriter().flush();\n                })\n                .get(\"/hello\", (req, res) -\u003e {\n                    // curl -X GET localhost:8080/hello =\u003e Hello World!\n                    res.getWriter().print(\"Hello World!\");\n                    res.getWriter().flush();\n                })\n                .get(\"/bar/{foo}\", (req, res) -\u003e {\n                    // curl -X GET localhost:8080/bar/aaa =\u003e foo = aaa\n                    res.getWriter().print(\"foo = \" + req.getParameter(\"foo\"));\n                    res.getWriter().flush();\n                })\n                .post(\"/echo\", (req, res) -\u003e {\n                    // curl -X POST localshot:8080/echo -d name=Joy =\u003e Hi Joy\n                    res.getWriter().print(\"Hi \" + req.getParameter(\"name\"));\n                    res.getWriter().flush();\n                });\n    }\n}\n```\n\n### Convenient Case (using New API)\n\n[Code](./example/default)\n\n``` java\npackage demo;\n\nimport newcontroller.RouterDefinition;\nimport newcontroller.RouterHandlerMapping;\nimport newcontroller.handler.Handler;\nimport newcontroller.handler.impl.DefaultHandlerApplier;\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.boot.autoconfigure.web.HttpMessageConverters;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.core.Ordered;\nimport org.springframework.core.annotation.Order;\nimport org.springframework.http.MediaType;\nimport org.springframework.web.servlet.HandlerAdapter;\n\nimport javax.xml.bind.annotation.XmlRootElement;\n\n@SpringBootApplication\npublic class App {\n    public static void main(String[] args) {\n        SpringApplication.run(App.class, args);\n    }\n\n    @Bean\n    RouterHandlerMapping\u003cHandler\u003e routerHandlerMapping(HttpMessageConverters converters) {\n        RouterHandlerMapping\u003cHandler\u003e handlerMapping = new RouterHandlerMapping\u003c\u003e(new DefaultHandlerApplier(converters.getConverters()));\n        handlerMapping.setOrder(Ordered.HIGHEST_PRECEDENCE);\n        return handlerMapping;\n    }\n\n    @Bean\n    @Order(Ordered.HIGHEST_PRECEDENCE)\n    HandlerAdapter routerHandlerAdapter(RouterHandlerMapping\u003cHandler\u003e handlerMapping) {\n        return handlerMapping.handlerAdapter();\n    }\n\n    @Bean\n    RouterDefinition\u003cHandler\u003e routerDef() {\n        return router -\u003e router\n                /* curl localhost:8080 ==\u003e Sample*/\n                .get(\"/\", (req, res) -\u003e res.body(\"Sample\"))\n                /* curl localhost:8080/hello ==\u003e Hello World! */\n                .get(\"/hello\", (req, res) -\u003e res.body(\"Hello World!\"))\n                /* curl localhost:8080/json ==\u003e {\"name\":\"John\",\"age\":30} */\n                .get(\"/json\", (req, res) -\u003e res\n                        .contentType(MediaType.APPLICATION_JSON)\n                        .body(new Person(\"John\", 30)))\n                /* curl localhost:8080/xml ==\u003e \u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\u003cperson\u003e\u003cage\u003e30\u003c/age\u003e\u003cname\u003eJohn\u003c/name\u003e\u003c/person\u003e */\n                .get(\"/xml\", (req, res) -\u003e res\n                        .contentType(MediaType.APPLICATION_XML)\n                        .body(new Person(\"John\", 30)))\n                /* curl localhost:8080/template ==\u003e [templates/hello.html will be rendered via Thymeleaf] */\n                .get(\"/template\", (req, res) -\u003e {\n                    req.put(\"message\", \"Hello World!\");\n                    return res.view(\"hello\");\n                })\n                /* curl localhost:8080/bar/aaa ==\u003e foo = aaa */\n                .get(\"/bar/{foo}\", (req, res) -\u003e\n                        res.body(\"foo = \" + req.param(\"foo\")\n                                .orElse(\"??\")))\n                /* curl localhost:8080/param -d name=John ==\u003e Hi John */\n                .post(\"/echo\", (req, res) -\u003e\n                        res.body(req.param(\"name\")\n                                .map(name -\u003e \"Hi \" + name)\n                                .orElse(\"Please input name!\")))\n                /* curl localhost:8080/param -d name=John -d age=30 ==\u003e {\"name\":\"John\",\"age\":30} */\n                .post(\"/param\", (req, res) -\u003e {\n                    Person person = req.params(Person.class);\n                    return res.body(person);\n                })\n                /* curl localhost:8080/body -H 'Content-Type: application/json' -d '{\"name\":\"John\",\"age\":30}' ==\u003e {\"name\":\"John\",\"age\":30} */\n                .post(\"/body\", (req, res) -\u003e {\n                    Person person = req.body(Person.class);\n                    return res.body(person);\n                });\n    }\n\n    @XmlRootElement\n    public static class Person {\n        private String name;\n        private int age;\n        // ....\n    }\n}\n```\n\n## License\nLicensed under the Apache License, Version 2.0.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaking%2Fnew-controller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaking%2Fnew-controller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaking%2Fnew-controller/lists"}