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

(-)./src/core/org/apache/jmeter/resources/messages.properties.orig (-1 / +2 lines)
Lines 753-758 Link Here
753
web_server_domain=Server Name or IP\:
753
web_server_domain=Server Name or IP\:
754
web_server_port=Port Number\:
754
web_server_port=Port Number\:
755
web_testing_retrieve_images=Retrieve All Embedded Resources from HTML Files
755
web_testing_retrieve_images=Retrieve All Embedded Resources from HTML Files
756
web_testing_same_server=(Only from same server)
756
web_testing_title=HTTP Request
757
web_testing_title=HTTP Request
757
webservice_proxy_host=Proxy Host
758
webservice_proxy_host=Proxy Host
758
webservice_proxy_note=If Use HTTP Proxy is checked, but no host or port are provided, the sampler
759
webservice_proxy_note=If Use HTTP Proxy is checked, but no host or port are provided, the sampler
Lines 796-799 Link Here
796
you_must_enter_a_valid_number=You must enter a valid number
797
you_must_enter_a_valid_number=You must enter a valid number
797
zh_cn=Chinese (Simplified)
798
zh_cn=Chinese (Simplified)
798
zh_tw=Chinese (Traditional)
799
zh_tw=Chinese (Traditional)
799
# Please add new entries in alphabetical order
800
# Please add new entries in alphabetical order
(-)./src/protocol/http/org/apache/jmeter/protocol/http/control/gui/HttpTestSampleGui.java.orig (-1 / +24 lines)
Lines 23-28 Link Here
23
import javax.swing.BorderFactory;
23
import javax.swing.BorderFactory;
24
import javax.swing.JCheckBox;
24
import javax.swing.JCheckBox;
25
import javax.swing.JPanel;
25
import javax.swing.JPanel;
26
import javax.swing.event.ChangeListener;
27
import javax.swing.event.ChangeEvent;
26
28
27
import org.apache.jmeter.gui.util.HorizontalPanel;
29
import org.apache.jmeter.gui.util.HorizontalPanel;
28
import org.apache.jmeter.protocol.http.config.gui.MultipartUrlConfigGui;
30
import org.apache.jmeter.protocol.http.config.gui.MultipartUrlConfigGui;
Lines 44-49 Link Here
44
46
45
	private JCheckBox getImages;
47
	private JCheckBox getImages;
46
48
49
	private JCheckBox sameServer;
50
47
	private JCheckBox isMon;
51
	private JCheckBox isMon;
48
52
49
	public HttpTestSampleGui() {
53
	public HttpTestSampleGui() {
Lines 53-59 Link Here
53
	public void configure(TestElement element) {
57
	public void configure(TestElement element) {
54
		super.configure(element);
58
		super.configure(element);
55
		urlConfigGui.configure(element);
59
		urlConfigGui.configure(element);
56
		getImages.setSelected(((HTTPSamplerBase) element).isImageParser());
60
		boolean isImageParser = ((HTTPSamplerBase) element).isImageParser();
61
		getImages.setSelected(isImageParser);
62
		sameServer.setEnabled(isImageParser);
63
		sameServer.setSelected(((HTTPSamplerBase) element).isImageParserSameServer());
57
		isMon.setSelected(((HTTPSamplerBase) element).isMonitor());
64
		isMon.setSelected(((HTTPSamplerBase) element).isMonitor());
58
	}
65
	}
59
66
Lines 78-83 Link Here
78
			sampler.removeProperty(HTTPSamplerBase.IMAGE_PARSER);// TODO - why?
85
			sampler.removeProperty(HTTPSamplerBase.IMAGE_PARSER);// TODO - why?
79
		}
86
		}
80
        ((HTTPSamplerBase) sampler).setMonitor(isMon.isSelected());
87
        ((HTTPSamplerBase) sampler).setMonitor(isMon.isSelected());
88
		((HTTPSamplerBase) sampler).setImageParserSameServer(sameServer.isSelected());
81
		this.configureTestElement(sampler);
89
		this.configureTestElement(sampler);
82
	}
90
	}
83
91
Lines 97-102 Link Here
97
105
98
		// OPTIONAL TASKS
106
		// OPTIONAL TASKS
99
		add(createOptionalTasksPanel(), BorderLayout.SOUTH);
107
		add(createOptionalTasksPanel(), BorderLayout.SOUTH);
108
		getImages.addChangeListener(new ChangeListener() {
109
			public void stateChanged(ChangeEvent e) {
110
				if (getImages.isSelected()) {
111
					sameServer.setEnabled(true);
112
				}
113
				else {
114
					sameServer.setSelected(false);
115
					sameServer.setEnabled(false);
116
				}
117
			}
118
		});
100
	}
119
	}
