Blade-Simple and powerful javaweb frame

Source: Internet
Author: User

Blade

中文版

Blade is a simple and powerful web framework, it has built-in IOC management, interceptor Configuration, REST API development and many other major web features, integrated template engine, cache plug-ins, database operations, mail sending and other common functions, concise source is worth reading and learning. Welcome to star and fork! if you like

Blade characteristics
    • Simple MVC & Interceptors
    • Rest-style API
    • Annotation Mode Development
    • Micro-core IOC container
    • Utility class
    • Template engine Support
    • Support jdk1.6+
    • Built-in jetty boot
    • Plug-in extension mechanism
    • ...
Quick Start

The first step, build a webapp with Maven, join the blade dependency, recommend getting the latest version

<dependency>    <groupId>com.bladejava</groupId>    <artifactId>blade</artifactId>    <version>x.x.x</version></dependency>

The second step, web.xml configuring the blade core filter in and setting your initialization class, you can also not configure (use jetty boot)

<web-app>    <display-name>Archetype Created Web Application</display-name>    <filter>        <filter-name>Bladefilter</filter-name>        <filter-class>Blade. Bladefilter</filter-class>        <init-param>            <param-name>ApplicationClass</param-name>            <param-value>Blade.sample.App</param-value>        </init-param>    </filter>    <filter-mapping>        <filter-name>Bladefilter</filter-name>        <url-pattern>/*</url-pattern>    </filter-mapping></Web-app>

The third step, writing App.java and routing files, here is an example

publicclass App extends BladeApplication{    Logger logger = Logger.getLogger(App.class);    @Override    publicvoidinit() {        // 设置路由、拦截器包所在包        Blade.defaultRoute("blade.sample");    }}
@Path Public  class Hello {    @Route("/hello") PublicStringHello() {System.out.println ("Hello");return "hello.jsp"; }@Route(Value ="/post", method = Httpmethod.post) Public void Post(Request request) {String name = Request.query ("Name"); System.out.println ("name ="+ name); }@Route("/users/:name") PublicModelandviewUsers(Request request, Response Response) {System.out.println ("Users"); String name = Request.pathparam (": Name"); Modelandview Modelandview =NewModelandview ("Users"); Modelandview.add ("Name", name);returnModelandview; }@Route("/index") PublicStringIndex(Request request) {Request.attribute ("Name","Jack");return "index.jsp"; }}

OK, it all looks so simple, check out the usage guide for more ready-made examples for your reference:

Blade Use Guide (perfect ...)

Some examples: Https://github.com/bladejava

Update Log v1.1.2
1. 优化sql2o支持2. 去除blade-kit无用类3. 添加邮件支持4. 添加程序计时支持5. 添加http网络请求支持
v1.1.0
1. 去除对外公开的多余方法展示2. 添加`Blade.run()`方式运行jetty3. 添加`Blade.register()`方法注册bean对象4. 优化IOC对象管理5. 优化底层IO6. 简化插件扩展7. 拦截器路由匹配分离8. 修复jetty在多maven环境下运行bug 9. 添加初始化监听context10. 优化文件上传11. 优化路由匹配12. 添加方法执行监测13. 添加缓存支持
v1.0.0
第一个稳定版本发布
Open Source Agreement

Blade framework based on Apache2 License

Contact me

Mail:biezhi.me#gmail.com

Java Communication Group: 1013565

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Blade-Simple and powerful javaweb frame

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.