本机 Domino 链接和 XPage [英] native Domino links and XPages

查看:23
本文介绍了本机 Domino 链接和 XPage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用户通过旧格式的链接打开文档http://server/db.nsf/VIEW_UNID/DOC_UNID.该表单的属性设置为改为打开 XPage.

Users open documents by links in old format http://server/db.nsf/VIEW_UNID/DOC_UNID. The form has property set to open XPage instead.

这些链接的来源是通用代理"生成的电子邮件通知.它只是发送指向文档的链接.它不知道什么表单与什么 XPage 相关联,因此它生成通用链接而不是/page.xsp&documentId=...".

Origin of these links is email notification generated by "universal agent". It simply sends link to document. It does not know, what form is associated with what XPage, therefore it generates universal links instead of "/page.xsp&documentId=...".

问题:在客户端计算的相对链接不起作用 - <a href = "/page.xsp?params"> 应该更有效 - 没有往返并且在页面加载时易于计算.他们评估为 http://server/db.nsf/0/page.xsp?params,自然而然地以错误 404 结束.

The problem: relative links computed at client do not work - < a href = "/page.xsp?params"> should be more effective - no roundtrip and easy to compute at page load. They evaluate to http://server/db.nsf/0/page.xsp?params, what ends with Error 404, naturaly.

XPage 包含帮助"部分,这是另一个带有包含文本、图像和链接的 RT 字段的文档.当从另一个 XPage 视图 (/page.xsp) 打开 XPage 时,该 RT 字段中的相关链接有效,但从通知链接 (/0/UNID) 重定向时失败.

XPage contains "help" section, what is another document with RT field containing text, images and links. And relative links in that RT field work when XPage is opened from another XPage - view (/page.xsp), but fail when redirected from notification link (/0/UNID).

问题:打开重定向后如何有效地将浏览器的地址栏重置为扩展 XPage 格式 http://server/db.nsf/page.xsp?documentId=DOC_UNID旧式 URL 的文档/视图?

Question: How to effectively reset browser's address bar to extended XPages format http://server/db.nsf/page.xsp?documentId=DOC_UNID after opening redirected documents/views by old fashioned URLs?

推荐答案

主要问题是服务器端(SSJS 评估)和客户端(浏览器评估)的相对链接不一致.我已经通过简单的重定向解决了我的问题,以防文档是通过老式链接打开的.

Main problem is in discrepancy of relative links on server side (evaluated in SSJS) and client side (evaluated by browser). I have solved my problem by simple redirect in case document is open by old fashioned link.

<?xml version="1.0" encoding="UTF-8"?>
    <xp:view xmlns:xp="http://www.ibm.com/xsp/core">
        <xp:eventHandler event="onClientLoad" submit="false">
            <xp:this.script><![CDATA[var url = "#{javascript:context.getUrl()}";
    var l = window.location;
    if (url != l) {
        window.location.replace(url);
    }
    ]]></xp:this.script>
    </xp:eventHandler>
</xp:view>

简单地说,如果打开的 URL 与内部 URL 不同(由 XSP 引擎解析),浏览器将重定向到正确的 URL.这解决了我们在内嵌图像(图像资源)和附件方面遇到的许多问题.

Simply said, if open URL differs from internal URL (as resolved by XSP engine), browser redirects to correct URL. This solved many problems we had with inline images (image resource) and attachments.

这篇关于本机 Domino 链接和 XPage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