// has been handled by the sampler.setPath above, so we just need
// to do parse the rest of the request if it is not a GET request
if((!HTTPConstants.CONNECT.equals(request.getMethod())) && (!HTTPConstants.GET.equals(request.getMethod()))) {
// Check if it was a multipart http post request
final String contentType = request.getContentType();
MultipartUrlConfig urlConfig = request.getMultipartConfig(contentType);
String contentEncoding = sampler.getContentEncoding();
// Get the post data using the content encoding of the request
String postData = null;
if (log.isDebugEnabled()) {
if(!StringUtils.isEmpty(contentEncoding)) {
log.debug("Using encoding " + contentEncoding + " for request body");
}
else {
log.debug("No encoding found, using JRE default encoding for request body");
}
}
if (!StringUtils.isEmpty(contentEncoding)) {
postData = new String(request.getRawPostData(), contentEncoding);
} else {
// Use default encoding
postData = new String(request.getRawPostData(), PostWriter.ENCODING);
}
if (urlConfig != null) {
urlConfig.parseArguments(postData);
// Tell the sampler to do a multipart post
sampler.setDoMultipartPost(true);
// Remove the header for content-type and content-length, since
// those values will most likely be incorrect when the sampler
// performs the multipart request, because the boundary string
// will change
request.getHeaderManager().removeHeaderNamed(HttpRequestHdr.CONTENT_TYPE);
request.getHeaderManager().removeHeaderNamed(HttpRequestHdr.CONTENT_LENGTH);
// Set the form data
sampler.setArguments(urlConfig.getArguments());
// Set the file uploads
sampler.setHTTPFiles(urlConfig.getHTTPFileArgs().asArray());
// used when postData is pure xml (eg. an xml-rpc call) or for PUT
} else if (postData.trim().startsWith("<?")
|| HTTPConstants.PUT.equals(sampler.getMethod())
|| isPotentialXml(postData)) {
sampler.addNonEncodedArgument("", postData, "");