View | Details | Raw Unified | Return to bug 53755
Collapse All | Expand All

(-)src/core/org/apache/jmeter/resources/messages_fr.properties (-1 / +3 lines)
Lines 177-184 Link Here
177
constant_timer_title=Compteur de temps fixe
177
constant_timer_title=Compteur de temps fixe
178
content_encoding=Encodage contenu \:
178
content_encoding=Encodage contenu \:
179
controller=Contr\u00F4leur
179
controller=Contr\u00F4leur
180
cookie_manager_policy=Politique des cookies
180
cookie_implementation_choose=Impl\u00E9mentation \:
181
cookie_manager_policy=Politique des cookies \:
181
cookie_manager_title=Gestionnaire de cookies HTTP
182
cookie_manager_title=Gestionnaire de cookies HTTP
183
cookie_options=Options
182
cookies_stored=Cookies stock\u00E9s
184
cookies_stored=Cookies stock\u00E9s
183
copy=Copier
185
copy=Copier
184
counter_config_title=Compteur
186
counter_config_title=Compteur
(-)src/core/org/apache/jmeter/resources/messages.properties (-1 / +3 lines)
Lines 183-190 Link Here
183
constant_timer_title=Constant Timer
183
constant_timer_title=Constant Timer
184
content_encoding=Content encoding\:
184
content_encoding=Content encoding\:
185
controller=Controller
185
controller=Controller
186
cookie_manager_policy=Cookie Policy
186
cookie_implementation_choose=Implementation:
187
cookie_manager_policy=Cookie Policy:
187
cookie_manager_title=HTTP Cookie Manager
188
cookie_manager_title=HTTP Cookie Manager
189
cookie_options=Options
188
cookies_stored=User-Defined Cookies
190
cookies_stored=User-Defined Cookies
189
copy=Copy
191
copy=Copy
190
counter_config_title=Counter
192
counter_config_title=Counter
(-)src/protocol/http/org/apache/jmeter/protocol/http/control/HC4CookieHandler.java (+211 lines)
Line 0 Link Here
1
/* 
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 * 
9
 *   http://www.apache.org/licenses/LICENSE-2.0
10
 * 
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed  under the  License is distributed on an "AS IS" BASIS,
13
 * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
14
 * implied.
15
 * 
16
 * See the License for the specific language governing permissions and
17
 * limitations under the License.
18
 */
