创建 Groovy Portlet

发布于 2024-09-24 01:27:30 字数 244 浏览 0 评论 0原文

我正在开始研究/创建一个 groovy portlet,它将连接到返回 JSON 的基于 REST 的 ESB 服务;我还需要在标题中传递用户名。我想知道是否有关于如何创建 portlet 和设置标头的示例?我是 groovy 的新手,据我了解,这可以很容易地完成。本质上,我想要一个允许用户通过搜索框搜索小部件并返回匹配列表的 portlet。不确定这是否重要,但 portlet 将部署到 Vignette Portal。任何信息将不胜感激!

提前致谢!

I am getting started researching / creating a groovy portlet that will connect to a REST based ESB service that returns JSON; I will also need to pass the username in the headers. I was wondering if there are any examples out there on how to create the portlet and set the headers? I am new to groovy and from what I understand this can be accomplished rather easily. Essentially I want a portlet that will allow a user to search for a widget via a search box and return a list of matches. Not sure that it matters but the portlet will be deployed to the Vignette Portal. Any info would be much appreciated!

Thanks in Advance!

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

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

发布评论

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

评论(1

泪痕残 2024-10-01 01:27:30

使用 Spring Portlet MVC 可以非常轻松地使用 Java/Groovy 制作 portlet。一年前,我使用了来自不同来源的一些示例代码,但通过谷歌搜索将为您提供更多现代示例,并让您选择更适合您的应用程序的内容。真正的问题在于您计划如何构建应用程序。 Gradle 是编写 Groovy Web 应用程序的最佳选择。

然而,如果您正在谈论使用 Grails,那么它会变得更加困难,我不建议学习 Grails,因为您试图将其塞入“门户”实现中。 Grails 中有 Liferay 和“portlet”的插件,但当我今年早些时候最后一次查看它们时,它们似乎还没有完全成熟。

使用 JSON 或服务器代码中的任何内容调用基于 REST 的服务不必关心您是否位于“门户”中。当您尝试使用门户提供商特定的 API 创建 UI 时,就会出现大问题。不要误以为您不会使用门户特定的东西。我们使用了一点 Liferay,从我的角度来看,Portlet 规范非常薄弱,因此要在门户中做很多有趣的事情,您必须使用一些门户特定的东西,至少对于 UI 和身份验证服务。

因此,我的建议是构建一个 Gradle Groovy Web 项目并使用 Spring Portlet MVC Java 示例来完成某些操作,然后您可以使用 Groovy 进行简化,因为它有意义。最初,如果 Java 是您的舒适区,您可能只想从 Java 开始,因为与您的门户集成可能已经足够令人畏惧,而无需尝试学习一门新语言来启动。

Doing a portlet with Java/Groovy is very doable with Spring Portlet MVC. I used some sample code from various sources a year ago but googling on it will give you more modern examples and let you pick something more applicable to your app. The real issue comes up with how you plan on building your app. Gradle is the best option for writing a Groovy web app.

However if you are talking about using Grails, then it becomes much more difficult and I would not advise learning Grails as you are trying to get it jammed into a 'portal' implementation. There are plugins for Liferay and 'portlets' in Grails but when I last looked at them earlier this year, they did not seem fully baked.

Calling REST based services with JSON or whatever from your server code doesn't have to care that you are in a 'portal'. The big issues comes up when you are trying to create the UI with your portal provider specific APIs. Don't be fooled into thinking you won't be using portal specific stuff. We used Liferay a bit and from my perspective the Portlet spec was very slim so to do much of anything interesting in a portal, you have to use some portal specific stuff, at least for UI and authentication services.

So my suggestion is build a Gradle Groovy Web project and use the Spring Portlet MVC Java examples to get something going and then you can simplify with Groovy as it makes sense. Initially you might want to simply start with Java if that is your comfort zone because integrating with your portal might be daunting enough without trying to learn a new language to boot.

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