|
@@ -5,6 +5,7 @@ import com.persagy.common.web.MapResponse;
|
|
|
import com.persagy.common.web.ServletUtils;
|
|
|
import com.persagy.dmp.common.http.HttpUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -26,27 +27,31 @@ public class DmpGatewayController {
|
|
|
@Autowired
|
|
|
private HttpUtils httpUtils;
|
|
|
|
|
|
- @PostMapping("/report/**")
|
|
|
- public void report(HttpServletRequest request, HttpServletResponse response, @RequestBody JsonNode param) {
|
|
|
- dispatch(request, response, param);
|
|
|
- }
|
|
|
+ @Value("${dispatch.dic}")
|
|
|
+ private String dicUrl;
|
|
|
+
|
|
|
+ @Value("${dispatch.org}")
|
|
|
+ private String orgUrl;
|
|
|
+
|
|
|
+ @Value("${dispatch.rwd}")
|
|
|
+ private String rwdUrl;
|
|
|
|
|
|
@PostMapping("/dic/**")
|
|
|
public void dic(HttpServletRequest request, HttpServletResponse response, @RequestBody JsonNode param) {
|
|
|
- dispatch(request, response, param);
|
|
|
+ dispatch(request, response, param, dicUrl);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/org/**")
|
|
|
public void org(HttpServletRequest request, HttpServletResponse response, @RequestBody JsonNode param) {
|
|
|
- dispatch(request, response, param);
|
|
|
+ dispatch(request, response, param, orgUrl);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/rwd/**")
|
|
|
public void rwd(HttpServletRequest request, HttpServletResponse response, @RequestBody JsonNode param) {
|
|
|
- dispatch(request, response, param);
|
|
|
+ dispatch(request, response, param, rwdUrl);
|
|
|
}
|
|
|
|
|
|
- private void dispatch(HttpServletRequest request, HttpServletResponse response, @RequestBody JsonNode param) {
|
|
|
+ private void dispatch(HttpServletRequest request, HttpServletResponse response, @RequestBody JsonNode param, String dispatchUrl) {
|
|
|
Map<String, String[]> parameterMap = request.getParameterMap();
|
|
|
String[] dmpServers = parameterMap.get("dmpServer");
|
|
|
if (dmpServers == null) {
|
|
@@ -56,7 +61,7 @@ public class DmpGatewayController {
|
|
|
return;
|
|
|
}
|
|
|
StringBuilder url = new StringBuilder("http://" + dmpServers[0]);
|
|
|
- String uri = request.getRequestURI().replace("/admin/dmp", "");
|
|
|
+ String uri = request.getRequestURI().replace("/admin/dmp", dispatchUrl);
|
|
|
url.append(uri);
|
|
|
String queryString = request.getQueryString();
|
|
|
if (!"/rwd/def/class".equalsIgnoreCase(uri) && !"/rwd/def/funcid".equalsIgnoreCase(uri)) {
|