19
20
package org.apache.jmeter.protocol.http.control;
21
22
import java.net.URL;
23
import java.util.ArrayList;
24
import java.util.Date;
25
import java.util.List;
26
27
import org.apache.http.Header;
28
import org.apache.http.client.params.CookiePolicy;
29
import org.apache.http.cookie.CookieOrigin;
30
import org.apache.http.cookie.CookieSpec;
31
import org.apache.http.cookie.CookieSpecRegistry;
32
import org.apache.http.cookie.MalformedCookieException;
33
import org.apache.http.impl.cookie.BasicClientCookie;
34
import org.apache.http.impl.cookie.BestMatchSpecFactory;
35
import org.apache.http.impl.cookie.BrowserCompatSpecFactory;
36
import org.apache.http.impl.cookie.IgnoreSpecFactory;
37
import org.apache.http.impl.cookie.NetscapeDraftSpecFactory;
38
import org.apache.http.impl.cookie.RFC2109SpecFactory;
39
import org.apache.http.impl.cookie.RFC2965SpecFactory;
40
import org.apache.http.message.BasicHeader;
41
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
42
import org.apache.jmeter.protocol.http.util.HTTPConstants;
43
import org.apache.jmeter.testelement.property.CollectionProperty;
44
import org.apache.jmeter.testelement.property.PropertyIterator;
45
import org.apache.jorphan.logging.LoggingManager;
46
import org.apache.log.Logger;
47
48
public class HC4CookieHandler implements CookieHandler {
49
    private static final Logger log = LoggingManager.getLoggerForClass();
50
    
51
    private transient CookieSpec cookieSpec;
52
    
53
    private static CookieSpecRegistry registry  = new CookieSpecRegistry();
54
55
    static {
56
        registry.register(CookiePolicy.BEST_MATCH, new BestMatchSpecFactory());
57
        registry.register(CookiePolicy.BROWSER_COMPATIBILITY, new BrowserCompatSpecFactory());
58
        registry.register(CookiePolicy.RFC_2109, new RFC2109SpecFactory());
59
        registry.register(CookiePolicy.RFC_2965, new RFC2965SpecFactory());
60
        registry.register(CookiePolicy.IGNORE_COOKIES, new IgnoreSpecFactory());
61
        registry.register(CookiePolicy.NETSCAPE, new NetscapeDraftSpecFactory());
62
    }
63
64
    public HC4CookieHandler(String policy) {
65
        super();
66
        if (policy.equals(org.apache.commons.httpclient.cookie.CookiePolicy.DEFAULT)) { // tweak diff HC3 vs HC4
67
            policy = CookiePolicy.BEST_MATCH;
68
        }
69
        this.cookieSpec = registry.getCookieSpec(policy);
70
    }
71
72
    public void addCookieFromHeader(CookieManager cookieManager,
73
            boolean checkCookies, String cookieHeader, URL url) {
74
            boolean debugEnabled = log.isDebugEnabled();
75
            if (debugEnabled) {
76
                log.debug("Received Cookie: " + cookieHeader + " From: " + url.toExternalForm());
77
            }
78
            String protocol = url.getProtocol();
79
            String host = url.getHost();
80
            int port= HTTPSamplerBase.getDefaultPort(protocol,url.getPort());
81
            String path = url.getPath();
82
            boolean isSecure=HTTPSamplerBase.isSecure(protocol);
83
84
            List<org.apache.http.cookie.Cookie> cookies = null;
85
            
86
            CookieOrigin cookieOrigin = new CookieOrigin(host, port, path, isSecure);
87
            BasicHeader basicHeader = new BasicHeader(HTTPConstants.HEADER_SET_COOKIE, cookieHeader);
88
89
            try {
90
                cookies = cookieSpec.parse(basicHeader, cookieOrigin);
91
            } catch (MalformedCookieException e) {
92
                log.error("Unable to add the cookie", e);
93
            }
94
            if (cookies == null) {
95
                return;
96
            }
97
            for (org.apache.http.cookie.Cookie cookie : cookies) {
98
                try {
99
                    if (checkCookies) {
100
                        cookieSpec.validate(cookie, cookieOrigin);
101
                    }
102
                    Date expiryDate = cookie.getExpiryDate();
103
                    long exp = 0;
104
                    if (expiryDate!= null) {
105
                        exp=expiryDate.getTime();
106
                    }
107
                    Cookie newCookie = new Cookie(
108
                            cookie.getName(),
109
                            cookie.getValue(),
110
                            cookie.getDomain(),
111
                            cookie.getPath(),
112
                            cookie.isSecure(),
113
                            exp / 1000
114
                            );
115
116
                    // Store session cookies as well as unexpired ones
117
                    if (exp == 0 || exp >= System.currentTimeMillis()) {
118
                        newCookie.setVersion(cookie.getVersion());
119
                        cookieManager.add(newCookie); // Has its own debug log; removes matching cookies
120
                    } else {
121
                        cookieManager.removeMatchingCookies(newCookie);
122
                        if (debugEnabled){
123
                            log.info("Dropping expired Cookie: "+newCookie.toString());
124
                        }
125
                    }
126
                } catch (MalformedCookieException e) { // This means the cookie was wrong for the URL
127
                    log.warn("Not storing invalid cookie: <"+cookieHeader+"> for URL "+url+" ("+e.getLocalizedMessage()+")");
128
                } catch (IllegalArgumentException e) {
129
                    log.warn(cookieHeader+e.getLocalizedMessage());
130
                }
131
            }
132
    }
133
134
    public String getCookieHeaderForURL(CollectionProperty cookiesCP, URL url,
135
            boolean allowVariableCookie) {
136
        List<org.apache.http.cookie.Cookie> c = 
137
                getCookiesForUrl(cookiesCP, url, allowVariableCookie);
138
        
139
        boolean debugEnabled = log.isDebugEnabled();
140
        if (debugEnabled){
141
            log.debug("Found "+c.size()+" cookies for "+url.toExternalForm());
142
        }
143
        if (c.size() <= 0) {
144
            return null;
145
        }
146
        List<Header> lstHdr = cookieSpec.formatCookies(c);
147
        
148
        StringBuilder sbHdr = new StringBuilder();
149
        for (Header header : lstHdr) {
150
            sbHdr.append(header.getValue());
151
        }
152
153
        return sbHdr.toString();
154
    }
155
156
    /**
157
     * Get array of valid HttpClient cookies for the URL
158
     *
159
     * @param url the target URL
160
     * @return array of HttpClient cookies
161
     *
162
     */
163
    List<org.apache.http.cookie.Cookie> getCookiesForUrl(
164
            CollectionProperty cookiesCP, URL url, boolean allowVariableCookie) {
165
        List<org.apache.http.cookie.Cookie> cookies = new ArrayList<org.apache.http.cookie.Cookie>();
166
167
        for (PropertyIterator iter = cookiesCP.iterator(); iter.hasNext();) {
168
            Cookie jmcookie = (Cookie) iter.next().getObjectValue();
169
            // Set to running version, to allow function evaluation for the cookie values (bug 28715)
170
            if (allowVariableCookie) {
171
                jmcookie.setRunningVersion(true);
172
            }
173
            cookies.add(makeCookie(jmcookie));
174
            if (allowVariableCookie) {
175
                jmcookie.setRunningVersion(false);
176
            }
177
        }
178
        String host = url.getHost();
179
        String protocol = url.getProtocol();
180
        int port = HTTPSamplerBase.getDefaultPort(protocol, url.getPort());
181
        String path = url.getPath();
182
        boolean secure = HTTPSamplerBase.isSecure(protocol);
183
184
        CookieOrigin cookieOrigin = new CookieOrigin(host, port, path, secure);
185
186
        List<org.apache.http.cookie.Cookie> cookiesValid = new ArrayList<org.apache.http.cookie.Cookie>();
187
        for (org.apache.http.cookie.Cookie cookie : cookies) {
188
            if (cookieSpec.match(cookie, cookieOrigin)) {
189
                cookiesValid.add(cookie);
190
            }
191
        }
192
193
        return cookiesValid;
194
    }
195
    
196
    /**
197
     * Create an HttpClient cookie from a JMeter cookie
198
     */
199
    private org.apache.http.cookie.Cookie makeCookie(Cookie jmc) {
200
        long exp = jmc.getExpiresMillis();
201
        BasicClientCookie ret = new BasicClientCookie(jmc.getName(),
202
                jmc.getValue());
203
204
        ret.setDomain(jmc.getDomain());
205
        ret.setPath(jmc.getPath());
206
        ret.setExpiryDate(exp > 0 ? new Date(exp) : null); // use null for no expiry
207
        ret.setSecure(jmc.getSecure());
208
        ret.setVersion(jmc.getVersion());
209
        return ret;
210
    }
211
}
(-)src/jorphan/org/apache/jorphan/reflect/ClassTools.java (+31 lines)
Lines 18-23 Link Here
18
18
19
package org.apache.jorphan.reflect;
19
package org.apache.jorphan.reflect;
20
20
21
import java.lang.reflect.Constructor;
21
import java.lang.reflect.InvocationTargetException;
22
import java.lang.reflect.InvocationTargetException;
22
import java.lang.reflect.Method;
23
import java.lang.reflect.Method;
23
24
Lines 80-85 Link Here
80
    }
