Package org.apache.jmeter.samplers

Examples of org.apache.jmeter.samplers.Cookie


    if (command.equals("Edit")) {
                    index = cookieTable.getSelectedRow();
                    if (index < 0) {
                        valid = false;
                    } else {
                        Cookie c = manager.get(index);
                        nameField = new JTextField(c.getName(), 20);
                        valueField = new JTextField(c.getValue(), 20);
                        domainField = new JTextField(c.getDomain(), 20);
                        pathField = new JTextField(c.getPath(), 20);
                        secureCheck = new JCheckBox("Secure", c.getSecure());
                        expiresField = new JTextField(new Long(c.getExpires()).toString(), 20);
                        ok = new JButton("Ok");
                        cancel = new JButton("Cancel");
                    }
                } else if (command.equals("Add")) {
                    nameField = new JTextField(20);
                    valueField = new JTextField(20);
                    domainField = new JTextField(20);
                    pathField = new JTextField(20);
                    secureCheck = new JCheckBox("Secure");
                    expiresField = new JTextField(20);
                    ok = new JButton("Ok");
                    cancel = new JButton("Cancel");
                }
    if (valid) {
                    if (updateDialog != null) {
                        updateDialog.dispose();
                    }
                    updateDialog = new JDialog();
                    updateDialog.setSize(350, 300);

                    ok.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            int i = index;
                            Cookie c = new Cookie();
                            if (i >= 0) {
                                c = manager.get(index);
                            }
                            c.setName(nameField.getText());
                            c.setValue(valueField.getText());
                            c.setDomain(domainField.getText());
                            c.setPath(pathField.getText());
                            c.setSecure(secureCheck.isSelected());
                            try {
                                c.setExpires(Long.parseLong(expiresField.getText()));
                            } catch (NumberFormatException ex) {
                                c.setExpires(0);
                            }
                            if (i < 0) {
                                manager.add(c);
                            }
                            updateDialog.dispose();
View Full Code Here

TOP

Related Classes of org.apache.jmeter.samplers.Cookie

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.