context-path 대응 추가 수정

This commit is contained in:
현성필
2024-01-24 13:33:03 +09:00
parent be1053d832
commit 1a0a32d427
14 changed files with 3705 additions and 10 deletions
+5 -2
View File
@@ -8,13 +8,16 @@
class APIClient { class APIClient {
CLIENT_URL = 'mgmt/api/test.do'; CLIENT_URL = '/mgmt/api/test.do';
constructor(contextPath) { constructor(contextPath) {
window.globals = {}; window.globals = {};
this.variables = {}; this.variables = {};
this.abortController = null; this.abortController = null;
this.contextPath = contextPath || '/'; this.contextPath = document.querySelector('meta[name="context-path"]').getAttribute('content');
if (!this.contextPath) {
this.contextPath = '/';
}
} }
getClientUrl() { getClientUrl() {
+9 -4
View File
@@ -3,17 +3,22 @@ import APIScenario from "./APIScenario";
window.MonacoEnvironment = { window.MonacoEnvironment = {
getWorkerUrl: function (moduleId, label) { getWorkerUrl: function (moduleId, label) {
let contextPath = document.querySelector('meta[name="context-path"]').getAttribute('content');
if (!contextPath) {
contextPath = '/';
}
if (label === 'json') { if (label === 'json') {
return '/plugins/apitestmanager/json.worker.bundle.js'; return contextPath + '/plugins/apitestmanager/json.worker.bundle.js';
} }
if (label === 'css' || label === 'scss' || label === 'less') { if (label === 'css' || label === 'scss' || label === 'less') {
return '/plugins/apitestmanager/css.worker.bundle.js'; return contextPath + '/plugins/apitestmanager/css.worker.bundle.js';
} }
if (label === 'html' || label === 'handlebars' || label === 'razor') { if (label === 'html' || label === 'handlebars' || label === 'razor') {
return '/plugins/apitestmanager/html.worker.bundle.js'; return contextPath + '/plugins/apitestmanager/html.worker.bundle.js';
} }
if (label === 'typescript' || label === 'javascript') { if (label === 'typescript' || label === 'javascript') {
return '/plugins/apitestmanager/ts.worker.bundle.js'; return contextPath + '/plugins/apitestmanager/ts.worker.bundle.js';
} }
return '/plugins/apitestmanager/editor.worker.bundle.js'; return '/plugins/apitestmanager/editor.worker.bundle.js';
} }
@@ -37,6 +37,7 @@ public class MockApiController {
public ResponseEntity<String> handleRequest(HttpServletRequest httpRequest) throws IOException { public ResponseEntity<String> handleRequest(HttpServletRequest httpRequest) throws IOException {
MockRequest request = new MockRequest(httpRequest); MockRequest request = new MockRequest(httpRequest);
AntPathMatcher pathMatcher = new AntPathMatcher(); AntPathMatcher pathMatcher = new AntPathMatcher();
logger.debug("==========================="); logger.debug("===========================");
@@ -28,8 +28,9 @@ public class MockRequest {
} }
public MockRequest(HttpServletRequest request) throws IOException { public MockRequest(HttpServletRequest request) throws IOException {
String contextPath = request.getContextPath();
this.method = request.getMethod(); this.method = request.getMethod();
this.uri = request.getRequestURI(); this.uri = request.getRequestURI().replace(contextPath, "");
this.headers = Collections.list(request.getHeaderNames()).stream() this.headers = Collections.list(request.getHeaderNames()).stream()
.collect(Collectors.toMap(name -> name, request::getHeader)); .collect(Collectors.toMap(name -> name, request::getHeader));
+2
View File
@@ -17,6 +17,8 @@ server:
session: session:
timeout: 180m timeout: 180m
context-path: /
spring: spring:
datasource: datasource:
url: jdbc:h2:file:./db/apidb url: jdbc:h2:file:./db/apidb
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -4,6 +4,7 @@
<head th:fragment="headFragment"> <head th:fragment="headFragment">
<meta charset="UTF-8"/> <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="context-path" th:content="${#httpServletRequest.contextPath}"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta content="max-age=0, public" http-equiv="Cache-Control"/> <meta content="max-age=0, public" http-equiv="Cache-Control"/>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
@@ -6,7 +6,7 @@
<section layout:fragment="contentFragment"> <section layout:fragment="contentFragment">
<script th:src="@{/plugins/vs/loader.js}"></script> <script th:src="@{/plugins/vs/loader.js}"></script>
<script> <script>
require.config({paths: {'vs': '/plugins/vs'}}); require.config({paths: {'vs': '[[@{/plugins/vs}]]'}});
</script> </script>
<div class="container-fluid mt-2"> <div class="container-fluid mt-2">
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true" style="position: absolute; top: 0; left: 0;"> <div class="toast" role="alert" aria-live="assertive" aria-atomic="true" style="position: absolute; top: 0; left: 0;">