Spring Roo 1.2:仅使用 Spring Roo 创建控制器,没有 jspx 文件

发布于 2024-12-28 07:36:36 字数 783 浏览 4 评论 0原文

我正在尝试创建一个位于 roo generated gae 项目上的 RAD jquery 移动应用程序生成器。我编写了生成器代码,用于查找所有 jpa 实体,然后利用使用 roo 创建的 REST/JSON 服务在找到的实体上创建完整的 jquery 移动应用程序。类似于 roo web mvc 对 dojo Web 应用程序所做的事情。我正在尝试找到一种方法来仅创建 REST/JSON 控制器,而不是所有视图内容(jspx/tagx/tiles/等),因为它们不部署到 gae。有谁知道这是否可以在不直接编辑 roo 插件的情况下实现?

project --topLevelPackage com.testpackage --java 6 --projectName testproject
persistence setup --provider DATANUCLEUS --database GOOGLE_APP_ENGINE
entity jpa --class ~.domain.Company --testAutomatically
field string --fieldName name --sizeMax 50
service --interface ~.service.CompanyService
json add --class ~.domain.Company
controller all --package ~.controller.CompanyController <---- creates the controller and all the unwanted web stuff

任何想法将不胜感激...

I am trying to create a RAD jquery mobile application generator that sits on a roo generate gae project. I've written the generator code that finds all jpa entities and then creates a full jquery mobile application over the found entities utilizing REST/JSON services created with roo. Similar to what roo web mvc does with the dojo web app. I'm trying to find a way to only create the REST/JSON controller and not all the view stuff (jspx/tagx/tiles/etc) as they do not deploy to gae. Does anyone know if this is possible without editing the roo plugin directly?

project --topLevelPackage com.testpackage --java 6 --projectName testproject
persistence setup --provider DATANUCLEUS --database GOOGLE_APP_ENGINE
entity jpa --class ~.domain.Company --testAutomatically
field string --fieldName name --sizeMax 50
service --interface ~.service.CompanyService
json add --class ~.domain.Company
controller all --package ~.controller.CompanyController <---- creates the controller and all the unwanted web stuff

Any thought would be greatly appreciated...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

七秒鱼° 2025-01-04 07:36:36

我很高兴地报告,Spring Roo 1.2.5 可以实现这一点。

project --topLevelPackage com.example.jukebox
jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY 
entity jpa --class ~.domain.Song
field string --fieldName title
json add 
web mvc json setup
web mvc json all
exit

使用 mvn jetty:run 启动 Jetty 服务器。

现在,您可以发布歌曲:

curl -X POST -d '{"title":"Ride Around Shining"}' -H "Content-Type: application/json" http://localhost:8080/jukebox/songs

或获取所有歌曲的列表:curl http://localhost:8080/jukebox/songs

[{"id":1,"title":"Ride Around Shining","version":0}]

或者通过 id 获取歌曲:curl http://本地主机:8080/点唱机/歌曲/1

{"id":1,"title":"Ride Around Shining","version":0}

I'm happy to report that this is possible with Spring Roo 1.2.5.

project --topLevelPackage com.example.jukebox
jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY 
entity jpa --class ~.domain.Song
field string --fieldName title
json add 
web mvc json setup
web mvc json all
exit

Spin up a Jetty server with mvn jetty:run.

Now, you can POST a song:

curl -X POST -d '{"title":"Ride Around Shining"}' -H "Content-Type: application/json" http://localhost:8080/jukebox/songs

Or GET a list of all songs: curl http://localhost:8080/jukebox/songs

[{"id":1,"title":"Ride Around Shining","version":0}]

Or GET a song by id: curl http://localhost:8080/jukebox/songs/1

{"id":1,"title":"Ride Around Shining","version":0}
从来不烧饼 2025-01-04 07:36:36

我最终分叉了 roo web 插件源代码。进行了修改,因此 jspx 文件没有被复制。

I ended up forking the roo web addon source code. Made the modification so the jspx files were not copied over.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文