首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >aem中应用程序的错误处理

aem中应用程序的错误处理
EN

Stack Overflow用户
提问于 2016-07-25 06:39:43
回答 1查看 578关注 0票数 2

我想知道AEM中对于具有不同内容结构的多租户应用程序的错误处理。我的应用程序步骤如下:

代码语言:javascript
复制
/content/firstapp/en

---- Difficulty in the multicountry and multitenancy
/content/secondapp/country-1/en
/content/secondapp/country-2/en
/content/secondapp/country-3/en

/contente/thirdapp/en

Please suggest in this case someone implemented this kind of structure in the past or have more information to do this approachae,. thanks, Sandeep
EN

回答 1

Stack Overflow用户

发布于 2016-07-25 11:25:28

第一步是正确设置错误处理程序,其中您在响应状态中设置了正确的错误代码。

404配置404.jsp的错误处理程序示例

代码语言:javascript
复制
<%
if (com.day.cq.wcm.api.WCMMode.fromRequest(request) != com.day.cq.wcm.api.WCMMode.DISABLED) {
%>
    <%@include file="/libs/sling/servlet/errorhandler/404.jsp"%>
<%
} else {
    response.setStatus(404);
}
%>

下一步是将apache/dispatcher配置为加载正确的错误文档( Virtual host config中的配置)。这样,错误页面的正确加载被委托给apache/dispatcher -

代码语言:javascript
复制
 <LocationMatch "^/content/secondapp/country-1/en/.*$">
    ErrorDocument 404 "/country-1/not-found.html"
    ErrorDocument 500 "/country-1/error.html"
</LocationMatch>

<LocationMatch "^/content/secondapp/country-2/en/.*$">
    ErrorDocument 404 "/country-2/not-found.html"
    ErrorDocument 500 "/country-2/error.html"
</LocationMatch>

<LocationMatch "^/content/secondapp/country-3/en/.*$">
    ErrorDocument 404 "/country-3/not-found.html"
    ErrorDocument 500 "/country-3/error.html"
</LocationMatch>

<LocationMatch "^/content/secondapp/country-4/en/.*$">
    ErrorDocument 404 "/country-4/not-found.html"
    ErrorDocument 500 "/country-4/error.html"
</LocationMatch>

上面的配置是基于短to /country-4/en/.*的,其中模式是/content/secondapp/country-x/en/.*缩短URL,并且每个站点都有自己的error.html页面和not-fin.html

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38557545

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档