/**
* Gets the query to issue to the server, authenticated if needed.
*/
private Request getRequest() {
ListButton protocolListButton = (ListButton)serializer.getObjectByName("request.protocol");
ListItem protocolListItem = (ListItem)protocolListButton.getSelectedItem();
Protocol protocol = Protocol.decode(protocolListItem.getText());
boolean secure = protocol.isSecure();
TextInput hostTextInput = (TextInput)serializer.getObjectByName("request.host");
String host = hostTextInput.getText();
TextInput portTextInput = (TextInput)serializer.getObjectByName("request.port");
String portText = portTextInput.getText();
int port;
try {
port = Integer.parseInt(portText);
} catch (Exception ex) {
port = secure ? 443 : 80;
}
TextInput pathTextInput = (TextInput)serializer.getObjectByName("request.path");
String path = pathTextInput.getText();
ListButton methodListButton = (ListButton)serializer.getObjectByName("request.method");
ListItem methodListItem = (ListItem)methodListButton.getSelectedItem();
// Construct the HTTP request
Request httpRequest = new Request(methodListItem.getText(), protocol.toString(), host, port, path);
TextArea textArea = (TextArea)serializer.getObjectByName("request.body");
String body = textArea.getText();
httpRequest.setBody(body.getBytes());