如何更改 Seaside 中单元素路径的处理方式?

发布于 2024-10-18 03:47:27 字数 610 浏览 0 评论 0原文

默认情况下,Seaside 将 example.com/myapp 指向在 myapp 注册的任何应用程序。我想要一个也可以处理这些链接的核心应用程序,或者处理这些链接的其他方式。

到目前为止,我有一个 home 应用程序,它也注册为默认应用程序,因此 http://mydomain.com 将解析它,但如果我生成一个链接与 http://mydomain.com/more-info 一样,Seaside 尝试解析在 more-info 注册的应用程序。如果我希望我的 home 应用程序处理该链接怎么办?或者用其他方式处理?

我使用 Apache 托管 Seaside,因此我可以使用 Apache 的 URL 重写引擎将 http://mydomain.com/more-info 重写为 http://mydomain.com/home/ more-info,它将由我的 home 应用程序处理。

有更好的方法吗?另外,如果存在 Seaside 请求/响应生命周期解释的链接,那就太好了。

Seaside by default points example.com/myapp to whatever application is registered at myapp. I'd like to have a core application that can also handle these links, or some other way of handling these links.

So far, I have a home application that is also registered as the default application, so http://mydomain.com will resolve to it, but if I generate a link, like http://mydomain.com/more-info, Seaside tries to resolve an application registered at more-info. What if I want my home application to handle the link? Or handle it in some other way?

I'm hosting Seaside with Apache, so I could use Apache's URL rewriting engine to rewrite http://mydomain.com/more-info to http://mydomain.com/home/more-info, which would be handled by my home app.

Is there a better way to do this? Also, if a link exists to an explanation of the Seaside request/response lifecycle, that'd be sweet.

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

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

发布评论

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

评论(1

预谋 2024-10-25 03:47:27

您尝试做的事情在 Seaside 应用程序中并不常见。如果您想在应用程序中生成从一个页面到另一个页面的链接,通常会使用附加到锚点的回调:

html anchor callback: [ self call: moreInfoComponent]

在这种情况下,您不关心 url 的外观,Seaside 会为您生成 url。此类生成的 url 永远不会有嵌套结构,而是使用参数。

有关 Seaside 请求/响应周期的更多信息,请参阅在线书籍(“基础知识”和“排序组件”章节) ”)。

但是,如果您确实想要拥有这样的嵌套网址(使网址可加入书签),则有不同的方法,具体取决于您实际想要实现的目标。您可以查看处理过期会话的方法(在书中)或访问 Seaside-REST 包< /a>.

顺便说一句,URL 到应用程序的映射是通过 WADispatcher(的实例)进行的。如果检查以下表达式的结果,您可以看到 Seaside 的调度程序树。它是完全可定制的,通过添加新的应用程序、调度程序等...

WAAdmin defaultServerManager adaptors first requestHandler

希望这对您有所帮助...

What you are trying to do is not common practice in Seaside applications. If you want to generate a link from one page to another page in your application, you generally use a callback attached to an anchor:

html anchor callback: [ self call: moreInfoComponent]

In such cases, you do not care about how the url looks like and Seaside generates the url for you. Such generated urls never have a nested structure but use parameters.

More information on the Seaside request/response cycle can be found in the online book (chapters "Fundamentals" and "Sequencing Components").

However, if you indeed want to have such a nested url (to make urls bookmarkable), there are different approaches, depending on what you actually want to achieve. You can either take a look at the approach for handling expired sessions (in the book) or at the Seaside-REST package.

Btw, the mapping of urls to applications happens through (instances of) WADispatcher. If you inspect the result of the following expression, you can see the dispatcher tree of Seaside. It's entirely customizable by adding new applications, dispatchers, etc...

WAAdmin defaultServerManager adaptors first requestHandler

Hope this helps you on your way...

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