diff --git a/designer_base/src/com/fr/design/extra/PluginOperateUtils.java b/designer_base/src/com/fr/design/extra/PluginOperateUtils.java index 7fe4101d3f..5ce0852c8e 100644 --- a/designer_base/src/com/fr/design/extra/PluginOperateUtils.java +++ b/designer_base/src/com/fr/design/extra/PluginOperateUtils.java @@ -2,7 +2,13 @@ package com.fr.design.extra; import com.fr.base.ConfigManager; import com.fr.base.FRContext; -import com.fr.design.extra.exe.callback.*; +import com.fr.design.extra.exe.callback.InstallFromDiskCallback; +import com.fr.design.extra.exe.callback.InstallOnlineCallback; +import com.fr.design.extra.exe.callback.JSCallback; +import com.fr.design.extra.exe.callback.ModifyStatusCallback; +import com.fr.design.extra.exe.callback.UninstallPluginCallback; +import com.fr.design.extra.exe.callback.UpdateFromDiskCallback; +import com.fr.design.extra.exe.callback.UpdateOnlineCallback; import com.fr.design.gui.ilable.UILabel; import com.fr.general.FRLogger; import com.fr.general.Inter; @@ -20,7 +26,8 @@ import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.view.PluginView; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; import java.io.File; import java.util.List; @@ -81,17 +88,17 @@ public class PluginOperateUtils { } public static void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSCallback jsCallback) { - + SwingUtilities.invokeLater(new Runnable() { - + @Override public void run() { int rv = JOptionPane.showConfirmDialog( - null, - Inter.getLocText("FR-Plugin_Delete_Confirmed"), - Inter.getLocText("FR-Designer-Plugin_Warning"), - JOptionPane.OK_CANCEL_OPTION, - JOptionPane.INFORMATION_MESSAGE + null, + Inter.getLocText("FR-Plugin_Delete_Confirmed"), + Inter.getLocText("FR-Designer-Plugin_Warning"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.INFORMATION_MESSAGE ); if (rv == JOptionPane.OK_OPTION) { PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); @@ -101,111 +108,25 @@ public class PluginOperateUtils { }); } - public static void readUpdateOnline(final JSCallback jsCallback) { - - new Thread(new Runnable() { - @Override - public void run() { - try { - List plugins = PluginsReaderFromStore.readPluginsForUpdate(); - JSONArray jsonArray = new JSONArray(); - for (PluginView plugin : plugins) { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("pluginid", plugin.getID()); - jsonArray.put(jsonObject); - } - String result = jsonArray.toString(); - jsCallback.execute(result); - } catch (Exception e) { - FRLogger.getLogger().error(e.getMessage()); - } - } - }).start(); - - - } - - public static void searchPlugin(final String keyword, final JSCallback jsCallback) { - - new Thread(new Runnable() { - @Override - public void run() { - try { - if (StringUtils.isBlank(keyword)) { - getRecommendPlugins(jsCallback); - return; - } - HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("shop.plugin.store") + "&keyword=" + keyword); - httpClient.asGet(); - String result = httpClient.getResponseText(); - JSONObject jsonObject = new JSONObject(result); - JSONArray jsonArray = jsonObject.getJSONArray("result"); - JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(jsonArray); - jsCallback.execute(resultJSONArray.toString()); - } catch (Exception e) { - FRLogger.getLogger().error(e.getMessage()); - } - } - }).start(); - - } - - public static void getPluginFromStore(final String category, final String seller, final String fee, final JSCallback jsCallback) { - - new Thread(new Runnable() { - @Override - public void run() { - String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.plist") + "?"; - boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee); - if (getRecommend) { - getRecommendPlugins(jsCallback); - return; - } - - if (StringUtils.isNotBlank(plistUrl)) { - StringBuilder url = new StringBuilder(); - url.append(plistUrl); - dealParams(url, category, seller, fee); - try { - HttpClient httpClient = new HttpClient(url.toString()); - httpClient.asGet(); - String result = httpClient.getResponseText(); - JSONObject resultJSONObject = new JSONObject(result); - JSONArray resultArr = resultJSONObject.getJSONArray("result"); - JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(resultArr); - jsCallback.execute(resultJSONArray.toString()); - } catch (Exception e) { - FRLogger.getLogger().error(e.getMessage()); - } - } else { - String result = PluginConstants.CONNECTION_404; - jsCallback.execute(result); - } - } - - }).start(); - - } - - public static void getRecommendPlugins(JSCallback jsCallback) { + public static String getRecommendPlugins() { String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.feature"); + JSONArray resultArray = JSONArray.create(); try { - HttpClient httpClient = new HttpClient(plistUrl.toString()); + HttpClient httpClient = new HttpClient(plistUrl); String result = httpClient.getResponseText(); JSONArray jsonArray = new JSONArray(result); - JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(jsonArray); - jsCallback.execute(resultJSONArray.toString()); + resultArray = PluginUtils.filterPluginsFromVersion(jsonArray); } catch (Exception e) { FRLogger.getLogger().error(e.getMessage()); } - + return resultArray.toString(); } public static void dealParams(StringBuilder url, String category, String seller, String fee) { if (StringUtils.isNotBlank(category)) { url.append("cid=").append(category.split("-")[1]); } else { - url.append("cid=").append(""); + url.append("cid=").append(StringUtils.EMPTY); } if (StringUtils.isNotBlank(seller)) { switch (seller.split("-")[1]) { @@ -216,7 +137,7 @@ public class PluginOperateUtils { url.append("&seller=").append(2); break; default: - url.append("&seller=").append(""); + url.append("&seller=").append(StringUtils.EMPTY); } } if (StringUtils.isNotBlank(fee)) { @@ -228,48 +149,19 @@ public class PluginOperateUtils { url.append("&fee=").append(2); break; default: - url.append("&fee=").append(""); + url.append("&fee=").append(StringUtils.EMPTY); } } } - public static void getPluginCategories(final JSCallback jsCallback) { - - new Thread(new Runnable() { - @Override - public void run() { - String result; - String url = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.category"); - if (url != null) { - HttpClient httpClient = new HttpClient(url); - result = httpClient.getResponseText(); - } else { - result = PluginConstants.CONNECTION_404; - } - jsCallback.execute(result); - } - }).start(); - } - - public static void getPluginPrefix(final JSCallback jsCallback) { - - new Thread(new Runnable() { - @Override - public void run() { - String result = SiteCenter.getInstance().acquireUrlByKind("plugin.url.prefix"); - jsCallback.execute(result); - } - }).start(); - } - public static void getLoginInfo(JSCallback jsCallback, UILabel uiLabel) { String username = ConfigManager.getProviderInstance().getBbsUsername(); if (StringUtils.isEmpty(username)) { - jsCallback.execute(""); + jsCallback.execute(StringUtils.EMPTY); uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn")); } else { uiLabel.setText(username); - String result = username; + String result = username; jsCallback.execute(result); } } @@ -285,11 +177,11 @@ public class PluginOperateUtils { StringBuilder pluginInfo = new StringBuilder(); List pluginTaskResults = result.asList(); for (PluginTaskResult pluginTaskResult : pluginTaskResults) { - if(pluginInfo.length() != 0){ + if (pluginInfo.length() != 0) { pluginInfo.append("\n"); } PluginTask pluginTask = pluginTaskResult.getCurrentTask(); - if(pluginTask == null){ + if (pluginTask == null) { pluginInfo.append(PluginUtils.getMessageByErrorCode(pluginTaskResult.errorCode())); continue; } @@ -297,7 +189,7 @@ public class PluginOperateUtils { PluginContext pluginContext = PluginManager.getContext(pluginMarker); if (pluginContext != null) { pluginInfo.append(pluginContext.getName()).append(PluginUtils.getMessageByErrorCode(pluginTaskResult.errorCode())); - }else{ + } else { pluginInfo.append(pluginMarker.getPluginID()).append(PluginUtils.getMessageByErrorCode(pluginTaskResult.errorCode())); } } @@ -305,5 +197,4 @@ public class PluginOperateUtils { } - } diff --git a/designer_base/src/com/fr/design/extra/PluginTask.java b/designer_base/src/com/fr/design/extra/PluginTask.java index e2c87a46e1..f91001cc7e 100644 --- a/designer_base/src/com/fr/design/extra/PluginTask.java +++ b/designer_base/src/com/fr/design/extra/PluginTask.java @@ -9,6 +9,9 @@ import javafx.concurrent.Task; import javafx.scene.web.WebEngine; import netscape.javascript.JSObject; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + /** * 插件安装,卸载,更新等任务 * @@ -77,8 +80,23 @@ public class PluginTask extends Task { */ private String trimText(String old) { if (StringUtils.isNotBlank(old)) { - return old.replaceAll("\n", "").replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'"); + String b = filterHtmlTag(old); + return b.replaceAll("\\\\n", StringUtils.EMPTY).replaceAll("\\\\t", StringUtils.EMPTY).replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'").replaceAll("\\\\\\\\", "\\\\\\\\\\\\"); } return StringUtils.EMPTY; } + + /** + * 进行html标签过滤 + * @param origin 原始字符串 + * @return 处理之后的字符串 + */ + private String filterHtmlTag(String origin) { + String regHtml = "<[^>]+>"; + Pattern patternHtml = Pattern.compile(regHtml, Pattern.CASE_INSENSITIVE); + Matcher matchHtml = patternHtml.matcher(origin); + origin = matchHtml.replaceAll(StringUtils.EMPTY); + return origin; + } + } diff --git a/designer_base/src/com/fr/design/extra/PluginWebBridge.java b/designer_base/src/com/fr/design/extra/PluginWebBridge.java index 438deb9145..8f40280b1f 100644 --- a/designer_base/src/com/fr/design/extra/PluginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/PluginWebBridge.java @@ -5,8 +5,13 @@ import com.fr.base.FRContext; import com.fr.design.RestartHelper; import com.fr.design.bbs.BBSLoginUtils; import com.fr.design.dialog.UIDialog; +import com.fr.design.extra.exe.GetPluginCategoriesExecutor; +import com.fr.design.extra.exe.GetPluginFromStoreExecutor; import com.fr.design.extra.exe.PluginLoginExecutor; +import com.fr.design.extra.exe.ReadUpdateOnlineExecutor; +import com.fr.design.extra.exe.SearchOnlineExecutor; import com.fr.design.extra.exe.callback.JSCallback; +import com.fr.design.extra.exe.GetPluginPrefixExecutor; import com.fr.design.gui.ilable.UILabel; import com.fr.general.FRLogger; import com.fr.general.Inter; @@ -23,14 +28,20 @@ import javafx.scene.web.WebEngine; import javafx.stage.FileChooser; import javafx.stage.Stage; import netscape.javascript.JSObject; - -import javax.swing.*; -import java.awt.*; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; +import java.awt.Desktop; import java.io.File; import java.io.IOException; import java.net.URI; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; /** * 开放给Web组件的接口,用于安装,卸载,更新以及更改插件可用状态 @@ -48,6 +59,7 @@ public class PluginWebBridge { private UILabel uiLabel; + private ExecutorService threadPoolExecutor = Executors.newSingleThreadExecutor(); /** * 动作枚举 @@ -222,8 +234,8 @@ public class PluginWebBridge { * 已安装插件检查更新 */ public void readUpdateOnline(final JSObject callback) { - JSCallback jsCallback = new JSCallback(webEngine, callback); - PluginOperateUtils.readUpdateOnline(jsCallback); + Task task = new PluginTask<>(webEngine, callback, new ReadUpdateOnlineExecutor()); + threadPoolExecutor.submit(task); } /** @@ -306,8 +318,8 @@ public class PluginWebBridge { * @param keyword 关键字 */ public void searchPlugin(String keyword, final JSObject callback) { - JSCallback jsCallback = new JSCallback(webEngine, callback); - PluginOperateUtils.searchPlugin(keyword, jsCallback); + Task task = new PluginTask<>(webEngine, callback, new SearchOnlineExecutor(keyword)); + threadPoolExecutor.submit(task); } /** @@ -319,14 +331,14 @@ public class PluginWebBridge { * @param callback 回调函数 */ public void getPluginFromStore(String category, String seller, String fee, final JSObject callback) { - JSCallback jsCallback = new JSCallback(webEngine, callback); - PluginOperateUtils.getPluginFromStore(category, seller, fee, jsCallback); + Task task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(category, seller, fee)); + threadPoolExecutor.submit(task); } public void getPluginPrefix(final JSObject callback) { - JSCallback jsCallback = new JSCallback(webEngine, callback); - PluginOperateUtils.getPluginPrefix(jsCallback); + Task task = new PluginTask<>(webEngine, callback, new GetPluginPrefixExecutor()); + threadPoolExecutor.submit(task); } @@ -336,8 +348,8 @@ public class PluginWebBridge { * @param callback 回调函数 */ public void getPluginCategories(final JSObject callback) { - JSCallback jsCallback = new JSCallback(webEngine, callback); - PluginOperateUtils.getPluginCategories(jsCallback); + Task task = new PluginTask<>(webEngine, callback, new GetPluginCategoriesExecutor()); + threadPoolExecutor.submit(task); } /** @@ -502,7 +514,7 @@ public class PluginWebBridge { */ public void defaultLogin(String username, String password, final JSObject callback) { Task task = new PluginTask<>(webEngine, callback, new PluginLoginExecutor(username, password)); - new Thread(task).start(); + threadPoolExecutor.submit(task); } /** @@ -537,7 +549,7 @@ public class PluginWebBridge { * 初始化设计器部分 */ public void initExtraDiff(final JSObject callback) { - + //todo 初始化设计器其他部分 } /** diff --git a/designer_base/src/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java b/designer_base/src/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java new file mode 100644 index 0000000000..f517d0b65a --- /dev/null +++ b/designer_base/src/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java @@ -0,0 +1,42 @@ +package com.fr.design.extra.exe; + +import com.fr.design.extra.PluginConstants; +import com.fr.design.extra.Process; +import com.fr.general.SiteCenter; +import com.fr.general.http.HttpClient; + +/** + * Created by vito on 16/5/16. + */ +public class GetPluginCategoriesExecutor implements Executor { + private String result = "[]"; + + @Override + public String getTaskFinishMessage() { + return result; + } + + @Override + public Command[] getCommands() { + return new Command[]{ + new Command() { + @Override + public String getExecuteMessage() { + return null; + } + + @Override + public void run(Process process) { + String url = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.category"); + if (url != null) { + HttpClient httpClient = new HttpClient(url); + result = httpClient.getResponseText(); + } else { + result = PluginConstants.CONNECTION_404; + } + + } + } + }; + } +} diff --git a/designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java b/designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java new file mode 100644 index 0000000000..123c3ceed3 --- /dev/null +++ b/designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java @@ -0,0 +1,75 @@ +package com.fr.design.extra.exe; + +import com.fr.design.extra.PluginConstants; +import com.fr.design.extra.PluginOperateUtils; +import com.fr.design.extra.PluginUtils; +import com.fr.design.extra.Process; +import com.fr.general.FRLogger; +import com.fr.general.SiteCenter; +import com.fr.general.http.HttpClient; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.stable.StringUtils; + +/** + * Created by vito on 16/4/18. + * 获取插件分类信息 + */ +public class GetPluginFromStoreExecutor implements Executor { + private String result = "[]"; + private String category; + private String seller; + private String fee; + + public GetPluginFromStoreExecutor(String category, String seller, String fee) { + this.category = category; + this.seller = seller; + this.fee = fee; + } + + @Override + public String getTaskFinishMessage() { + return result; + } + + @Override + public Command[] getCommands() { + return new Command[]{ + new Command() { + @Override + public String getExecuteMessage() { + return StringUtils.EMPTY; + } + + @Override + public void run(Process process) { + String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.plist") + "?"; + boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee); + if (getRecommend) { + result = PluginOperateUtils.getRecommendPlugins(); + return; + } + + if (StringUtils.isNotBlank(plistUrl)) { + StringBuilder url = new StringBuilder(); + url.append(plistUrl); + PluginOperateUtils.dealParams(url, category, seller, fee); + try { + HttpClient httpClient = new HttpClient(url.toString()); + httpClient.asGet(); + String responseText = httpClient.getResponseText(); + JSONObject resultJSONObject = new JSONObject(responseText); + JSONArray resultArr = resultJSONObject.getJSONArray("result"); + JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(resultArr); + result = resultJSONArray.toString(); + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage()); + } + } else { + result = PluginConstants.CONNECTION_404; + } + } + } + }; + } +} diff --git a/designer_base/src/com/fr/design/extra/exe/GetPluginPrefixExecutor.java b/designer_base/src/com/fr/design/extra/exe/GetPluginPrefixExecutor.java new file mode 100644 index 0000000000..31b4e2d3f4 --- /dev/null +++ b/designer_base/src/com/fr/design/extra/exe/GetPluginPrefixExecutor.java @@ -0,0 +1,35 @@ +package com.fr.design.extra.exe; + +import com.fr.design.extra.Process; +import com.fr.general.SiteCenter; +import com.fr.stable.StringUtils; + +/** + * Created by kerry on 2017/11/3. + */ +public class GetPluginPrefixExecutor implements Executor { + private String result = StringUtils.EMPTY; + + @Override + public String getTaskFinishMessage() { + return result; + } + + @Override + public Command[] getCommands() { + return new Command[]{ + new Command() { + @Override + public String getExecuteMessage() { + return null; + } + + @Override + public void run(Process process) { + result = SiteCenter.getInstance().acquireUrlByKind("plugin.url.prefix"); + } + } + }; + } +} + diff --git a/designer_base/src/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java b/designer_base/src/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java new file mode 100644 index 0000000000..303d8aee7b --- /dev/null +++ b/designer_base/src/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java @@ -0,0 +1,51 @@ +package com.fr.design.extra.exe; + +import com.fr.design.extra.PluginsReaderFromStore; +import com.fr.design.extra.Process; +import com.fr.general.FRLogger; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.view.PluginView; +import com.fr.stable.StringUtils; + +import java.util.List; + +/** + * Created by vito on 16/4/19. + */ +public class ReadUpdateOnlineExecutor implements Executor { + private String result = StringUtils.EMPTY; + + @Override + public String getTaskFinishMessage() { + return result; + } + + @Override + public Command[] getCommands() { + return new Command[]{ + new Command() { + @Override + public String getExecuteMessage() { + return StringUtils.EMPTY; + } + + @Override + public void run(Process process) { + try { + List plugins = PluginsReaderFromStore.readPluginsForUpdate(); + JSONArray jsonArray = new JSONArray(); + for (PluginView plugin : plugins) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("pluginid", plugin.getID()); + jsonArray.put(jsonObject); + } + result = jsonArray.toString(); + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage()); + } + } + } + }; + } +} diff --git a/designer_base/src/com/fr/design/extra/exe/SearchOnlineExecutor.java b/designer_base/src/com/fr/design/extra/exe/SearchOnlineExecutor.java new file mode 100644 index 0000000000..c46dd5d4e2 --- /dev/null +++ b/designer_base/src/com/fr/design/extra/exe/SearchOnlineExecutor.java @@ -0,0 +1,59 @@ +package com.fr.design.extra.exe; + +import com.fr.design.extra.PluginOperateUtils; +import com.fr.design.extra.PluginUtils; +import com.fr.design.extra.Process; +import com.fr.general.FRLogger; +import com.fr.general.SiteCenter; +import com.fr.general.http.HttpClient; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.stable.StringUtils; + +/** + * Created by vito on 16/4/18. + */ +public class SearchOnlineExecutor implements Executor { + private String result = StringUtils.EMPTY; + private String keyword; + + public SearchOnlineExecutor(String keyword) { + this.keyword = keyword; + } + + @Override + public String getTaskFinishMessage() { + return result; + } + + @Override + public Command[] getCommands() { + return new Command[]{ + new Command() { + @Override + public String getExecuteMessage() { + return StringUtils.EMPTY; + } + + @Override + public void run(Process process) { + try { + if (StringUtils.isBlank(keyword)) { + result = PluginOperateUtils.getRecommendPlugins(); + return; + } + HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("shop.plugin.store") + "&keyword=" + keyword); + httpClient.asGet(); + String responseText = httpClient.getResponseText(); + JSONObject jsonObject = new JSONObject(responseText); + JSONArray jsonArray = jsonObject.getJSONArray("result"); + JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(jsonArray); + result = resultJSONArray.toString(); + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage()); + } + } + } + }; + } +} diff --git a/designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java b/designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java index c246ebfa8f..d01446ee01 100644 --- a/designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java +++ b/designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java @@ -63,7 +63,7 @@ public class JSCallback { private String trimText(String old) { if (StringUtils.isNotBlank(old)) { String b = filterHtmlTag(old); - return b.replaceAll("\\\\n", "").replaceAll("\\\\t", "").replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'").replaceAll("\\\\\\\\", "\\\\\\\\\\\\"); + return b.replaceAll("\\\\n", StringUtils.EMPTY).replaceAll("\\\\t", StringUtils.EMPTY).replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'").replaceAll("\\\\\\\\", "\\\\\\\\\\\\"); } return StringUtils.EMPTY; } @@ -74,14 +74,12 @@ public class JSCallback { * @return 处理之后的字符串 */ private String filterHtmlTag(String origin) { - String regEx_html = "<[^>]+>"; - Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE); - Matcher m_html = p_html.matcher(origin); - origin = m_html.replaceAll(""); + String regHtml = "<[^>]+>"; + Pattern patternHtml = Pattern.compile(regHtml, Pattern.CASE_INSENSITIVE); + Matcher matchHtml = patternHtml.matcher(origin); + origin = matchHtml.replaceAll(StringUtils.EMPTY); return origin; } - - }