Merge pull request #303 from dmytro-landiak/master

rest api https support
This commit is contained in:
VoBa 2017-09-21 20:44:35 +03:00 committed by GitHub
commit c5d47bbe02
3 changed files with 31 additions and 2 deletions

View File

@ -34,16 +34,23 @@ public class RestApiCallPlugin extends AbstractPlugin<RestApiCallPluginConfigura
private static final String AUTHORIZATION_HEADER_NAME = "Authorization";
private static final String AUTHORIZATION_HEADER_FORMAT = "Basic %s";
private static final String CREDENTIALS_TEMPLATE = "%s:%s";
private static final String BASE_URL_TEMPLATE = "http://%s:%d%s";
private static final String BASE_URL_TEMPLATE = "%s%s:%d%s";
private RestApiCallMsgHandler handler;
private String baseUrl;
private HttpHeaders headers = new HttpHeaders();
@Override
public void init(RestApiCallPluginConfiguration configuration) {
String host = configuration.getHost();
host = host.trim();
if (host.contains("://")) {
host = host.substring(host.lastIndexOf('/') + 1, host.length());
}
this.baseUrl = String.format(
BASE_URL_TEMPLATE,
configuration.getHost(),
configuration.getProtocol(),
host,
configuration.getPort(),
configuration.getBasePath());

View File

@ -22,6 +22,8 @@ import java.util.List;
@Data
public class RestApiCallPluginConfiguration {
private String protocol;
private String host;
private int port;
private String basePath;

View File

@ -3,6 +3,10 @@
"title": "REST API Call Plugin Configuration",
"type": "object",
"properties": {
"protocol": {
"title": "URI Scheme name",
"type": "string"
},
"host": {
"title": "Host",
"type": "string"
@ -51,6 +55,7 @@
}
},
"required": [
"protocol",
"host",
"port",
"basePath",
@ -58,6 +63,21 @@
]
},
"form": [
{
"key": "protocol",
"type": "rc-select",
"multiple": false,
"items": [
{
"value": "http://",
"label": "HTTP"
},
{
"value": "https://",
"label": "HTTPS"
}
]
},
"host",
"port",
"basePath",