ASF Bugzilla – Attachment 27563 Details for
Bug 51861
Improve HTTP Request GUI to better show parameters without name (GWT RPC requests for example)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Updated patch without drop Down
Bug51861_noDrop.patch (text/plain), 5.43 KB, created by
Sebb
on 2011-09-22 13:06:44 UTC
(
hide
)
Description:
Updated patch without drop Down
Filename:
MIME Type:
Creator:
Sebb
Created:
2011-09-22 13:06:44 UTC
Size:
5.43 KB
patch
obsolete
>Index: src/protocol/http/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java >=================================================================== >--- src/protocol/http/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java (revision 1172569) >+++ src/protocol/http/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java (working copy) >@@ -29,6 +29,7 @@ > import javax.swing.JLabel; > import javax.swing.JPanel; > import javax.swing.JPasswordField; >+import javax.swing.JTabbedPane; > import javax.swing.JTextField; > import javax.swing.event.ChangeEvent; > import javax.swing.event.ChangeListener; >@@ -43,9 +44,11 @@ > import org.apache.jmeter.protocol.http.util.HTTPArgument; > import org.apache.jmeter.testelement.TestElement; > import org.apache.jmeter.testelement.property.BooleanProperty; >+import org.apache.jmeter.testelement.property.PropertyIterator; > import org.apache.jmeter.testelement.property.TestElementProperty; > import org.apache.jmeter.util.JMeterUtils; > import org.apache.jorphan.gui.JLabeledChoice; >+import org.apache.jorphan.gui.JLabeledTextArea; > > /** > * Basic URL / HTTP Request configuration: >@@ -58,6 +61,10 @@ > > private static final long serialVersionUID = 240L; > >+ public static final String POST_BODY_RAW = "HTTPSampler.postBodyRaw"; // TODO - belongs elsewhere >+ >+ private static final boolean POST_BODY_RAW_DEFAULT = false; >+ > private HTTPArgumentsPanel argsPanel; > > private JTextField domain; >@@ -101,6 +108,12 @@ > > private final boolean showImplementation; // Set false for AJP > >+ // Raw POST Body >+ private JLabeledTextArea postBodyContent; >+ >+ // Tabbed pane that contains parameters and raw body >+ private JTabbedPane postContentTabbedPane; >+ > public UrlConfigGui() { > this(true); > } >@@ -139,6 +152,8 @@ > protocol.setText(""); // $NON-NLS-1$ > contentEncoding.setText(""); // $NON-NLS-1$ > argsPanel.clear(); >+ postBodyContent.setText("");// $NON-NLS-1$ >+ postContentTabbedPane.setSelectedIndex(0); > } > > public TestElement createTestElement() { >@@ -157,9 +172,18 @@ > * @param element > */ > public void modifyTestElement(TestElement element) { >- Arguments args = (Arguments) argsPanel.createTestElement(); >- >- HTTPArgument.convertArgumentsToHTTP(args); >+ boolean useRaw = postContentTabbedPane.getSelectedIndex()==1; >+ Arguments args; >+ if(useRaw) { >+ args = new Arguments(); >+ HTTPArgument arg = new HTTPArgument("", postBodyContent.getText(), true); >+ arg.setAlwaysEncoded(false); >+ args.addArgument(arg); >+ } else { >+ args = (Arguments) argsPanel.createTestElement(); >+ HTTPArgument.convertArgumentsToHTTP(args); >+ } >+ element.setProperty(POST_BODY_RAW, useRaw, POST_BODY_RAW_DEFAULT); > element.setProperty(new TestElementProperty(HTTPSamplerBase.ARGUMENTS, args)); > element.setProperty(HTTPSamplerBase.DOMAIN, domain.getText()); > element.setProperty(HTTPSamplerBase.PORT, port.getText()); >@@ -185,7 +209,25 @@ > } > } > >+ // FIXME FACTOR WITH HTTPHC4Impl, HTTPHC3Impl >+ // Just append all the parameter values, and use that as the post body > /** >+ * Compute Post body from arguments >+ * @param arguments {@link Arguments} >+ * @return {@link String} >+ */ >+ private static final String computePostBody(Arguments arguments) { >+ StringBuilder postBody = new StringBuilder(); >+ PropertyIterator args = arguments.iterator(); >+ while (args.hasNext()) { >+ HTTPArgument arg = (HTTPArgument) args.next().getObjectValue(); >+ String value = arg.getValue(); >+ postBody.append(value); >+ } >+ return postBody.toString(); >+ } >+ >+ /** > * Set the text, etc. in the UI. > * > * @param el >@@ -193,7 +235,18 @@ > */ > public void configure(TestElement el) { > setName(el.getName()); >- argsPanel.configure((TestElement) el.getProperty(HTTPSamplerBase.ARGUMENTS).getObjectValue()); >+ Arguments arguments = (Arguments) el.getProperty(HTTPSamplerBase.ARGUMENTS).getObjectValue(); >+ >+ boolean useRaw = el.getPropertyAsBoolean(POST_BODY_RAW, POST_BODY_RAW_DEFAULT); >+ if(useRaw) { >+ String postBody = computePostBody(arguments); >+ postBodyContent.setText(postBody); >+ postContentTabbedPane.setSelectedIndex(1); >+ } else { >+ argsPanel.configure(arguments); >+ postContentTabbedPane.setSelectedIndex(0); >+ } >+ > domain.setText(el.getPropertyAsString(HTTPSamplerBase.DOMAIN)); > > String portString = el.getPropertyAsString(HTTPSamplerBase.PORT); >@@ -504,10 +557,14 @@ > return panel; > } > >- protected JPanel getParameterPanel() { >+ protected JTabbedPane getParameterPanel() { >+ postContentTabbedPane = new JTabbedPane(); > argsPanel = new HTTPArgumentsPanel(); >- >- return argsPanel; >+ postBodyContent = new JLabeledTextArea(JMeterUtils.getResString("post_body_raw"));// $NON-NLS-1$ >+ postContentTabbedPane.add(JMeterUtils.getResString("post_as_parameters"), argsPanel);// $NON-NLS-1$ >+ postContentTabbedPane.add(JMeterUtils.getResString("post_body"), postBodyContent);// $NON-NLS-1$ >+ postContentTabbedPane.addChangeListener(this); >+ return postContentTabbedPane; > } > > // autoRedirects and followRedirects cannot both be selected
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 51861
:
27552
|
27553
|
27562
|
27563
|
27564
|
27583
|
27600
|
27602
|
27613
|
27790
|
27791
|
27792
|
28019