1 Star 4 Fork 1

lcnap / vertx-webmvc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

vertx-webmvc

描述

一个简单、用于练手的使vertx-web支持 SpringMVC 风格的脚手架,或工具类。

启动

直接通过接口启动即可。appClass 要在最顶层。

   SimpleWebApplication.run(Vertx vertx, Class<?> appClass);

业务代码样例

详细参考 test/WebApp.java

    @HttpHandler(path = "/hi",contentType = "text/plain; charset=utf-8")
    public String hi(@Param String msg){
        return "hi " + msg;
    }

    @HttpHandler(path = "/home",contentType = "text/html;")
    public String home(RoutingContext routingContext){
        routingContext.put("msg","freemarker 中文");
        return "home";
    }

    @HttpHandler(path = "/jsonobject")
    public JsonObject jsonObject(){
        return new JsonObject().put("now", LocalDateTime.now().toString())
                               .put("server","vertx")
                               .put("x","消息");
    }

配置

默认配置文件是 resources/http-server.json 只加了, "templateEngine": "io.vertx.ext.web.templ.freemarker.FreeMarkerTemplateEngine"
这个自定义配置项,其他值参考vertx文档。 默认模板引擎是,freemarker。 其他配置项,参考vertx的 HttpServerOptions

注意

编译的时候,记得加 -parameters。

成熟度

只用于练手,或学习。

Copyright 2020 lcnap Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

一个简单、用于练手的使vertx-web支持 SpringMVC 风格的脚手架,或工具类。 展开 收起
Java
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/lcnap/vertx-webmvc.git
git@gitee.com:lcnap/vertx-webmvc.git
lcnap
vertx-webmvc
vertx-webmvc
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891