|
@ -168,12 +168,12 @@ public class GatewayProcessor implements Processor {
|
|
|
|
|
|
JsonNode jsonNode = objectMapper.readValue(param, JsonNode.class);
|
|
JsonNode jsonNode = objectMapper.readValue(param, JsonNode.class);
|
|
String url = appApi.getMicroServiceUri().split(",")[0];
|
|
String url = appApi.getMicroServiceUri().split(",")[0];
|
|
String endPoint = "restlet:" + url + appApi.getMsMethodName() + "restletMethods=" + methodMap.get(appApi.getMethod());
|
|
|
|
|
|
final String[] endPoint = {"restlet:" + url + appApi.getMsMethodName() + "?socketTimeout=60000&connectionTimeout=60000&restletMethod=" + methodMap.get(appApi.getMethod())};
|
|
final String[] body = {""};
|
|
final String[] body = {""};
|
|
appApi.getParameters().forEach(p -> {
|
|
appApi.getParameters().forEach(p -> {
|
|
String value = jsonNode.asText(p.getName());
|
|
|
|
|
|
String value = jsonNode.get(p.getName()).asText();
|
|
if (p.getType().equals("0")) { //path param
|
|
if (p.getType().equals("0")) { //path param
|
|
endPoint.replace("{" + p.getName() + "}", value);
|
|
|
|
|
|
endPoint[0] = endPoint[0].replaceAll("\\{[^}]*\\}", value);
|
|
}
|
|
}
|
|
|
|
|
|
body[0] += ("&" + p.getName() + "=" + value);
|
|
body[0] += ("&" + p.getName() + "=" + value);
|
|
@ -183,6 +183,7 @@ public class GatewayProcessor implements Processor {
|
|
if (body[0].length() != 0) {
|
|
if (body[0].length() != 0) {
|
|
exchange.getOut().setBody(body[0].substring(1));
|
|
exchange.getOut().setBody(body[0].substring(1));
|
|
}
|
|
}
|
|
|
|
return endPoint[0];
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
@ -195,7 +196,7 @@ public class GatewayProcessor implements Processor {
|
|
return appApi;
|
|
return appApi;
|
|
}
|
|
}
|
|
|
|
|
|
HTTPResponse response = HttpClientKit.get("http://localhost:10000/api/v1.0/admin/appApi/search?filters=msMethodName%3D" + api + "&size=15&page=1");
|
|
|
|
|
|
HTTPResponse response = HttpClientKit.get("http://localhost:10000/api/v1.0/admin/appApi/search?filters=methodName%3D" + api + "&size=15&page=1");
|
|
if (response.getStatusCode() != 200) {
|
|
if (response.getStatusCode() != 200) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|