diff --git a/src/main/resources/templates/error/400.html b/src/main/resources/templates/error/400.html index 3c7e32b..a9bf23d 100644 --- a/src/main/resources/templates/error/400.html +++ b/src/main/resources/templates/error/400.html @@ -1,5 +1,5 @@ - + @@ -20,7 +20,7 @@
400

请求参数有误

页面地址中的参数不正确(如页码格式错误)。
请修正后重试,或返回门户首页继续浏览。

- 返回门户首页 + 返回门户首页 diff --git a/src/main/resources/templates/error/404.html b/src/main/resources/templates/error/404.html index 83ad770..d25234c 100644 --- a/src/main/resources/templates/error/404.html +++ b/src/main/resources/templates/error/404.html @@ -1,5 +1,5 @@ - + @@ -20,7 +20,7 @@
404

页面不存在或已下线

您访问的页面可能已被删除、更改地址或暂时不可用。
请检查网址是否正确,或返回门户首页继续浏览。

- 返回门户首页 + 返回门户首页 diff --git a/src/main/resources/templates/error/500.html b/src/main/resources/templates/error/500.html index e2f6d75..ca5b598 100644 --- a/src/main/resources/templates/error/500.html +++ b/src/main/resources/templates/error/500.html @@ -1,5 +1,5 @@ - + @@ -20,7 +20,7 @@
500

服务暂时不可用

系统开小差了,工程师正在抢修。
请稍后刷新重试,或返回门户首页继续浏览。

- 返回门户首页 + 返回门户首页 diff --git a/src/main/resources/templates/error/error.html b/src/main/resources/templates/error/error.html index 976119f..6aeafb0 100644 --- a/src/main/resources/templates/error/error.html +++ b/src/main/resources/templates/error/error.html @@ -1,5 +1,5 @@ - + @@ -20,7 +20,7 @@
:(

出错了

请求处理出现异常,请稍后重试。
如持续出现,请联系管理员。

- 返回门户首页 + 返回门户首页 diff --git a/src/test/java/com/yunhai/cms/portal/PortalErrorPageIT.java b/src/test/java/com/yunhai/cms/portal/PortalErrorPageIT.java index 21d2794..3f401ea 100644 --- a/src/test/java/com/yunhai/cms/portal/PortalErrorPageIT.java +++ b/src/test/java/com/yunhai/cms/portal/PortalErrorPageIT.java @@ -60,6 +60,10 @@ class PortalErrorPageIT extends CmsIntegrationTestBase { assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND); assertThat(resp.getBody()).contains("页面不存在"); assertThat(resp.getBody()).doesNotContain("\"status\":404"); + // R-04:返回首页链接必须上下文感知(th:href="@{/portal/}"),不得硬编码 /cms 前缀 + // (本测试无 context-path → 渲染为 /portal/;部署在 /cms 下则自动带 /cms) + assertThat(resp.getBody()).contains("href=\"/portal/\""); + assertThat(resp.getBody()).doesNotContain("/cms/portal/"); assertThat(MediaType.parseMediaType(resp.getHeaders().getContentType().toString()) .includes(MediaType.TEXT_HTML)).isTrue(); }