81
    }
81
82
82
    /**
83
    /**
84
     * Call a class constructor with an String parameter
85
     * @param className
86
     * @param parameter (String)
87
     * @return an instance of the class
88
     * @throws JMeterException if class cannot be created
89
     */
90
    public static Object construct(String className, String parameter)
91
            throws JMeterException {
92
        Object instance = null;
93
        try {
94
            Class<?> clazz = Class.forName(className);
95
            Constructor<?> constructor = clazz.getConstructor(String.class);
96
            instance = constructor.newInstance(parameter);
97
        } catch (ClassNotFoundException e) {
98
            throw new JMeterException(e);
99
        } catch (InstantiationException e) {
100
            throw new JMeterException(e);
101
        } catch (IllegalAccessException e) {
102
            throw new JMeterException(e);
103
        } catch (NoSuchMethodException e) {
104
            throw new JMeterException(e);
105
        } catch (IllegalArgumentException e) {
106
            throw new JMeterException(e);
107
        } catch (InvocationTargetException e) {
108
            throw new JMeterException(e);
109
        }
110
        return instance;
111
    }
112
113
    /**
83
     * Invoke a public method on a class instance
114
     * Invoke a public method on a class instance
84
     *
115
     *
85
     * @param instance
116
     * @param instance
(-)src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java (-2 / +20 lines)
Lines 30-36 Link Here
30
import java.net.URL;
30
import java.net.URL;
31
import java.util.ArrayList;
31
import java.util.ArrayList;
32
32
33
import org.apache.commons.httpclient.cookie.CookiePolicy;
33
import org.apache.http.client.params.CookiePolicy;
34
import org.apache.jmeter.config.ConfigTestElement;
34
import org.apache.jmeter.config.ConfigTestElement;
35
import org.apache.jmeter.engine.event.LoopIterationEvent;
35
import org.apache.jmeter.engine.event.LoopIterationEvent;
36
import org.apache.jmeter.testelement.TestListener;
36
import org.apache.jmeter.testelement.TestListener;
Lines 40-45 Link Here
40
import org.apache.jmeter.threads.JMeterContext;
40
import org.apache.jmeter.threads.JMeterContext;
41
import org.apache.jmeter.util.JMeterUtils;
41
import org.apache.jmeter.util.JMeterUtils;
42
import org.apache.jorphan.logging.LoggingManager;
42
import org.apache.jorphan.logging.LoggingManager;
43
import org.apache.jorphan.reflect.ClassTools;
44
import org.apache.jorphan.util.JMeterException;
43
import org.apache.jorphan.util.JOrphanUtils;
45
import org.apache.jorphan.util.JOrphanUtils;
44
import org.apache.log.Logger;
46
import org.apache.log.Logger;
45
47
Lines 61-66 Link Here
61
    private static final String COOKIES = "CookieManager.cookies";// $NON-NLS-1$
63
    private static final String COOKIES = "CookieManager.cookies";// $NON-NLS-1$
62
64
63
    private static final String POLICY = "CookieManager.policy"; //$NON-NLS-1$
65
    private static final String POLICY = "CookieManager.policy"; //$NON-NLS-1$
66
    
67
    private static final String IMPLEMENTATION = "CookieManager.implementation"; //$NON-NLS-1$
64
    //-- JMX tag values
68
    //-- JMX tag values
65
69
66
    private static final String TAB = "\t"; //$NON-NLS-1$
70
    private static final String TAB = "\t"; //$NON-NLS-1$
Lines 97-102 Link Here
97
    private transient CollectionProperty initialCookies;
101
    private transient CollectionProperty initialCookies;
98
102
99
    public static final String DEFAULT_POLICY = CookiePolicy.BROWSER_COMPATIBILITY;
103
    public static final String DEFAULT_POLICY = CookiePolicy.BROWSER_COMPATIBILITY;
104
    
105
    public static final String DEFAULT_IMPLEMENTATION = HC3CookieHandler.class.getName();
100
106
101
    public CookieManager() {
107
    public CookieManager() {
102
        clearCookies(); // Ensure that there is always a collection available
108
        clearCookies(); // Ensure that there is always a collection available
Lines 136-141 Link Here
136
        setProperty(new BooleanProperty(CLEAR, clear));
142
        setProperty(new BooleanProperty(CLEAR, clear));
137
    }
143
    }
138
144
145
    public String getImplementation() {
146
        return getPropertyAsString(IMPLEMENTATION, DEFAULT_IMPLEMENTATION);
147
    }
148
149
    public void setImplementation(String implementation){
150
        setProperty(IMPLEMENTATION, implementation, DEFAULT_IMPLEMENTATION);
151
    }
152
139
    /**
153
    /**
140
     * Save the static cookie data to a file.
154
     * Save the static cookie data to a file.
141
     * Cookies are only taken from the GUI - runtime cookies are not included.
155
     * Cookies are only taken from the GUI - runtime cookies are not included.
Lines 355-361 Link Here
355
    /** {@inheritDoc} */
