【问题标题】:Error handling for applications in aemaem 中应用程序的错误处理
【发布时间】:2016-11-28 04:38:07
【问题描述】:

我想知道 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

【问题讨论】:

    标签: error-handling http-status-code-404 aem multi-tenant


    【解决方案1】:

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

    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);
    }
    %>
    

    下一步是配置 apache/dispatcher 以加载正确的错误文档(虚拟主机配置中的配置)。这样,错误页面的正确加载就委托给了 apache/dispatcher -

     <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>
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-04
      • 2016-03-06
      相关资源
      最近更新 更多