BugFix for LanguageExtension redirect. The redirect was also applied when the feature was disabled in the configuration.
git-svn-id: https://svn.libreccm.org/ccm/trunk@5118 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
c05404d5ae
commit
40d6de55e3
|
|
@ -78,11 +78,12 @@ public class NavigationFileResolver extends DefaultApplicationFileResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!path.endsWith(".jsp")) {
|
if (!path.endsWith(".jsp")) {
|
||||||
if (CMSConfig.getInstanceOf().getUseLanguageExtension()
|
if (CMSConfig.getInstanceOf().getUseLanguageExtension()) {
|
||||||
&& path.matches("(.*)/index\\.[a-zA-Z]{2}")) {
|
if (path.matches("(.*)/index\\.[a-zA-Z]{2}")) {
|
||||||
|
|
||||||
final String lang = path.substring(path.length() - 2);
|
final String lang = path.substring(path.length() - 2);
|
||||||
path = path.substring(0, path.length() - "index.$$".length());
|
path = path
|
||||||
|
.substring(0, path.length() - "index.$$".length());
|
||||||
GlobalizationHelper.setSelectedLocale(lang);
|
GlobalizationHelper.setSelectedLocale(lang);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
@ -103,14 +104,17 @@ public class NavigationFileResolver extends DefaultApplicationFileResolver {
|
||||||
.append(DispatcherHelper.getRequest().getServerName());
|
.append(DispatcherHelper.getRequest().getServerName());
|
||||||
|
|
||||||
if (DispatcherHelper.getRequest().getServerPort() != 80
|
if (DispatcherHelper.getRequest().getServerPort() != 80
|
||||||
&& DispatcherHelper.getRequest().getServerPort() != 443) {
|
&& DispatcherHelper.getRequest().getServerPort()
|
||||||
|
!= 443) {
|
||||||
redirectTo
|
redirectTo
|
||||||
.append(":")
|
.append(":")
|
||||||
.append(DispatcherHelper.getRequest().getServerPort());
|
.append(DispatcherHelper.getRequest()
|
||||||
|
.getServerPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DispatcherHelper.getWebappContext() != null
|
if (DispatcherHelper.getWebappContext() != null
|
||||||
&& !DispatcherHelper.getWebappContext().trim().isEmpty()) {
|
&& !DispatcherHelper.getWebappContext().trim()
|
||||||
|
.isEmpty()) {
|
||||||
redirectTo.append(DispatcherHelper.getWebappContext());
|
redirectTo.append(DispatcherHelper.getWebappContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -141,13 +145,15 @@ public class NavigationFileResolver extends DefaultApplicationFileResolver {
|
||||||
|
|
||||||
sresp.setHeader("Location", redirectTo.toString());
|
sresp.setHeader("Location", redirectTo.toString());
|
||||||
try {
|
try {
|
||||||
sresp.sendError(HttpServletResponse.SC_MOVED_PERMANENTLY);
|
sresp
|
||||||
|
.sendError(HttpServletResponse.SC_MOVED_PERMANENTLY);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (path.equals("/category.jsp")) {
|
if (path.equals("/category.jsp")) {
|
||||||
Navigation nav = (Navigation) Web.getWebContext().getApplication();
|
Navigation nav = (Navigation) Web.getWebContext().getApplication();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue