UPDATE底:问题来源查明的xpages:什么可以停止代码停止,同时保存页面?
我有一个页面,基于已经从应用程序的以前的优化版本剥离大部分计算领域的形式(这样的文档实际上可以通过computewithform功能),我在保存文档时遇到了问题。我有Notes客户端(以前的应用版本)中创建的文档已转换为MIME,并且在新的xpages应用中创建的一些文档(使用CKEditor)保存在富文本字段中,该字段被标记为存储为MIME也是如此。
我有一个按钮来“发布”文档。该代码适用于在新应用程序中创建的文档,但它似乎停止在以前的应用程序版本中创建的文档的某处。
这里的IE陷阱尽可能HTTP流量中有哪些:
A case that works:
/mydb.nsf/page.xsp?action=editDocument&documentId=353B2 HTTP POST 302 244 B 218 ms cliquer 0 31 0 187 0 1761
/mydb.nsf/xPublish?OpenAgent&docid=487A3447CFA36BF085257EE400626485 HTTP GET 302 190 B 141 ms cliquer 218 16 125 0 0 1620
http://myserver.com/mydb.nsf/dx/test_13col00 HTTP GET 200 text/html 55.71 Ko 312 ms cliquer 359 0 0 32 0 1308
A case that doesn't work:
http://myserver.com/mydb.nsf/page.xsp?action=editDocument&documentId=353BA HTTP POST 302 244 B 188 ms cliquer 0 32 0 156 0 156
/mydb.nsf/xPublish?OpenAgent&docid=E0E13322928B8F9685257EE400628B0A HTTP (Abandonned) 193 B < 1 ms cliquer 188 0 0 0 0 156
在代码中的“发布”按钮是:
//set status
if(getComponent("publishLater1").getValue() == "1") {
pageDocument.replaceItemValue("status", "Scheduled Publication");
} else {
pageDocument.replaceItemValue("status", "To Be Published");
}
//so we know the document has been saved (for drafts, when cancelled)
pageDocument.replaceItemValue("hasBeenSaved", "1");
//init some fields (res_title, ...)
if(!(pageDocument.hasItem("res_title")) || pageDocument.getItemValueString("res_title")==""){
pageDocument.replaceItemValue("res_title", buildResTitle(pageDocument.getItemValueString("subject")));
}
//set VERKEY AND VERNUMBER if not already set
if(pageDocument.getItemValueString("VERKEY")==""){
pageDocument.replaceItemValue("VERKEY", @Unique());
}
if(pageDocument.getItemValueString("VERNUMBER")==""){
pageDocument.replaceItemValue("VERNUMBER", 1);
}
//save pageDocument
pageDocument.save();
//send to publish agent
//remove the lock doc
//unlockDoc(pageDocument.getDocument().getUniversalID());
//for scheduled publications, a LotusScript agent will do the work
var res=facesContext.getExternalContext().getResponse();
if(getComponent("publishLater1").getValue() == "0") {
// Now load the publish Agent
var baseUrl = @Left(facesContext.getExternalContext().getRequestContextPath(),".nsf") + ".nsf/";
facesContext.getExternalContext().redirect(baseUrl + "xPublish?OpenAgent&docid=" + pageDocument.getDocument().getUniversalID());
//res.sendRedirect(xPublish?OpenAgent&docid=" + pageDocument.getDocument().getUniversalID(), false);
} else {
//send to the drafts view, to show it has the clock icon in the draft view
context.redirectToPage("adminDrafts.xsp");
}
我就饶了LotusScript代理的细节被称为(xPublish),但该代码中的重定向是这样完成的:
Print "Location:" + db.Filepath + "/dx/" + res_title
根据IE的http日志,在按钮中运行代码时,似乎有些事情不太正确,并且会导致放弃http post,因此对LotusScript代理的调用也会被放弃,而不会将用户重定向到新发布的页。相反,用户会被重定向到这个网址:
http://myserver.com/mydb.nsf/page.xsp?action=editDocument&documentId=353BA
大这里的问题是,这个页面(草案版本)在LotusScript代理被删除,使URL给出了一个错误页面。
如果您想知道发布代码为什么在LotusScipt中,这是因为我们还有一个计划的代理程序,它每天运行并发布将来发布的“计划发布”。这是为了避免必须同时维护SSJS和LotusScript代码。
任何线索为什么发生这种情况?
UPDATE
好吧,这似乎代码工作正常,但它在LotusScript代理不胜任的重定向。这是我用什么来重定向到刚刚发布的页面:
Print "Location: http://ourserver.com/mydb.nsf/dx/" + res_title
它是在一个点的工作,但现在它似乎是导致问题。有趣的是代理可以正常使用我们从头开始创建的文档,但不适用于在以前版本的应用中创建的文档......仍然不知道如何解决这个问题。从xpages的LotusScript做重定向的方法是什么?