369
    /** {@inheritDoc} */
356
    public void testStarted() {
370
    public void testStarted() {
357
        initialCookies = getCookies();
371
        initialCookies = getCookies();
358
        cookieHandler = new HC3CookieHandler(getPolicy());
372
        try {
373
            cookieHandler = (CookieHandler) ClassTools.construct(getImplementation(), getPolicy());
374
        } catch (JMeterException e) {
375
            log.error("Unable to load or invoke class: " + getImplementation(), e);
376
        }
359
        if (log.isDebugEnabled()){
377
        if (log.isDebugEnabled()){
360
            log.debug("Policy: "+getPolicy()+" Clear: "+getClearEachIteration());
378
            log.debug("Policy: "+getPolicy()+" Clear: "+getClearEachIteration());
361
        }
379
        }
(-)src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java (-2 / +66 lines)
Lines 20-32 Link Here
20
20
21
import java.awt.BorderLayout;
21
import java.awt.BorderLayout;
22
import java.awt.Dimension;
22
import java.awt.Dimension;
23
import java.awt.FlowLayout;
23
import java.awt.event.ActionEvent;
24
import java.awt.event.ActionEvent;
24
import java.awt.event.ActionListener;
25
import java.awt.event.ActionListener;
25
import java.io.IOException;
26
import java.io.IOException;
27
import java.util.Collections;
28
import java.util.HashMap;
29
import java.util.List;
26
30
27
import javax.swing.BorderFactory;
31
import javax.swing.BorderFactory;
32
import javax.swing.ComboBoxModel;
33
import javax.swing.DefaultComboBoxModel;
28
import javax.swing.JButton;
34
import javax.swing.JButton;
29
import javax.swing.JCheckBox;
35
import javax.swing.JCheckBox;
36
import javax.swing.JComboBox;
30
import javax.swing.JFileChooser;
37
import javax.swing.JFileChooser;
31
import javax.swing.JPanel;
38
import javax.swing.JPanel;
32
import javax.swing.JScrollPane;
39
import javax.swing.JScrollPane;
Lines 39-48 Link Here
39
import org.apache.jmeter.gui.util.HeaderAsPropertyRenderer;
46
import org.apache.jmeter.gui.util.HeaderAsPropertyRenderer;
40
import org.apache.jmeter.gui.util.PowerTableModel;
47
import org.apache.jmeter.gui.util.PowerTableModel;
41
import org.apache.jmeter.protocol.http.control.Cookie;
48
import org.apache.jmeter.protocol.http.control.Cookie;
49
import org.apache.jmeter.protocol.http.control.CookieHandler;
42
import org.apache.jmeter.protocol.http.control.CookieManager;
50
import org.apache.jmeter.protocol.http.control.CookieManager;
51
import org.apache.jmeter.protocol.http.control.HC3CookieHandler;
43
import org.apache.jmeter.testelement.TestElement;
52
import org.apache.jmeter.testelement.TestElement;
44
import org.apache.jmeter.testelement.property.PropertyIterator;
53
import org.apache.jmeter.testelement.property.PropertyIterator;
45
import org.apache.jmeter.util.JMeterUtils;
54
import org.apache.jmeter.util.JMeterUtils;
55
import org.apache.jorphan.gui.GuiUtils;
46
import org.apache.jorphan.gui.JLabeledChoice;
56
import org.apache.jorphan.gui.JLabeledChoice;
47
import org.apache.jorphan.gui.layout.VerticalLayout;
57
import org.apache.jorphan.gui.layout.VerticalLayout;
48
import org.apache.jorphan.logging.LoggingManager;
58
import org.apache.jorphan.logging.LoggingManager;
Lines 69-74 Link Here
69
    private static final String LOAD_COMMAND = "Load"; //$NON-NLS-1$
79
    private static final String LOAD_COMMAND = "Load"; //$NON-NLS-1$
70
80
71
    private static final String SAVE_COMMAND = "Save"; //$NON-NLS-1$
81
    private static final String SAVE_COMMAND = "Save"; //$NON-NLS-1$
82
83
    private static final String HANDLER_COMMAND = "Handler"; // $NON-NLS-1$
72
    //--
84
    //--
73
85
74
    private JTable cookieTable;
86
    private JTable cookieTable;
Lines 77-82 Link Here
77
89
78
    private JCheckBox clearEachIteration;
90
    private JCheckBox clearEachIteration;
79
91
92
    private JComboBox selectHandlerPanel;
93
94
    private HashMap<String, String> handlerMap = new HashMap<String, String>();
95
80
    private static final String[] COLUMN_RESOURCE_NAMES = {
96
    private static final String[] COLUMN_RESOURCE_NAMES = {
81
        ("name"),   //$NON-NLS-1$
97
        ("name"),   //$NON-NLS-1$
82
        ("value"),  //$NON-NLS-1$
98
        ("value"),  //$NON-NLS-1$
Lines 247-252 Link Here
247
            }
263
            }
248
            cookieManager.setClearEachIteration(clearEachIteration.isSelected());
264
            cookieManager.setClearEachIteration(clearEachIteration.isSelected());
249
            cookieManager.setCookiePolicy(policy.getText());
265
            cookieManager.setCookiePolicy(policy.getText());
266
            cookieManager.setImplementation(handlerMap.get(selectHandlerPanel.getSelectedItem()));
250
        }
267
        }
