return getResponse(settings);
}
private Page findTargetByPost() throws IOException, SAXException {
String url = getContext().getConfig().getUrlForPage(getUrl());
WebRequestSettings settings = new WebRequestSettings(new URL(url), HttpMethod.POST);
// get default encoding
final String charset = System.getProperty("file.encoding");
final Map headers = new HashMap();
if (!StringUtils.isEmpty(fSoapAction)) {
headers.put("Content-type", "text/xml; charset=" + charset);
headers.put("SOAPAction", fSoapAction);
}
else {
// TODO: is this the correct Content-type for non-SOAP posts?
headers.put("Content-type", "application/x-www-form-urlencoded");
}
settings.setAdditionalHeaders(headers);
final String content;
if (getContent() != null) {
content = getContent();
}
else {
content = FileUtil.readFileToString(getContentFile(), this);
}
settings.setRequestBody(content);
settings.setCharset(charset);
return getResponse(settings);
}