在我的xpages应用中,我想根据角色重定向用户。但是,计算出的URL会导致URL路径名称中带有%5C的丑陋URL
var baseURL = context.getUrl().toString().split(facesContext.getExternalContext().getRequest().getRequestURI())[0];
var path =escape(database.getFilePath());
if (context.getUser().getRoles().contains("[Administrator]") || context.getUser().getRoles().contains("[SuperAdmin]") || context.getUser().getRoles().contains("[Ledamot]")){
facesContext.getExternalContext().redirect(baseURL + slash + path + "/employees.xsp?sorting=asc")
}else{
context.redirectToPage("index.xsp")
}
结果如下::https://server/directory%5cdatabase.nsf/employees.xsp?sorting=asc
答案 0 :(得分:1)
%5c是反斜杠,所以您要做的是用正斜杠替换文件路径中的反斜杠。所以这样的事情应该起作用:
SELECT ID, a.date_from + rnum - 1 AS day_token
FROM (SELECT a.ID, a.date_from, a.date_to, ROWNUM AS rnum
FROM all_objects, leave a
-- Aside from ALL_OBJECT, I cross join it with my LEAVE table
WHERE ROWNUM <= a.date_to - a.date_from + 1) a
WHERE TO_CHAR (a.date_from + rnum - 1, 'DY') NOT IN ('SAT', 'SUN');
AND NOT EXISTS (SELECT 1
FROM holiday b
WHERE b.schedule = d.date_from + rnum - 1)
AND NOT EXISTS (SELECT 1
FROM suspension c
WHERE c.schedule = d.date_from + rnum - 1)
答案 1 :(得分:1)
由于您要重定向到同一数据库,因此可以这样计算url前缀(主机+数据库路径):
context.getUrl().toString().split(view.getPageName())[0]