sullis 2003/09/07 18:15:11 Modified: httpclient/src/examples MultipartFileUploadApp.java Log: added a JCheckBox to the GUI. The checkbox allows the user to control whether the "Expect" header is used. CVS: ---------------------------------------------------------------------- CVS: PR: CVS: If this change addresses a PR in the problem report tracking CVS: database, then enter the PR number(s) here. CVS: Obtained from: CVS: If this change has been taken from another system, such as NCSA, CVS: then name the system in this line, otherwise delete it. CVS: Submitted by: CVS: If this code has been contributed to Apache by someone else; i.e., CVS: they sent us a patch or a new module, then include their name/email CVS: address here. If this is your work then delete this line. CVS: Reviewed by: CVS: If we are doing pre-commit code reviews and someone else has CVS: reviewed your changes, include their name(s) here. CVS: If you have not had it reviewed then delete this line. Revision Changes Path 1.6 +24 -2 jakarta-commons/httpclient/src/examples/MultipartFileUploadApp.java Index: MultipartFileUploadApp.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/examples/MultipartFileUploadApp.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- MultipartFileUploadApp.java 20 Feb 2003 09:23:29 -0000 1.5 +++ MultipartFileUploadApp.java 8 Sep 2003 01:15:11 -0000 1.6 @@ -72,6 +72,7 @@ import javax.swing.DefaultComboBoxModel; import javax.swing.JButton; import javax.swing.JComboBox; +import javax.swing.JCheckBox; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; @@ -96,6 +97,7 @@ public class MultipartFileUploadApp { public static void main(String[] args) { + MultipartFileUploadFrame f = new MultipartFileUploadFrame(); f.setTitle("HTTP multipart file upload application"); f.pack(); @@ -130,6 +132,10 @@ final JTextField tfdTargetFile = new JTextField(30); tfdTargetFile.setEditable(false); + + final JCheckBox cbxExpectHeader = new JCheckBox("Use Expect header"); + cbxExpectHeader.setSelected(false); + final JButton btnDoUpload = new JButton("Upload"); btnDoUpload.setEnabled(false); @@ -175,6 +181,13 @@ MultipartPostMethod filePost = new MultipartPostMethod(targetURL); + if (cbxExpectHeader.isSelected()) { + filePost.setUseExpectHeader(true); + } + else { + filePost.setUseExpectHeader(false); + } + try { appendMessage("Uploading " + targetFile.getName() + " to " + targetURL); filePost.addParameter(targetFile.getName(), targetFile); @@ -243,12 +256,21 @@ c.gridx = 2; getContentPane().add(btnSelectFile, c); + c.anchor = GridBagConstraints.CENTER; + c.fill = GridBagConstraints.NONE; + c.insets = new Insets(10, 10, 10, 10); + c.gridwidth = 3; + c.gridx = 0; + c.gridy = 2; + getContentPane().add(cbxExpectHeader, c); + + c.anchor = GridBagConstraints.CENTER; c.fill = GridBagConstraints.NONE; c.insets = new Insets(10, 10, 10, 10); c.gridwidth = 3; c.gridx = 0; - c.gridy = 2; + c.gridy = 3; getContentPane().add(btnDoUpload, c); c.anchor = GridBagConstraints.CENTER; @@ -258,7 +280,7 @@ c.gridheight = 3; c.weighty = 3; c.gridx = 0; - c.gridy = 3; + c.gridy = 4; getContentPane().add(new JScrollPane(taTextResponse), c); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]