Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String uriStr = url + "pid=" + textfPID.getText() + "&issuetype=" + (cmbIssueType.getSelectedIndex() + 1) + "&summary=" + encode(textfSummary.getText()) + "&components=" + encode(textfComponent.getText()) + "&customfield_10050=" + encode(textfCustomer.getText()) + "&customfield_10011=" + encode(textfInstance.getText()) + "&customfield_10012=" + encode(textfContext.getText()) + "&priority=" + encode(textfPriority.getText()) + "&versions=" + encode(textfVersion.getText()) + "&description=" + encode(textaDesc.getText()) + "&customfield_10015=" + encode(textaError.getText()) + (loginUser ? "&os_username=" + encode(textfUsername.getText()) + "&os_password=" + encode(textfPassword.getText()) : "");
- URL url2 = new URL(url.substring(0,url.length()-1));
- HttpURLConnection conn = (HttpURLConnection)url2.openConnection();
- conn.setRequestMethod("POST");
- conn.setAllowUserInteraction(false); // you may not ask the user
- conn.setDoOutput(true); // we want to send things
- conn.setDoInput(true);
- // the Content-type should be default, but we set it anyway
- // conn.setRequestProperty( "Content-type", "application/x-www-form-urlencoded" );
- // the content-length should not be necessary, but we're cautious
- // conn.setRequestProperty( "Content-length", Integer.toString(uriStr.length()));
- // get the output stream to POST our form data
- OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
- wr.write("pid=" + textfPID.getText() + "&issuetype=" + (cmbIssueType.getSelectedIndex() + 1) + "&summary=" + encode(textfSummary.getText()) + "&components=" + encode(textfComponent.getText()) + "&customfield_10050=" + encode(textfCustomer.getText()) + "&customfield_10011=" + encode(textfInstance.getText()) + "&customfield_10012=" + encode(textfContext.getText()) + "&priority=" + encode(textfPriority.getText()) + "&versions=" + encode(textfVersion.getText()) + "&description=" + encode(textaDesc.getText()) + "&customfield_10015=" + encode(textaError.getText()) + (loginUser ? "&os_username=" + encode(textfUsername.getText()) + "&os_password=" + encode(textfPassword.getText()) : "")); // here we "send" our body!
- wr.flush();
- BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
- String line;
- while ((line = rd.readLine()) != null) {
- System.out.println(line);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement