&& httpMethod instanceof HttpEntityEnclosingRequestBase ? new MimeMultipart() : null;
RestParamsPropertyHolder params = request.getParams();
for (int c = 0; c < params.getPropertyCount(); c++) {
RestParamProperty param = params.getPropertyAt(c);
String value = PropertyExpander.expandProperties(context, param.getValue());
responseProperties.put(param.getName(), value);
List<String> valueParts = sendEmptyParameters(request)
|| (!StringUtils.hasContent(value) && param.getRequired()) ? RestUtils
.splitMultipleParametersEmptyIncluded(value, request.getMultiValueDelimiter()) : RestUtils
.splitMultipleParameters(value, request.getMultiValueDelimiter());
// skip HEADER and TEMPLATE parameter encoding (TEMPLATE is encoded by
// the URI handling further down)
if (value != null && param.getStyle() != ParameterStyle.HEADER && param.getStyle() != ParameterStyle.TEMPLATE
&& !param.isDisableUrlEncoding()) {
try {
if (StringUtils.hasContent(encoding)) {
value = URLEncoder.encode(value, encoding);
for (int i = 0; i < valueParts.size(); i++) {
valueParts.set(i, URLEncoder.encode(valueParts.get(i), encoding));
}
} else {
value = urlEncodeWithUtf8(value);
for (int i = 0; i < valueParts.size(); i++) {
valueParts.set(i, urlEncodeWithUtf8(valueParts.get(i)));
}
}
} catch (UnsupportedEncodingException e1) {
SoapUI.logError(e1);
value = urlEncodeWithUtf8(value);
for (int i = 0; i < valueParts.size(); i++) {
valueParts.set(i, urlEncodeWithUtf8(valueParts.get(i)));
}
}
// URLEncoder replaces space with "+", but we want "%20".
value = value.replaceAll("\\+", "%20");
for (int i = 0; i < valueParts.size(); i++) {
valueParts.set(i, valueParts.get(i).replaceAll("\\+", "%20"));
}
}
if (param.getStyle() == ParameterStyle.QUERY && !sendEmptyParameters(request)) {
if (!StringUtils.hasContent(value) && !param.getRequired()) {
continue;
}
}
switch (param.getStyle()) {
case HEADER:
for (String valuePart : valueParts) {
httpMethod.addHeader(param.getName(), valuePart);
}
break;
case QUERY:
if (formMp == null || !request.isPostQueryString()) {
for (String valuePart : valueParts) {
if (query.length() > 0) {
query.append('&');
}
query.append(urlEncodeWithUtf8(param.getName()));
query.append('=');
if (StringUtils.hasContent(valuePart)) {
query.append(valuePart);
}
}
} else {
try {
addFormMultipart(request, formMp, param.getName(), responseProperties.get(param.getName()));
} catch (MessagingException e) {
SoapUI.logError(e);
}
}
break;
case TEMPLATE:
try {
value = getEncodedValue(value, encoding, param.isDisableUrlEncoding(), request
.getSettings().getBoolean(HttpSettings.ENCODED_URLS));
path = path.replaceAll("\\{" + param.getName() + "\\}", value == null ? "" : value);
} catch (UnsupportedEncodingException e) {
SoapUI.logError(e);
}
break;
case MATRIX:
try {
value = getEncodedValue(value, encoding, param.isDisableUrlEncoding(), request
.getSettings().getBoolean(HttpSettings.ENCODED_URLS));
} catch (UnsupportedEncodingException e) {
SoapUI.logError(e);
}
if (param.getType().equals(XmlBoolean.type.getName())) {
if (value.toUpperCase().equals("TRUE") || value.equals("1")) {
path += ";" + param.getName();
}
} else {
path += ";" + param.getName();
if (StringUtils.hasContent(value)) {
path += "=" + value;
}
}
break;