mirror of
https://github.com/Fishwaldo/rundeck-api-java-client.git
synced 2025-07-09 14:39:09 +00:00
Send xml document if included in request
This commit is contained in:
parent
bd7e8f5cec
commit
7543d5d630
1 changed files with 5 additions and 0 deletions
|
@ -32,6 +32,7 @@ import org.apache.http.client.methods.HttpRequestBase;
|
||||||
import org.apache.http.conn.scheme.Scheme;
|
import org.apache.http.conn.scheme.Scheme;
|
||||||
import org.apache.http.conn.ssl.SSLSocketFactory;
|
import org.apache.http.conn.ssl.SSLSocketFactory;
|
||||||
import org.apache.http.conn.ssl.TrustStrategy;
|
import org.apache.http.conn.ssl.TrustStrategy;
|
||||||
|
import org.apache.http.entity.EntityTemplate;
|
||||||
import org.apache.http.entity.mime.HttpMultipartMode;
|
import org.apache.http.entity.mime.HttpMultipartMode;
|
||||||
import org.apache.http.entity.mime.MultipartEntity;
|
import org.apache.http.entity.mime.MultipartEntity;
|
||||||
import org.apache.http.entity.mime.content.InputStreamBody;
|
import org.apache.http.entity.mime.content.InputStreamBody;
|
||||||
|
@ -48,6 +49,7 @@ import org.rundeck.api.RundeckApiException.RundeckApiTokenException;
|
||||||
import org.rundeck.api.parser.ParserHelper;
|
import org.rundeck.api.parser.ParserHelper;
|
||||||
import org.rundeck.api.parser.XmlNodeParser;
|
import org.rundeck.api.parser.XmlNodeParser;
|
||||||
import org.rundeck.api.util.AssertUtil;
|
import org.rundeck.api.util.AssertUtil;
|
||||||
|
import org.rundeck.api.util.DocumentContentProducer;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -286,6 +288,9 @@ class ApiCall {
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
throw new RundeckApiException("Unsupported encoding: " + e.getMessage(), e);
|
throw new RundeckApiException("Unsupported encoding: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
}else if(apiPath.getXmlDocument()!=null) {
|
||||||
|
httpPost.setHeader("Content-Type", "application/xml");
|
||||||
|
httpPost.setEntity(new EntityTemplate(new DocumentContentProducer(apiPath.getXmlDocument())));
|
||||||
}else {
|
}else {
|
||||||
throw new IllegalArgumentException("No Form or Multipart entity for POST content-body");
|
throw new IllegalArgumentException("No Form or Multipart entity for POST content-body");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue