Browse Source
先传一波代码 1、拆分了rpc部分和channel部分 2、http channel写完好了 后续处理: 1、netty channel 2、gzip传输 3、图表地图资源太大导致图表卡的问题 4、其他性能优化 5、代码质量调整research/10.0
ju
6 years ago
6 changed files with 21 additions and 360 deletions
@ -1,185 +0,0 @@
|
||||
//package com.fr.env;
|
||||
//
|
||||
//import com.fr.design.beans.BasicBeanPane;
|
||||
//import com.fr.design.border.UITitledBorder;
|
||||
//import com.fr.design.env.DesignerWorkspaceInfo;
|
||||
//import com.fr.design.env.DesignerWorkspaceType;
|
||||
//import com.fr.design.gui.ibutton.UIButton;
|
||||
//import com.fr.design.gui.ilable.UILabel;
|
||||
//import com.fr.design.gui.ipasswordfield.UIPassWordField;
|
||||
//import com.fr.design.gui.itextfield.UIIntNumberField;
|
||||
//import com.fr.design.gui.itextfield.UITextField;
|
||||
//import com.fr.design.layout.TableLayout;
|
||||
//import com.fr.design.layout.TableLayoutHelper;
|
||||
//import com.fr.design.utils.gui.GUICoreUtils;
|
||||
//
|
||||
//import com.fr.workspace.WorkContext;
|
||||
//import com.fr.workspace.connect.WorkspaceConnection;
|
||||
//
|
||||
//import javax.swing.*;
|
||||
//import javax.swing.border.EmptyBorder;
|
||||
//import java.awt.*;
|
||||
//import java.awt.event.ActionEvent;
|
||||
//import java.awt.event.ActionListener;
|
||||
//import java.awt.event.WindowAdapter;
|
||||
//import java.awt.event.WindowEvent;
|
||||
//
|
||||
///**
|
||||
// * 远程环境设置界面,暂时命名为2,待做完功能直接替代掉老的RemoteEnvPane
|
||||
// */
|
||||
//public class RemoteEnvPane2 extends BasicBeanPane<DesignerWorkspaceInfo> {
|
||||
//
|
||||
// private UITextField urlTextField;
|
||||
// private UITextField usernameTextField;
|
||||
// private UIPassWordField passwordTextField;
|
||||
// private JDialog dialog;
|
||||
// private UILabel message;
|
||||
// private UIButton okButton;
|
||||
// private UIButton cancelButton;
|
||||
//
|
||||
// public RemoteEnvPane2() {
|
||||
// initComponents();
|
||||
// }
|
||||
//
|
||||
// private void initComponents() {
|
||||
// setLayout(new BorderLayout());
|
||||
//
|
||||
// JPanel contentPanel = new JPanel(new BorderLayout());
|
||||
// add(contentPanel, BorderLayout.CENTER);
|
||||
//
|
||||
// contentPanel.setBorder(
|
||||
// BorderFactory.createCompoundBorder(
|
||||
// new EmptyBorder(6, 0, 0, 0),
|
||||
// UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Basic_Remote_Env_Config")))
|
||||
// );
|
||||
//
|
||||
// double p = TableLayout.PREFERRED;
|
||||
// double f = TableLayout.FILL;
|
||||
// double[] rowSize = new double[]{p, p, p, p};
|
||||
// double[] columnSize = new double[]{p, f};
|
||||
// UIButton testConnectionButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Basic_Remote_Env_Try"));
|
||||
// urlTextField = new UITextField();
|
||||
// urlTextField.setPlaceholder("http://192.168.100.200/webroot/decision");
|
||||
// JPanel valuePane = TableLayoutHelper.createTableLayoutPane(
|
||||
// new Component[][]{
|
||||
// {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Basic_Remote_Env_Host") + ":", SwingConstants.RIGHT), urlTextField},
|
||||
// {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Basic_Remote_Env_User") + ":", SwingConstants.RIGHT), usernameTextField = new UITextField()},
|
||||
// {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Basic_Remote_Env_Password") + ":", SwingConstants.RIGHT), passwordTextField = new UIPassWordField()},
|
||||
// {null, GUICoreUtils.createFlowPane(testConnectionButton, FlowLayout.LEFT)}
|
||||
// },
|
||||
// rowSize, columnSize
|
||||
// );
|
||||
// testConnectionButton.addActionListener(new ActionListener() {
|
||||
// @Override
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// tryConnectRemoteEnv();
|
||||
// }
|
||||
// });
|
||||
// contentPanel.add(valuePane, BorderLayout.CENTER);
|
||||
//
|
||||
// message = new UILabel();
|
||||
// okButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("OK"));
|
||||
// cancelButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Cancel"));
|
||||
// }
|
||||
//
|
||||
// private void tryConnectRemoteEnv() {
|
||||
// final SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
|
||||
//
|
||||
// @Override
|
||||
// protected Void doInBackground() throws Exception {
|
||||
//
|
||||
// final DesignerWorkspaceInfo remoteEnv = updateBean();
|
||||
// WorkContext.getConnector().testConnection(remoteEnv.getConnection());
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void done() {
|
||||
// okButton.setEnabled(true);
|
||||
// try {
|
||||
// get();
|
||||
// message.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Basic_Remote_Connect_Successful"));
|
||||
// } catch (Exception e) {
|
||||
// message.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Basic_Remote_Connect_Failed"));
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
// worker.execute();
|
||||
// initMessageDialog();
|
||||
// okButton.addActionListener(new ActionListener() {
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// dialog.dispose();
|
||||
// }
|
||||
// });
|
||||
// cancelButton.addActionListener(new ActionListener() {
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// dialog.dispose();
|
||||
// worker.cancel(true);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// dialog.addWindowListener(new WindowAdapter() {
|
||||
// public void windowClosed(WindowEvent e) {
|
||||
// worker.cancel(true);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// dialog.setVisible(true);
|
||||
// dialog.dispose();
|
||||
// }
|
||||
//
|
||||
// private void initMessageDialog() {
|
||||
// message.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Basic_Remote_Env_Try") + "...");
|
||||
// message.setBorder(BorderFactory.createEmptyBorder(8, 5, 0, 0));
|
||||
// okButton.setEnabled(false);
|
||||
//
|
||||
// dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(RemoteEnvPane2.this), com.fr.design.i18n.Toolkit.i18nText("Datasource-Test_Connection"), true);
|
||||
//
|
||||
// dialog.setSize(new Dimension(268, 118));
|
||||
// okButton.setEnabled(false);
|
||||
// JPanel jp = new JPanel();
|
||||
// JPanel upPane = new JPanel();
|
||||
// JPanel downPane = new JPanel();
|
||||
// UILabel uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon"));
|
||||
// upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
|
||||
// upPane.add(uiLabel);
|
||||
// upPane.add(message);
|
||||
// downPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0));
|
||||
// downPane.add(okButton);
|
||||
// downPane.add(cancelButton);
|
||||
// jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
|
||||
// jp.add(upPane);
|
||||
// jp.add(downPane);
|
||||
// dialog.add(jp);
|
||||
// dialog.setResizable(false);
|
||||
// dialog.setLocationRelativeTo(SwingUtilities.getWindowAncestor(RemoteEnvPane2.this));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected String title4PopupWindow() {
|
||||
// return "RemoteEnv";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void populateBean(DesignerWorkspaceInfo config) {
|
||||
// if (config == null) {
|
||||
// return;
|
||||
// }
|
||||
// WorkspaceConnection connection = config.getConnection();
|
||||
// if (connection != null) {
|
||||
// urlTextField.setText(connection.getUrl());
|
||||
// usernameTextField.setText(connection.getUserName());
|
||||
// passwordTextField.setText(connection.getPassword());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public DesignerWorkspaceInfo updateBean() {
|
||||
//
|
||||
// DesignerWorkspaceInfo config = new DesignerWorkspaceInfo();
|
||||
// WorkspaceConnection connection = new WorkspaceConnection(urlTextField.getText(), usernameTextField.getText(), passwordTextField.getText());
|
||||
// config.setConnection(connection);
|
||||
// config.setType(DesignerWorkspaceType.Remote);
|
||||
// return config;
|
||||
// }
|
||||
//}
|
@ -1,167 +0,0 @@
|
||||
//package com.fr.env;
|
||||
//
|
||||
//import com.fr.base.EnvException;
|
||||
//import com.fr.base.FRContext;
|
||||
//import com.fr.report.DesignAuthority;
|
||||
//import com.fr.report.util.AuthorityXMLUtils;
|
||||
//import com.fr.stable.EncodeConstants;
|
||||
//import com.fr.third.org.apache.commons.io.IOUtils;
|
||||
//import com.fr.third.org.apache.http.HttpResponse;
|
||||
//import com.fr.third.org.apache.http.HttpStatus;
|
||||
//import com.fr.third.org.apache.http.client.ClientProtocolException;
|
||||
//import com.fr.third.org.apache.http.client.ResponseHandler;
|
||||
//import com.fr.third.org.apache.http.client.methods.HttpUriRequest;
|
||||
//import com.fr.third.org.apache.http.client.methods.RequestBuilder;
|
||||
//import com.fr.third.org.apache.http.entity.ContentType;
|
||||
//import com.fr.third.org.apache.http.entity.InputStreamEntity;
|
||||
//import com.fr.third.org.apache.http.impl.client.CloseableHttpClient;
|
||||
//import com.fr.third.org.apache.http.impl.client.HttpClients;
|
||||
//
|
||||
//import java.io.ByteArrayInputStream;
|
||||
//import java.io.ByteArrayOutputStream;
|
||||
//import java.io.IOException;
|
||||
//import java.io.InputStream;
|
||||
//import java.net.URLEncoder;
|
||||
//import java.util.Map;
|
||||
//
|
||||
//public class RemoteEnvUtils {
|
||||
//
|
||||
// private RemoteEnvUtils() {
|
||||
// }
|
||||
//
|
||||
// private static ResponseHandler<InputStream> responseHandler = new ResponseHandler<InputStream>() {
|
||||
// @Override
|
||||
// public InputStream handleResponse(HttpResponse response) throws IOException {
|
||||
// int statusCode = response.getStatusLine().getStatusCode();
|
||||
// if (statusCode != HttpStatus.SC_OK) {
|
||||
// throw new ClientProtocolException("Method failed: " + response.getStatusLine().toString());
|
||||
// }
|
||||
// InputStream in = response.getEntity().getContent();
|
||||
// if (in == null) {
|
||||
// return null;
|
||||
// }
|
||||
// // 读取并返回
|
||||
// ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
// IOUtils.copy(in, out);
|
||||
// return new ByteArrayInputStream(out.toByteArray());
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// public static InputStream simulateRPCByHttpPost(byte[] bytes, Map<String, String> parameters, boolean isSignIn, RemoteEnv env) throws EnvException {
|
||||
// String path = env.getPath();
|
||||
// RequestBuilder builder = RequestBuilder.post(path);
|
||||
//
|
||||
// InputStream inputStream = null;
|
||||
//
|
||||
// for (Map.Entry<String, String> entry : parameters.entrySet()) {
|
||||
// builder.addParameter(entry.getKey(), entry.getValue());
|
||||
// }
|
||||
// if (!isSignIn) {
|
||||
// builder.addParameter("id", env.getUserID());
|
||||
// }
|
||||
// InputStreamEntity reqEntity = new InputStreamEntity(new ByteArrayInputStream(bytes));
|
||||
//
|
||||
// try (CloseableHttpClient httpClient = HttpClients.createSystem()) {
|
||||
// HttpUriRequest request = builder
|
||||
// .setEntity(reqEntity)
|
||||
// .build();
|
||||
// inputStream = httpClient.execute(request, responseHandler);
|
||||
// } catch (IOException e) {
|
||||
// FRContext.getLogger().error(e.getMessage(), e);
|
||||
// }
|
||||
// return inputStream;
|
||||
// }
|
||||
//
|
||||
// public static InputStream simulateRPCByHttpPost(Map<String, String> parameters, boolean isSignIn, RemoteEnv env) throws EnvException {
|
||||
// String path = env.getPath();
|
||||
// RequestBuilder builder = RequestBuilder.post(path);
|
||||
//
|
||||
// InputStream inputStream = null;
|
||||
//
|
||||
// for (Map.Entry<String, String> entry : parameters.entrySet()) {
|
||||
// builder.addParameter(entry.getKey(), entry.getValue());
|
||||
// }
|
||||
// if (!isSignIn) {
|
||||
// builder.addParameter("id", env.getUserID());
|
||||
// }
|
||||
//
|
||||
// try (CloseableHttpClient httpClient = HttpClients.createSystem()) {
|
||||
// HttpUriRequest request = builder
|
||||
// .build();
|
||||
// inputStream = httpClient.execute(request, responseHandler);
|
||||
// } catch (IOException e) {
|
||||
// FRContext.getLogger().error(e.getMessage(), e);
|
||||
// }
|
||||
// return inputStream;
|
||||
// }
|
||||
//
|
||||
// public static InputStream simulateRPCByHttpGet(Map<String, String> parameters, boolean isSignIn, RemoteEnv env) throws EnvException {
|
||||
// String path = env.getPath();
|
||||
// RequestBuilder builder = RequestBuilder.get(path);
|
||||
//
|
||||
// InputStream inputStream = null;
|
||||
//
|
||||
// for (Map.Entry<String, String> entry : parameters.entrySet()) {
|
||||
// builder.addParameter(entry.getKey(), entry.getValue());
|
||||
// }
|
||||
// if (!isSignIn) {
|
||||
// builder.addParameter("id", env.getUserID());
|
||||
// }
|
||||
// try (CloseableHttpClient httpClient = HttpClients.createSystem()) {
|
||||
// HttpUriRequest request = builder.build();
|
||||
// inputStream = httpClient.execute(request, responseHandler);
|
||||
//
|
||||
// } catch (IOException e) {
|
||||
// FRContext.getLogger().error(e.getMessage(), e);
|
||||
// }
|
||||
// return inputStream;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public static InputStream updateAuthorities(DesignAuthority[] authorities, RemoteEnv env) {
|
||||
// String path = env.getPath();
|
||||
// // 远程设计临时用户id
|
||||
// String userID = env.getUserID();
|
||||
// InputStream inputStream = null;
|
||||
//
|
||||
// ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
// AuthorityXMLUtils.writeDesignAuthoritiesXML(authorities, outputStream);
|
||||
// InputStreamEntity reqEntity = new InputStreamEntity(new ByteArrayInputStream(outputStream.toByteArray()), ContentType.TEXT_XML);
|
||||
//
|
||||
// try (CloseableHttpClient httpClient = HttpClients.createSystem()) {
|
||||
// HttpUriRequest request = RequestBuilder.post(path)
|
||||
// .addParameter("id", userID)
|
||||
// .addParameter("op", "remote_design_authority")
|
||||
// .addParameter("cmd", "update_authorities")
|
||||
// .setEntity(reqEntity)
|
||||
// .build();
|
||||
// inputStream = httpClient.execute(request, responseHandler);
|
||||
// } catch (IOException e) {
|
||||
// FRContext.getLogger().error(e.getMessage(), e);
|
||||
// }
|
||||
//
|
||||
// return inputStream;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public static InputStream getAuthorities(RemoteEnv env) throws EnvException {
|
||||
// String path = env.getPath();
|
||||
// // 远程设计临时用户id
|
||||
// String userID = env.getUserID();
|
||||
// InputStream inputStream = null;
|
||||
//
|
||||
// try (CloseableHttpClient httpClient = HttpClients.createSystem();) {
|
||||
// HttpUriRequest request = RequestBuilder.get(path)
|
||||
// .addParameter("id", userID)
|
||||
// .addParameter("op", "remote_design_authority")
|
||||
// .addParameter("cmd", "get_authorities")
|
||||
// .build();
|
||||
// inputStream = httpClient.execute(request, responseHandler);
|
||||
// } catch (IOException e) {
|
||||
// FRContext.getLogger().error(e.getMessage(), e);
|
||||
// }
|
||||
// return inputStream;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
Loading…
Reference in new issue