251
    }
268
    }
252
269
Lines 260-265 Link Here
260
        tableModel.clearData();
277
        tableModel.clearData();
261
        clearEachIteration.setSelected(false);
278
        clearEachIteration.setSelected(false);
262
        policy.setText(CookieManager.DEFAULT_POLICY);
279
        policy.setText(CookieManager.DEFAULT_POLICY);
280
        selectHandlerPanel.setSelectedItem(CookieManager.DEFAULT_IMPLEMENTATION
281
                .substring(CookieManager.DEFAULT_IMPLEMENTATION.lastIndexOf('.') + 1));
263
        deleteButton.setEnabled(false);
282
        deleteButton.setEnabled(false);
264
        saveButton.setEnabled(false);
283
        saveButton.setEnabled(false);
265
    }
284
    }
Lines 297-302 Link Here
297
        populateTable(cookieManager);
316
        populateTable(cookieManager);
298
        clearEachIteration.setSelected((cookieManager).getClearEachIteration());
317
        clearEachIteration.setSelected((cookieManager).getClearEachIteration());
299
        policy.setText(cookieManager.getPolicy());
318
        policy.setText(cookieManager.getPolicy());
319
        String fullImpl = cookieManager.getImplementation();
320
        selectHandlerPanel.setSelectedItem(fullImpl.substring(fullImpl.lastIndexOf('.') + 1));
