Merge pull request #303 from dmytro-landiak/master
rest api https support
This commit is contained in:
commit
c5d47bbe02
@ -34,16 +34,23 @@ public class RestApiCallPlugin extends AbstractPlugin<RestApiCallPluginConfigura
|
|||||||
private static final String AUTHORIZATION_HEADER_NAME = "Authorization";
|
private static final String AUTHORIZATION_HEADER_NAME = "Authorization";
|
||||||
private static final String AUTHORIZATION_HEADER_FORMAT = "Basic %s";
|
private static final String AUTHORIZATION_HEADER_FORMAT = "Basic %s";
|
||||||
private static final String CREDENTIALS_TEMPLATE = "%s:%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 RestApiCallMsgHandler handler;
|
||||||
private String baseUrl;
|
private String baseUrl;
|
||||||
private HttpHeaders headers = new HttpHeaders();
|
private HttpHeaders headers = new HttpHeaders();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(RestApiCallPluginConfiguration configuration) {
|
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(
|
this.baseUrl = String.format(
|
||||||
BASE_URL_TEMPLATE,
|
BASE_URL_TEMPLATE,
|
||||||
configuration.getHost(),
|
configuration.getProtocol(),
|
||||||
|
host,
|
||||||
configuration.getPort(),
|
configuration.getPort(),
|
||||||
configuration.getBasePath());
|
configuration.getBasePath());
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,8 @@ import java.util.List;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class RestApiCallPluginConfiguration {
|
public class RestApiCallPluginConfiguration {
|
||||||
|
|
||||||
|
private String protocol;
|
||||||
private String host;
|
private String host;
|
||||||
private int port;
|
private int port;
|
||||||
private String basePath;
|
private String basePath;
|
||||||
|
|||||||
@ -3,6 +3,10 @@
|
|||||||
"title": "REST API Call Plugin Configuration",
|
"title": "REST API Call Plugin Configuration",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"protocol": {
|
||||||
|
"title": "URI Scheme name",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"host": {
|
"host": {
|
||||||
"title": "Host",
|
"title": "Host",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@ -51,6 +55,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
|
"protocol",
|
||||||
"host",
|
"host",
|
||||||
"port",
|
"port",
|
||||||
"basePath",
|
"basePath",
|
||||||
@ -58,6 +63,21 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"form": [
|
"form": [
|
||||||
|
{
|
||||||
|
"key": "protocol",
|
||||||
|
"type": "rc-select",
|
||||||
|
"multiple": false,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"value": "http://",
|
||||||
|
"label": "HTTP"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "https://",
|
||||||
|
"label": "HTTPS"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"host",
|
"host",
|
||||||
"port",
|
"port",
|
||||||
"basePath",
|
"basePath",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user