[
https://issues.jboss.org/browse/JBIDE-17253?page=com.atlassian.jira.plugi...
]
Rob Stryker commented on JBIDE-17253:
-------------------------------------
[~dhladky] The following is my sendAccepted code:
{code}
protected void sendAccepted(String countryString) throws Exception {
// Now we need to fetch the terms and conditions
String urlParameters = "country=" + URLEncoder.encode(countryString);
urlParameters += "&downloadURL=" + URLEncoder.encode(downloadURL);
String user =
(String)getTaskModel().getObject(DownloadRuntimesTaskWizard.USERNAME_KEY);
String pass =
(String)getTaskModel().getObject(DownloadRuntimesTaskWizard.PASSWORD_KEY);
String userCredentials = user+ ":" + pass;
String basicAuth = "Basic " + new String(new
Base64().encode(userCredentials.getBytes()));
HttpURLConnection con =
(HttpURLConnection) new URL(tcAcceptUrl).openConnection();
con.setRequestProperty ("Authorization", basicAuth);
con.setDoOutput(true);
con.setDoInput(true);
con.setInstanceFollowRedirects(false);
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
con.setRequestProperty("charset", "utf-8");
con.setRequestProperty("Content-Length", "" +
Integer.toString(urlParameters.getBytes().length));
con.setUseCaches (false);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(urlParameters);
wr.flush();
wr.close();
// try to read the response data
int resp = con.getResponseCode();
String respMess = con.getResponseMessage();
InputStream is = con.getInputStream();
StringBuilder sb=new StringBuilder();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String read = br.readLine();
while(read != null) {
sb.append(read);
read =br.readLine();
}
con.disconnect();
}
{code}
It would appear I do not set the request / response properties during tc-accept request.
Should I?
Server download wizard: T&Cs failed to be accepted
--------------------------------------------------
Key: JBIDE-17253
URL:
https://issues.jboss.org/browse/JBIDE-17253
Project: Tools (JBoss Tools)
Issue Type: Bug
Components: server
Affects Versions: 4.2.0.Beta1
Reporter: Michelle Murray
Assignee: Rob Stryker
Priority: Critical
Fix For: 4.2.0.CR2
Attachments: Server_downloadT&C.png
1. In Download Runtimes wizard, on
JBoss.org Terms and Conditions page.
2. Select 'Australia'.
3. Click 'Accept Now'.
>> Error message= Unable to accept terms and conditions: Server returned HTTP
response code: 400 for URL:
https://www.jboss.org/download-manager/rest/tc-accept
>> Screenshot attached
Unable to proceed any further with download wizard.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)