From 70171a8e8c251d62a268eba4b8b9c9692672baf2 Mon Sep 17 00:00:00 2001 From: jensp Date: Fri, 1 Sep 2017 09:14:10 +0000 Subject: [PATCH] Better handling of language extension if an item is requested without language extension in the URL and does not exist in one of the languages transmitted in the accept language header. git-svn-id: https://svn.libreccm.org/ccm/trunk@4971 8810af33-2d31-482b-a856-94f89814c4df --- ccm-cms/src/com/arsdigita/cms/ContentSectionServlet.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ccm-cms/src/com/arsdigita/cms/ContentSectionServlet.java b/ccm-cms/src/com/arsdigita/cms/ContentSectionServlet.java index 285e58456..47efee3c7 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentSectionServlet.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentSectionServlet.java @@ -36,6 +36,7 @@ import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.globalization.GlobalizationHelper; import com.arsdigita.kernel.ACSObjectCache; import com.arsdigita.kernel.Kernel; +import com.arsdigita.kernel.KernelConfig; import com.arsdigita.kernel.KernelContext; import com.arsdigita.kernel.Party; import com.arsdigita.kernel.User; @@ -63,6 +64,7 @@ import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.Map; + import javax.servlet.RequestDispatcher; import javax.servlet.ServletConfig; import javax.servlet.ServletException; @@ -287,7 +289,7 @@ public class ContentSectionServlet extends BaseApplicationServlet { && (!pathInfo.endsWith(".jsp") || !pathInfo.endsWith(".xml"))) { if (pathInfo.lastIndexOf(".") == -1) { - final String lang; + String lang; if (GlobalizationHelper.getSelectedLocale(sreq) == null) { lang = GlobalizationHelper .getNegotiatedLocale() @@ -297,6 +299,11 @@ public class ContentSectionServlet extends BaseApplicationServlet { .getSelectedLocale(sreq) .getLanguage(); } + + if (getItem(section, url, sreq, sresp) == null) { + lang = KernelConfig.getConfig().getDefaultLanguage(); + } + // try { final StringBuffer redirectTo = new StringBuffer(); if (DispatcherHelper.getWebappContext() != null