aem中的应用程序的错误处理
问题描述:
我想知道AEM中具有不同内容结构的多租户应用程序的错误处理。我的应用程序步骤如下:aem中的应用程序的错误处理
/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
答
第一步是要有正确的设置错误处理程序,在那里你是在响应状态设置正确的错误代码。
样品用于错误处理程序404
配置404.jsp
<%
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);
}
%>
下一步是具有阿帕奇/调度程序配置成加载(在虚拟主机config配置)正确的错误的文件。这样的错误页面的正确装载委托给了Apache /调度 -
<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>
上述的结构的基础上,短网址,其中在图案 /content/secondapp/country-x/en/.*
缩短to /country-4/en/.*
和每个网站都有自己的页面的error.html和not-found.html