[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-77882":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":28,"readmeContent":29,"aiSummary":30,"trendingCount":16,"starSnapshotCount":16,"syncStatus":31,"lastSyncTime":32,"discoverSource":33},77882,"blade","lets-blade\u002Fblade","lets-blade",":rocket: Lightning fast and elegant mvc framework for Java8","https:\u002F\u002Flets-blade.github.io",null,"Java",5881,1159,279,12,0,1,40.19,"Apache License 2.0",false,"v2.1.3",[5,23,24,25,26,27],"java8","mvc-framework","netty4","restful","template-engine","2026-06-12 02:03:45","\u003Cp align=\"center\">\n    \u003Ca href=\"https:\u002F\u002Flets-blade.com\">\u003Cimg src=\"https:\u002F\u002Fi.loli.net\u002F2018\u002F09\u002F18\u002F5ba0cd93c710e.png\" width=\"650\"\u002F>\u003C\u002Fa>\n\u003C\u002Fp>\n\u003Cp align=\"center\">Based on \u003Ccode>Java8\u003C\u002Fcode> + \u003Ccode>Netty4\u003C\u002Fcode> to create a lightweight, high-performance, simple and elegant Web framework 😋\u003C\u002Fp>\n\u003Cp align=\"center\">Spend \u003Cb>1 hour\u003C\u002Fb> to learn it to do something interesting, a tool in addition to the other available frameworks.\u003C\u002Fp>\n\u003Cp align=\"center\">\n    🐾 \u003Ca href=\"#quick-start\" target=\"_blank\">Quick Start\u003C\u002Fa> |\n    🌚 \u003Ca href=\"https:\u002F\u002Flets-blade.github.io\u002F\" target=\"_blank\">Documentation\u003C\u002Fa> |\n    :green_book: \u003Ca href=\"https:\u002F\u002Fwww.baeldung.com\u002Fblade\" target=\"_blank\">Guidebook\u003C\u002Fa> |\n    💰 \u003Ca href=\"https:\u002F\u002Flets-blade.github.io\u002Fdonate\" target=\"_blank\">Donate\u003C\u002Fa> |\n    🇨🇳 \u003Ca href=\"README_CN.md\">简体中文\u003C\u002Fa>\n\u003C\u002Fp>\n\u003Cp align=\"center\">\n    \u003Ca href=\"https:\u002F\u002Ftravis-ci.org\u002Flets-blade\u002Fblade\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Ftravis\u002Flets-blade\u002Fblade.svg?style=flat-square\">\u003C\u002Fa>\n    \u003Ca href=\"http:\u002F\u002Fsearch.maven.org\u002F#search%7Cga%7C1%7Cblade-core\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fmaven-central\u002Fv\u002Fcom.hellokaton\u002Fblade-core.svg?style=flat-square\">\u003C\u002Fa>\n    \u003Ca href=\"LICENSE\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-Apache%202-4EB1BA.svg?style=flat-square\">\u003C\u002Fa>\n    \u003Ca class=\"badge-align\" href=\"https:\u002F\u002Fwww.codacy.com\u002Fgh\u002Flets-blade\u002Fblade\u002Fdashboard\">\u003Cimg src=\"https:\u002F\u002Fapp.codacy.com\u002Fproject\u002Fbadge\u002FGrade\u002F1eff0e30bf694402ac1b0ebe587bfa5a\"\u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgitter.im\u002Flets-blade\u002Fblade\">\u003Cimg src=\"https:\u002F\u002Fbadges.gitter.im\u002Fhellokaton\u002Fblade.svg?style=flat-square\">\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fwww.codetriage.com\u002Flets-blade\u002Fblade\">\u003Cimg src=\"https:\u002F\u002Fwww.codetriage.com\u002Flets-blade\u002Fblade\u002Fbadges\u002Fusers.svg\">\u003C\u002Fa>\n\u003C\u002Fp>\n\n***\n\n## What Is Blade?\n\n`Blade` is a pursuit of simple, efficient Web framework, so that `JavaWeb` development becomes even more powerful, both in performance and flexibility.\nIf you like to try something interesting, I believe you will love it.\nIf you think it's good, you can support it with a [star](https:\u002F\u002Fgithub.com\u002Flets-blade\u002Fblade\u002Fstargazers) or by [donating](https:\u002F\u002Fko-fi.com\u002Fhellokaton) :blush:\n\n## Features\n\n* [x] A new generation MVC framework that doesn't depend on other libraries\n* [x] Get rid of SSH's bloated, modular design\n* [x] Source is less than `500kb`, learning it is also simple\n* [x] RESTful-style routing design\n* [x] Template engine support, view development more flexible\n* [x] High performance, 100 concurrent qps 20w\u002Fs\n* [x] Run the `JAR` package to open the web service\n* [x] Streams-style API\n* [x] `CSRF` and `XSS` defense\n* [x] `Basic Auth` and `Authorization`\n* [x] Supports plug-in extensions\n* [x] Support webjars resources\n* [x] Tasks based on `cron` expressions\n* [x] Built-in a variety of commonly used middleware\n* [x] Built-in Response output\n* [x] JDK8 +\n\n## Overview\n\n» Simplicity: The design is simple, easy to understand and doesn't introduce many layers between you and the standard library. The goal of this project is that the users should be able to understand the whole framework in a single day.\u003Cbr\u002F>\n» Elegance: `blade` supports the RESTful style routing interface, has no invasive interceptors and provides the writing of a DSL grammar.\u003Cbr\u002F>\n» Easy deploy: supports `maven` package `jar` file running.\u003Cbr\u002F>\n\n## Quick Start\n\nCreate a basic `Maven` or `Gradle` project.\n\n> Do not create a `webapp` project, Blade does not require much trouble.\n\nRun with `Maven`:\n\n```xml\n\u003Cdependency>\n    \u003CgroupId>com.hellokaton\u003C\u002FgroupId>\n    \u003CartifactId>blade-core\u003C\u002FartifactId>\n    \u003Cversion>2.1.2.RELEASE\u003C\u002Fversion>\n\u003C\u002Fdependency>\n```\n\nor `Gradle`:\n\n```sh\ncompile 'com.hellokaton:blade-core:2.1.2.RELEASE'\n```\n\nWrite the `main` method and the `Hello World`:\n\n```java\npublic static void main(String[] args) {\n    Blade.create().get(\"\u002F\", ctx -> ctx.text(\"Hello Blade\")).start();\n}\n```\n\nOpen http:\u002F\u002Flocalhost:9000 in your browser to see your first `Blade` application!\n\n## Contents\n\n- [**`Register Route`**](#register-route)\n    - [**`HardCode`**](#hardCode)\n    - [**`Controller`**](#controller)\n- [**`Request Parameter`**](#request-parameter)\n    - [**`URL Parameter`**](#URL-parameter)\n    - [**`Form Parameter`**](#form-parameter)\n    - [**`Path Parameter`**](#path-parameter)\n    - [**`Body Parameter`**](#body-parameter)\n    - [**`Parse To Model`**](#parse-to-model)\n- [**`Get Environment`**](#get-environment)\n- [**`Get Header`**](#get-header)\n- [**`Get Cookie`**](#get-cookie)\n- [**`Static Resource`**](#static-resource)\n- [**`Upload File`**](#upload-file)\n- [**`Download File`**](#download-file)\n- [**`Set Session`**](#set-session)\n- [**`Render To Browser`**](#render-to-browser)\n    - [**`Render Response`**](#render-json)\n    - [**`Render Text`**](#render-text)\n    - [**`Render Html`**](#render-html)\n- [**`Render Template`**](#render-template)\n    - [**`Default Template`**](#default-template)\n    - [**`Jetbrick Template`**](#jetbrick-template)\n- [**`Redirects`**](#redirects)\n- [**`Write Cookie`**](#write-cookie)\n- [**`Web Hook`**](#web-hook)\n- [**`Logging`**](#logging)\n- [**`Basic Auth`**](#basic-auth)\n- [**`Change Server Port`**](#change-server-port)\n- [**`Configuration SSL`**](#configuration-ssl)\n- [**`Custom Exception Handler`**](#custom-exception-handler)\n\n## Register Route\n\n### HardCode\n\n```java\npublic static void main(String[] args) {\n    \u002F\u002F Create multiple routes GET, POST, PUT, DELETE using Blade instance\n    Blade.create()\n        .get(\"\u002Fuser\u002F21\", getting)\n        .post(\"\u002Fsave\", posting)\n        .delete(\"\u002Fremove\", deleting)\n        .put(\"\u002FputValue\", putting)\n        .start();\n}\n```\n\n### `Controller`\n\n```java\n@Path\npublic class IndexController {\n\n    @GET(\"\u002Flogin\")\n    public String login(){\n        return \"login.html\";\n    }\n    \n    @POST(value = \"\u002Flogin\", responseType = ResponseType.JSON)\n    public RestResponse doLogin(RouteContext ctx){\n        \u002F\u002F do something\n        return RestResponse.ok();\n    }\n\n}\n```\n\n## Request Parameter\n\n### URL Parameter\n\n**Using RouteContext**\n\n```java\npublic static void main(String[] args) {\n    Blade.create().get(\"\u002Fuser\", ctx -> {\n        Integer age = ctx.queryInt(\"age\");\n        System.out.println(\"age is:\" + age);\n    }).start();\n}\n```\n\n**Using `@Query` annotation**\n\n```java\n@GET(\"\u002Fuser\")\npublic void savePerson(@Query Integer age){\n  System.out.println(\"age is:\" + age);\n}\n```\n\nTest it with sample data from the terminal\n\n```bash\ncurl -X GET http:\u002F\u002F127.0.0.1:9000\u002Fuser?age=25\n```\n\n### Form Parameter\n\nHere is an example:\n\n**Using RouteContext**\n\n```java\npublic static void main(String[] args) {\n    Blade.create().get(\"\u002Fuser\", ctx -> {\n        Integer age = ctx.fromInt(\"age\");\n        System.out.println(\"age is:\" + age);\n    }).start();\n}\n```\n\n**Using `@Form` Annotation**\n\n```java\n@POST(\"\u002Fsave\")\npublic void savePerson(@Form String username, @Form Integer age){\n  System.out.println(\"username is:\" + username + \", age is:\" + age);\n}\n```\n\nTest it with sample data from the terminal\n\n```bash\ncurl -X POST http:\u002F\u002F127.0.0.1:9000\u002Fsave -F username=jack -F age=16\n```\n\n### Path Parameter\n\n**Using RouteContext**\n\n```java\npublic static void main(String[] args) {\n    Blade blade = Blade.create();\n    \u002F\u002F Create a route: \u002Fuser\u002F:uid\n    blade.get(\"\u002Fuser\u002F:uid\", ctx -> {\n        Integer uid = ctx.pathInt(\"uid\");\n        ctx.text(\"uid : \" + uid);\n    });\n\n    \u002F\u002F Create two parameters route\n    blade.get(\"\u002Fusers\u002F:uid\u002Fpost\u002F:pid\", ctx -> {\n        Integer uid = ctx.pathInt(\"uid\");\n        Integer pid = ctx.pathInt(\"pid\");\n        String msg = \"uid = \" + uid + \", pid = \" + pid;\n        ctx.text(msg);\n    });\n    \n    \u002F\u002F Start blade\n    blade.start();\n}\n```\n\n**Using `@PathParam` Annotation**\n\n```java\n@GET(\"\u002Fusers\u002F:username\u002F:page\")\npublic void userTopics(@PathParam String username, @PathParam Integer page){\n    System.out.println(\"username is:\" + usernam + \", page is:\" + page);\n}\n```\n\nTest it with sample data from the terminal\n\n```bash\ncurl -X GET http:\u002F\u002F127.0.0.1:9000\u002Fusers\u002Fhellokaton\u002F2\n```\n\n### Body Parameter\n\n```java\npublic static void main(String[] args) {\n    Blade.create().post(\"\u002Fbody\", ctx -> {\n        System.out.println(\"body string is:\" + ctx.bodyToString());\n    }).start();\n}\n```\n\n**Using `@Body` Annotation**\n\n```java\n@POST(\"\u002Fbody\")\npublic void readBody(@Body String data){\n    System.out.println(\"data is:\" + data);\n}\n```\n\nTest it with sample data from the terminal\n\n```bash\ncurl -X POST http:\u002F\u002F127.0.0.1:9000\u002Fbody -d '{\"username\":\"hellokaton\",\"age\":22}'\n```\n\n### Parse To Model\n\nThis is the `User` model.\n\n```java\npublic class User {\n    private String username;\n    private Integer age;\n    \u002F\u002F getter and setter\n}\n```\n\n**By Annotation**\n\n```java\n@POST(\"\u002Fusers\")\npublic void saveUser(@Form User user) {\n    System.out.println(\"user => \" + user);\n}\n```\n\nTest it with sample data from the terminal\n\n```bash\ncurl -X POST http:\u002F\u002F127.0.0.1:9000\u002Fusers -F username=jack -F age=16\n```\n\n**Custom model identification**\n\n```java\n@POST(\"\u002Fusers\")\npublic void saveUser(@Form(name=\"u\") User user) {\n    System.out.println(\"user => \" + user);\n}\n```\n\nTest it with sample data from the terminal\n\n```bash\ncurl -X POST http:\u002F\u002F127.0.0.1:9000\u002Fusers -F u[username]=jack -F u[age]=16\n```\n\n**Body Parameter To Model**\n\n```java\n@POST(\"\u002Fbody\")\npublic void body(@Body User user) {\n    System.out.println(\"user => \" + user);\n}\n```\n\nTest it with sample data from the terminal\n\n```bash\ncurl -X POST http:\u002F\u002F127.0.0.1:9000\u002Fbody -d '{\"username\":\"hellokaton\",\"age\":22}'\n```\n\n## Get Environment\n\n```java\nEnvironment environment = WebContext.blade().environment();\nString version = environment.get(\"app.version\", \"0.0.1\");\n```\n\n## Get Header\n\n**By Context**\n\n```java\n@GET(\"header\")\npublic void readHeader(RouteContext ctx){\n    System.out.println(\"Host => \" + ctx.header(\"Host\"));\n    \u002F\u002F get useragent\n    System.out.println(\"UserAgent => \" + ctx.userAgent());\n    \u002F\u002F get client ip\n    System.out.println(\"Client Address => \" + ctx.address());\n}\n```\n\n**By Annotation**\n\n```java\n@GET(\"header\")\npublic void readHeader(@Header String host){\n    System.out.println(\"Host => \" + host);\n}\n```\n\n## Get Cookie\n\n**By Context**\n\n```java\n@GET(\"cookie\")\npublic void readCookie(RouteContext ctx){\n    System.out.println(\"UID => \" + ctx.cookie(\"UID\"));\n}\n```\n\n**By Annotation**\n\n```java\n@GET(\"cookie\")\npublic void readCookie(@Cookie String uid){\n    System.out.println(\"Cookie UID => \" + uid);\n}\n```\n\n## Static Resource\n\nBlade builds a few static resource catalog, as long as you will save the resource file in the static directory under the classpath, and then browse http:\u002F\u002F127.0.0.1:9000\u002Fstatic\u002Fstyle.css\n\nIf you want to customize the static resource URL\n\n```java\nBlade.create().addStatics(\"\u002Fmydir\");\n```\n\nOf course you can also specify it in the configuration file. `application.properties` (location in classpath)\n\n```bash\nmvc.statics=\u002Fmydir\n```\n\n## Upload File\n\n**By Request**\n\n```java\n@POST(\"upload\")\npublic void upload(Request request){\n    request.fileItem(\"img\").ifPresent(fileItem -> {\n        fileItem.moveTo(new File(fileItem.getFileName()));\n    });\n}\n```\n\n**By Annotation**\n\n```java\n@POST(\"upload\")\npublic void upload(@Multipart FileItem fileItem){\n    \u002F\u002F Save to new path\n    fileItem.moveTo(new File(fileItem.getFileName()));\n}\n```\n\n## Download File\n\n```java\n@GET(value = \"\u002Fdownload\", responseType = ResponseType.STREAM)\npublic void download(Response response) throws IOException {\n    response.write(\"abcd.pdf\", new File(\"146373013842336153820220427172437.pdf\"));\n}\n```\n\n**If you want to preview certain files in your browser**\n\n```java\n@GET(value = \"\u002Fpreview\", responseType = ResponseType.PREVIEW)\npublic void preview(Response response) throws IOException {\n    response.write(new File(\"146373013842336153820220427172437.pdf\"));\n}\n```\n\n## Set Session\n\nThe session is disabled by default, you must enable the session.\n\n```java\nBlade.create()\n     .http(HttpOptions::enableSession)\n     .start(Application.class, args);\n```\n\n> 💡 It can also be enabled using a configuration file，`http.session.enabled=true` \n\n```java\npublic void login(Session session){\n    \u002F\u002F if login success\n    session.attribute(\"login_key\", SOME_MODEL);\n}\n```\n\n## Render To Browser\n\n### Render Response\n\n**By Context**\n\n```java\n@GET(\"users\u002Fjson\")\npublic void printJSON(RouteContext ctx){\n    User user = new User(\"hellokaton\", 18);\n    ctx.json(user);\n}\n```\n\n**By Annotation**\n\nThis form looks more concise 😶\n\n```java\n@GET(value = \"\u002Fusers\u002Fjson\", responseType = ResponseType.JSON)\npublic User printJSON(){\n    return new User(\"hellokaton\", 18);\n}\n```\n\n### Render Text\n\n```java\n@GET(\"text\")\npublic void printText(RouteContext ctx){\n    ctx.text(\"I Love Blade!\");\n}\n```\n\nor\n\n```java\n@GET(value = \"\u002Ftext\", responseType = ResponseType.TEXT)\npublic String printText(RouteContext ctx){\n    return \"I Love Blade!\";\n}\n```\n\n### Render Html\n\n```java\n@GET(\"html\")\npublic void printHtml(RouteContext ctx){\n    ctx.html(\"\u003Ccenter>\u003Ch1>I Love Blade!\u003C\u002Fh1>\u003C\u002Fcenter>\");\n}\n```\n\nor\n\n```java\n@GET(value = \"\u002Fhtml\", responseType = ResponseType.HTML)\npublic String printHtml(RouteContext ctx){\n    return \"\u003Ccenter>\u003Ch1>I Love Blade!\u003C\u002Fh1>\u003C\u002Fcenter>\";\n}\n```\n\n## Render Template\n\nBy default all template files are in the templates directory; in most of the cases you do not need to change it.\n\n### Default Template\n\nBy default, Blade uses the built-in template engine, which is very simple. In a real-world web project, you can try several other extensions.\n\n```java\npublic static void main(String[] args) {\n    Blade.create().get(\"\u002Fhello\", ctx -> {\n        ctx.attribute(\"name\", \"hellokaton\");\n        ctx.render(\"hello.html\");\n    }).start(Hello.class, args);\n}\n```\n\nThe `hello.html` template\n\n```html\n\u003C!DOCTYPE html>\n\u003Chtml lang=\"en\">\n\u003Chead>\n    \u003Cmeta charset=\"UTF-8\">\n    \u003Ctitle>Hello Page\u003C\u002Ftitle>\n\u003C\u002Fhead>\n\u003Cbody>\n\n    \u003Ch1>Hello, ${name}\u003C\u002Fh1>\n\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n```\n\n### Jetbrick Template\n\n**Config Jetbrick Template**\n\nCreate a `BladeLoader` class and load some config\n\n```java\n@Bean\npublic class TemplateConfig implements BladeLoader {\n\n    @Override\n    public void load(Blade blade) {\n        blade.templateEngine(new JetbrickTemplateEngine());\n    }\n\n}\n```\n\nWrite some data for the template engine to render\n\n```java\npublic static void main(String[] args) {\n    Blade.create().get(\"\u002Fhello\", ctx -> {\n        User user = new User(\"hellokaton\", 50);\n        ctx.attribute(\"user\", user);\n        ctx.render(\"hello.html\");\n    }).start(Hello.class, args);\n}\n```\n\nThe `hello.html` template\n\n```html\n\u003C!DOCTYPE html>\n\u003Chtml lang=\"en\">\n\u003Chead>\n    \u003Cmeta charset=\"UTF-8\">\n    \u003Ctitle>Hello Page\u003C\u002Ftitle>\n\u003C\u002Fhead>\n\u003Cbody>\n\n    \u003Ch1>Hello, ${user.username}\u003C\u002Fh1>\n\n    #if(user.age > 18)\n        \u003Cp>Good Boy!\u003C\u002Fp>\n    #else\n        \u003Cp>Gooood Baby!\u003C\u002Fp>\n    #end\n\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n```\n\n[Render API](http:\u002F\u002Fstatic.javadoc.io\u002Fcom.hellokaton\u002Fblade-core\u002F2.1.2.RELEASE\u002Fcom\u002Fhellokaton\u002Fblade\u002Fmvc\u002Fhttp\u002FResponse.html#render-com.ModelAndView-)\n\n## Redirects\n\n```java\n@GET(\"redirect\")\npublic void redirectToGithub(RouteContext ctx){\n    ctx.redirect(\"https:\u002F\u002Fgithub.com\u002Fhellokaton\");\n}\n```\n\n[Redirect API](http:\u002F\u002Fstatic.javadoc.io\u002Fcom.hellokaton\u002Fblade-core\u002F2.1.2.RELEASE\u002Fcom\u002Fhellokaton\u002Fblade\u002Fmvc\u002Fhttp\u002FResponse.html#redirect-java.lang.String-)\n\n## Write Cookie\n\n```java\n@GET(\"write-cookie\")\npublic void writeCookie(RouteContext ctx){\n    ctx.cookie(\"hello\", \"world\");\n    ctx.cookie(\"UID\", \"22\", 3600);\n}\n```\n\n[Cookie API](http:\u002F\u002Fstatic.javadoc.io\u002Fcom.hellokaton\u002Fblade-core\u002F2.1.2.RELEASE\u002Fcom\u002Fhellokaton\u002Fblade\u002Fmvc\u002Fhttp\u002FResponse.html#cookie-java.lang.String-java.lang.String-)\n\n## Web Hook\n\n`WebHook` is the interface in the Blade framework that can be intercepted before and after the execution of the route.\n\n```java\npublic static void main(String[] args) {\n    \u002F\u002F All requests are exported before execution before\n    Blade.create().before(\"\u002F*\", ctx -> {\n        System.out.println(\"before...\");\n    }).start();\n}\n```\n\n## Logging\n\nBlade uses slf4j-api as logging interface, the default implementation of a simple log package (modified from simple-logger); if you need complex logging you can also use a custom library, you only need to exclude the `blade-log` from the dependencies.\n\n```java\nprivate static final Logger log = LoggerFactory.getLogger(Hello.class);\n\npublic static void main(String[] args) {\n    log.info(\"Hello Info, {}\", \"2017\");\n    log.warn(\"Hello Warn\");\n    log.debug(\"Hello Debug\");\n    log.error(\"Hello Error\");\n}\n```\n\n## Basic Auth\n\nBlade includes a few middleware, like Basic Authentication; of course, it can also be customized to achieve more complex goals.\n\n```java\npublic static void main(String[] args) {\n    Blade.create().use(new BasicAuthMiddleware()).start();\n}\n```\n\nSpecify the user name and password in the `application.properties` configuration file.\n\n```bash\nhttp.auth.username=admin\nhttp.auth.password=123456\n```\n\n## Change Server Port\n\nThere are three ways to modify the port: hard coding it, in a configuration file, and through a command line parameter.\n\n**Hard Coding**\n\n```java\nBlade.create().listen(9001).start();\n```\n\n**Configuration For `application.properties`**\n\n```bash\nserver.port=9001\n```\n\n**Command Line**\n\n```bash\njava -jar blade-app.jar --server.port=9001\n```\n\n## Configuration SSL\n\n**Configuration For `application.properties`**\n\n```bash\nserver.ssl.enable=true\nserver.ssl.cert-path=cert.pem\nserver.ssl.private-key-path=private_key.pem\nserver.ssl.private-key-pass=123456\n```\n** Configuration using INettySslCustomizer **\n\n```bash\n#Specify any properties your customizer needs, for example\nserver.ssl.enable=true\nserver.keystore.path=fully qualified path\nserver.keystore.type=PKCS12\nserver.keystore.password=mypass\nserver.keystore.alias=optional alias\n```\n\n* Create your implementation of INettySslCustomizer\n* Register it with Blade class\n\n```java\n\t   MyNettySslCustomizer nc = new MyNettySslCustomizer();\t\n\t\tBlade.create()\n\t\t\t.setNettySslCustomizer(nc)\n\t\t\t.start(App.class, args);\n\t\t}\n```\n\nSample implementation of INettySslCustomizer\n\n```java\npublic class MyNettySSLCustomizer implements INettySslCustomizer {\n\n\tpublic SslContext getCustomSslContext(Blade blade) {\n\t\tSslContext sslctx = null;\n\n\t\t\u002F\u002F get my custom properties from the environment\n\t\tString keystoreType = blade.getEnv(\"server.keystore.type\", null);\n\t\tString keystorePath = blade.getEnv(\"server.keystore.path\", null);\n\t\tString keystorePass = blade.getEnv(\"server.keystore.password\", null);\n\n\t\tif (verifyKeystore(keystoreType, keystorePath, keystorePass)) {\n\n\t\t\ttry (FileInputStream instream = new FileInputStream(new File(keystorePath))) {\n\n\t\t\t\t\u002F\u002F verify I can load store and password is valid\n\t\t\t\tKeyStore keystore = KeyStore.getInstance(keystoreType);\n\t\t\t\tchar[] storepw = keystorePass.toCharArray();\n\t\t\t\tkeystore.load(instream, storepw);\n\t\t\t\t\n\t\t\t\tKeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());\n\t\t\t\tkmf.init(keystore, storepw);\n\t\t\t\tsslctx = SslContextBuilder.forServer(kmf).build();\n\t\t\t\t\n\t\t\t} catch (Exception ex) {\n\t\t\t\tlog.error(\"Keystore validation failed \" + ex.getMessage());\n\t\t\t}\n\t\t\t\n\t\t} else {\n\t\t\tlog.error(\"Unable to load keystore, sslContext creation failed.\");\n\t\t}\n\n\t\treturn sslctx;\n\t}\n```\n\n## Custom Exception Handler\n\nBlade has an exception handler already implemented by default; if you need to deal with custom exceptions, you can do it like follows.\n\n```java\n@Bean\npublic class GlobalExceptionHandler extends DefaultExceptionHandler {\n    \n    @Override\n    public void handle(Exception e) {\n        if (e instanceof CustomException) {\n            CustomException customException = (CustomException) e;\n            String code = customException.getCode();\n            \u002F\u002F do something\n        } else {\n            super.handle(e);\n        }\n    }\n\n}\n```\n\nBesides looking easy, the features above are only the tip of the iceberg, and there are more surprises to see in the documentation and sample projects:\n\n+ [Blade Demos](https:\u002F\u002Fgithub.com\u002Flets-blade\u002Fblade-demos)\n+ [Awesome Blade](https:\u002F\u002Fgithub.com\u002Flets-blade\u002Fawesome-blade)\n\n## Change Logs\n\n[See Here](https:\u002F\u002Flets-blade.com\u002Fabout\u002Fchange-logs)\n\n## Contact\n\n- Twitter: [hellokaton](https:\u002F\u002Ftwitter.com\u002Fhellokaton)\n- Mail: hellokaton@gmail.com\n\n## Contributors\n\nThanks goes to these wonderful people\n\n![contributors.svg](https:\u002F\u002Fopencollective.com\u002Fblade\u002Fcontributors.svg?width=890&button=false)\n\nContributions of any kind are welcome!\n\n## Licenses\n\nPlease see [Apache License](LICENSE)\n","Blade 是一个基于 Java8 和 Netty4 构建的轻量级、高性能且简洁优雅的 MVC 框架。其核心功能包括 RESTful 风格的路由设计、模板引擎支持、高并发处理能力（100 并发 QPS 可达 20w\u002Fs）、CSRF 和 XSS 防御机制以及多种常用中间件集成等，旨在提供一种更加简单高效的方式来开发 Web 应用程序。适用于需要快速搭建服务端应用，并追求代码简洁与执行效率的场景，尤其适合熟悉 Java8 新特性的开发者使用。",2,"2026-06-11 03:56:12","top_language"]