300
    }
321
    }
301
322
302
    /**
323
    /**
Lines 315-322 Link Here
315
        JPanel northPanel = new JPanel();
336
        JPanel northPanel = new JPanel();
316
        northPanel.setLayout(new VerticalLayout(5, VerticalLayout.BOTH));
337
        northPanel.setLayout(new VerticalLayout(5, VerticalLayout.BOTH));
317
        northPanel.add(makeTitlePanel());
338
        northPanel.add(makeTitlePanel());
318
        northPanel.add(clearEachIteration);
339
        JPanel optionsPane = new JPanel();
319
        northPanel.add(policy);
340
        optionsPane.setBorder(BorderFactory.createTitledBorder(
341
                BorderFactory.createEtchedBorder(),
342
                JMeterUtils.getResString("cookie_options"))); // $NON-NLS-1$
343
        optionsPane.setLayout(new VerticalLayout(5, VerticalLayout.BOTH));
344
        optionsPane.add(clearEachIteration);
345
        JPanel policyTypePane = new JPanel();
346
        policyTypePane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
347
        policyTypePane.add(policy);
348
        policyTypePane.add(GuiUtils.createLabelCombo(
349
                JMeterUtils.getResString("cookie_implementation_choose"), createComboHandler())); // $NON-NLS-1$
350
        optionsPane.add(policyTypePane);
351
        northPanel.add(optionsPane);
320
        add(northPanel, BorderLayout.NORTH);
352
        add(northPanel, BorderLayout.NORTH);
321
        add(createCookieTablePanel(), BorderLayout.CENTER);
353
        add(createCookieTablePanel(), BorderLayout.CENTER);
322
    }
354
    }
Lines 363-366 Link Here
363
        buttonPanel.add(saveButton);
395
        buttonPanel.add(saveButton);
364
        return buttonPanel;
396
        return buttonPanel;
365
    }
397
    }
398
    
399
    /**
400
     * Create the drop-down list to changer render
401
     * @return List of all render (implement ResultsRender)
402
     */
403
    private JComboBox createComboHandler() {
404
        ComboBoxModel nodesModel = new DefaultComboBoxModel();
405
        // drop-down list for renderer
406
        selectHandlerPanel = new JComboBox(nodesModel);
407
        selectHandlerPanel.setActionCommand(HANDLER_COMMAND);
408
        selectHandlerPanel.addActionListener(this);
409
410
        // if no results render in jmeter.properties, load Standard (default)
411
        List<String> classesToAdd = Collections.<String>emptyList();
412
        try {
413
            classesToAdd = JMeterUtils.findClassesThatExtend(CookieHandler.class);
414
        } catch (IOException e1) {
415
            // ignored
416
        }
417
        String tmpName = null;
418
        for (String clazz : classesToAdd) {
419
            String shortClazz = clazz.substring(clazz.lastIndexOf('.') + 1);
420
            if (HC3CookieHandler.class.getName().equals(clazz)) {
421
                tmpName = shortClazz;
422
            }
423
            selectHandlerPanel.addItem(shortClazz);
424
            handlerMap.put(shortClazz, clazz);
425
        }
426
        nodesModel.setSelectedItem(tmpName); // preset to default impl
427
        return selectHandlerPanel;
428
    }
429
366
}
430
}

Return to bug 53755