From efd4f7097070faf4316a6984af95aef5c5416d76 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Fri, 8 Apr 2016 12:42:25 +0800 Subject: [PATCH] =?UTF-8?q?cas=20url=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/fun/DesignerEnvProcessor.java | 7 +++++++ .../fun/impl/AbstractDesignerEnvProcessor.java | 9 +++++++++ .../src/com/fr/design/utils/DesignUtils.java | 15 ++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/fun/DesignerEnvProcessor.java b/designer_base/src/com/fr/design/fun/DesignerEnvProcessor.java index 805a074b4b..0278a8e0b7 100644 --- a/designer_base/src/com/fr/design/fun/DesignerEnvProcessor.java +++ b/designer_base/src/com/fr/design/fun/DesignerEnvProcessor.java @@ -21,4 +21,11 @@ public interface DesignerEnvProcessor extends Level{ * @return 修改后的jsessionid */ String changeEnvPathBeforeConnect(String userName, String password, String path); + + /** + * web端预览的时候不需要jsessionid, 他会默认跳转到登陆页面, 如果带上了, 返回会因为里面资源文件加载不到而出问题. + * + * @return web端预览地址 + */ + String getWebBrowserURL(String envPath); } diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractDesignerEnvProcessor.java b/designer_base/src/com/fr/design/fun/impl/AbstractDesignerEnvProcessor.java index 1c07a37db7..a7a51f6708 100644 --- a/designer_base/src/com/fr/design/fun/impl/AbstractDesignerEnvProcessor.java +++ b/designer_base/src/com/fr/design/fun/impl/AbstractDesignerEnvProcessor.java @@ -15,4 +15,13 @@ public abstract class AbstractDesignerEnvProcessor implements DesignerEnvProcess return path; } + /** + * web端预览的时候不需要jsessionid, 他会默认跳转到登陆页面, 如果带上了, 返回会因为里面资源文件加载不到而出问题. + * + * @return web端预览地址 + */ + public String getWebBrowserURL(String envPath){ + return envPath; + } + } diff --git a/designer_base/src/com/fr/design/utils/DesignUtils.java b/designer_base/src/com/fr/design/utils/DesignUtils.java index f048578d91..94db76af54 100644 --- a/designer_base/src/com/fr/design/utils/DesignUtils.java +++ b/designer_base/src/com/fr/design/utils/DesignUtils.java @@ -5,6 +5,8 @@ import com.fr.base.remote.RemoteDeziConstants; import com.fr.dav.DavXMLUtils; import com.fr.dav.LocalEnv; import com.fr.design.DesignerEnvManager; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.gui.UILookAndFeel; import com.fr.design.mainframe.DesignerContext; import com.fr.env.RemoteEnv; @@ -303,7 +305,8 @@ public class DesignUtils { postfixOfUri = isUserPrivilege ? postfixOfUri + "&fr_check_url=" + time + "&id=" + FRContext.getCurrentEnv().getUserID(): postfixOfUri ; } - Desktop.getDesktop().browse(new URI(FRContext.getCurrentEnv().getPath() + postfixOfUri)); + String urlPath = getWebBrowserPath(); + Desktop.getDesktop().browse(new URI(urlPath + postfixOfUri)); } catch (Exception e) { FRContext.getLogger().error("cannot open the url Successful", e); } @@ -319,6 +322,16 @@ public class DesignUtils { } } + private static String getWebBrowserPath() { + String urlPath = FRContext.getCurrentEnv().getPath(); + DesignerEnvProcessor processor = ExtraDesignClassManager.getInstance().getEnvProcessor(); + if (processor != null) { + //cas访问的时候, url要处理下. + urlPath = processor.getWebBrowserURL(urlPath); + } + return urlPath; + } + //TODO:august:下个版本,要把下面的图片都放在一个preload文件夹下,表示可以预先加载。然后遍历一下就可以了,不用这么一个一个的写了 /**