3 Star 2 Fork 0

slacrey / rhea-project

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

#rhea 简单mvc开发框架

单独使用示例:

@WebFilter(urlPatterns = {"/*"},
        initParams = {@WebInitParam(name = "encoding", value = "UTF-8")}
)
public class TestFilter extends RheaMvcFilter {
    @Override
    protected void initPlugins(PluginBuilder builder) {

    }

    @Override
    protected void initRoutes(RouteBuilder builder) {
        builder.route(new Route() {
            @Override
            public View handle(Request request, Response response) throws RouteException {
                Map<String, String> result = new HashMap<String, String>(1);
                result.put("test", "123");
                return new JsonView(result);
            }
        }).get("/demo1");

        builder.route(new Route() {
            @Override
            public View handle(Request request, Response response) throws RouteException {
                return new JspView("/index.jsp");
            }
        }).get("/index.do");

        builder.route(new Route() {
            @Override
            public View handle(Request request, Response response) throws RouteException {
                Demo demo = new Demo();
                request.toBean(demo);
                return new JsonView(demo);
            }
        }).post("/post.do");

        builder.filter(new Filter() {
            @Override
            public void handle(Request request, Response response) throws FilterException {

            }
        }).before("/*");
    }
}

集成spring使用示例

@WebFilter(urlPatterns = {"/*"},
        initParams = {@WebInitParam(name = "encoding", value = "UTF-8")}
)
public class TestFilter extends RheaMvcFilter {
    @Override
    protected void initPlugins(PluginBuilder builder) {

    }

    @Override
    protected void initRoutes(RouteBuilder builder) {
        
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:rhea="http://www.seelyn.com/schema/rhea"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.seelyn.com/schema/rhea
       http://www.seelyn.com/schema/rhea/rhea-route.xsd">

    <bean id="testRoute" class="com.seelyn.rhea.test.web.TestRoute"/>

    <rhea:route-factory id="routeFactory">
        <rhea:route method="GET" path="/test1" ref="testRoute"/>
        <rhea:route method="GET" path="/test2" ref="testRoute"/>
        <rhea:route method="GET" path="/test3" ref="testRoute"/>
        <rhea:route method="GET" path="/test4/:naval" ref="testRoute"/>
    </rhea:route-factory>

</beans>

Comments ( 0 )

Sign in for post a comment

About

简单的MVC框架 spread retract
Java
Apache-2.0
Cancel

Releases

No release

Contributors

All

Activities

load more
can not load any more
Java
1
https://gitee.com/slacrey/rhea-project.git
git@gitee.com:slacrey/rhea-project.git
slacrey
rhea-project
rhea-project
master

Search