101
120
102
	private JPanel createOptionalTasksPanel() {
121
	private JPanel createOptionalTasksPanel() {
Lines 109-118 Link Here
109
		JPanel retrieveImagesPanel = new JPanel();
128
		JPanel retrieveImagesPanel = new JPanel();
110
		getImages = new JCheckBox(JMeterUtils.getResString("web_testing_retrieve_images")); // $NON-NLS-1$
129
		getImages = new JCheckBox(JMeterUtils.getResString("web_testing_retrieve_images")); // $NON-NLS-1$
111
		retrieveImagesPanel.add(getImages);
130
		retrieveImagesPanel.add(getImages);
131
		JPanel sameServerPanel = new JPanel();
132
		sameServer = new JCheckBox(JMeterUtils.getResString("web_testing_same_server")); // $NON-NLS-1$
133
		retrieveImagesPanel.add(sameServer);
112
		JPanel isMonitorPanel = new JPanel();
134
		JPanel isMonitorPanel = new JPanel();
113
		isMon = new JCheckBox(JMeterUtils.getResString("monitor_is_title")); // $NON-NLS-1$
135
		isMon = new JCheckBox(JMeterUtils.getResString("monitor_is_title")); // $NON-NLS-1$
114
		isMonitorPanel.add(isMon);
136
		isMonitorPanel.add(isMon);
115
		optionalTasksPanel.add(retrieveImagesPanel);
137
		optionalTasksPanel.add(retrieveImagesPanel);
138
		optionalTasksPanel.add(sameServerPanel);
116
		optionalTasksPanel.add(isMonitorPanel);
139
		optionalTasksPanel.add(isMonitorPanel);
117
		return optionalTasksPanel;
140
		return optionalTasksPanel;
118
	}
141
	}
(-)./src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java.orig (-1 / +16 lines)
Lines 146-151 Link Here
146
	// public final static String ENCODED_PATH= "HTTPSampler.encoded_path";
146
	// public final static String ENCODED_PATH= "HTTPSampler.encoded_path";
147
	public final static String IMAGE_PARSER = "HTTPSampler.image_parser"; // $NON-NLS-1$
147
	public final static String IMAGE_PARSER = "HTTPSampler.image_parser"; // $NON-NLS-1$
148
148
149
	public final static String SAME_SERVER = "HTTPSampler.image_parser_same_server"; // $NON-NLS-1$
150
149
	public final static String MONITOR = "HTTPSampler.monitor"; // $NON-NLS-1$
151
	public final static String MONITOR = "HTTPSampler.monitor"; // $NON-NLS-1$
150
152
151
	/** A number to indicate that the port has not been set. * */
153
	/** A number to indicate that the port has not been set. * */
Lines 484-493 Link Here
484
		return getPropertyAsBoolean(IMAGE_PARSER);
486
		return getPropertyAsBoolean(IMAGE_PARSER);
485
	}
487
	}
486
488
489
	public boolean isImageParserSameServer() {
490
		return getPropertyAsBoolean(SAME_SERVER);
491
	}
492
487
	public void setImageParser(boolean parseImages) {
493
	public void setImageParser(boolean parseImages) {
488
		setProperty(new BooleanProperty(IMAGE_PARSER, parseImages));
494
		setProperty(new BooleanProperty(IMAGE_PARSER, parseImages));
489
	}
495
	}
490
496
497
	public void setImageParserSameServer(boolean sameServer) {
498
		setProperty(new BooleanProperty(SAME_SERVER, sameServer));
499
	}
500
491
	/**
501
	/**
492
	 * Obtain a result that will help inform the user that an error has occured
502
	 * Obtain a result that will help inform the user that an error has occured
493
	 * during sampling, and how long it took to detect the error.
503
	 * during sampling, and how long it took to detect the error.
Lines 706-711 Link Here
706
	 */
716
	 */
707
	protected HTTPSampleResult downloadPageResources(HTTPSampleResult res, HTTPSampleResult container, int frameDepth) {
717
	protected HTTPSampleResult downloadPageResources(HTTPSampleResult res, HTTPSampleResult container, int frameDepth) {
708
		Iterator urls = null;
718
		Iterator urls = null;
719
		URL resUrl = res.getURL();
709
		try {
720
		try {
710
			final byte[] responseData = res.getResponseData();
721
			final byte[] responseData = res.getResponseData();
711
            if (responseData.length > 0){  // Bug 39205
722
            if (responseData.length > 0){  // Bug 39205
Lines 717-723 Link Here
717
                        HTMLParser.getParser(parserName) 
728
                        HTMLParser.getParser(parserName) 
718
                        : 
729
                        : 
719
                        HTMLParser.getParser(); // we don't; use the default parser
730
                        HTMLParser.getParser(); // we don't; use the default parser
720
                    urls = parser.getEmbeddedResourceURLs(responseData, res.getURL());
731
                    urls = parser.getEmbeddedResourceURLs(responseData, resUrl);
721
    			} 
732
    			} 
722
            }
733
            }
723
		} catch (HTMLParseException e) {
734
		} catch (HTMLParseException e) {
Lines 749-754 Link Here
749
                            continue;
760
                            continue;
750
                        }
761
                        }
751
                    }
762
                    }
763
                    if (isImageParserSameServer() && !resUrl.getHost().equals(url.getHost())) {
764
                        log.debug("Skipping embedded resource (not same server): "+url);
765
                        continue;
766
                    }
752
                    HTTPSampleResult binRes = sample(url, GET, false, frameDepth + 1);
767
                    HTTPSampleResult binRes = sample(url, GET, false, frameDepth + 1);
753
					res.addSubResult(binRes);
768
					res.addSubResult(binRes);
754
					res.setSuccessful(res.isSuccessful() && binRes.isSuccessful());
769
					res.setSuccessful(res.isSuccessful() && binRes.isSuccessful());

Return to bug 40933