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 (CMSConfig.getInstanceOf().getUseLanguageExtension()
|
||||
&& path.matches("(.*)/index\\.[a-zA-Z]{2}")) {
|
||||
if (CMSConfig.getInstanceOf().getUseLanguageExtension()) {
|
||||
if (path.matches("(.*)/index\\.[a-zA-Z]{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);
|
||||
} else {
|
||||
|
||||
|
|
@ -103,14 +104,17 @@ public class NavigationFileResolver extends DefaultApplicationFileResolver {
|
|||
.append(DispatcherHelper.getRequest().getServerName());
|
||||
|
||||
if (DispatcherHelper.getRequest().getServerPort() != 80
|
||||
&& DispatcherHelper.getRequest().getServerPort() != 443) {
|
||||
&& DispatcherHelper.getRequest().getServerPort()
|
||||
!= 443) {
|
||||
redirectTo
|
||||
.append(":")
|
||||
.append(DispatcherHelper.getRequest().getServerPort());
|
||||
.append(DispatcherHelper.getRequest()
|
||||
.getServerPort());
|
||||
}
|
||||
|
||||
if (DispatcherHelper.getWebappContext() != null
|
||||
&& !DispatcherHelper.getWebappContext().trim().isEmpty()) {
|
||||
&& !DispatcherHelper.getWebappContext().trim()
|
||||
.isEmpty()) {
|
||||
redirectTo.append(DispatcherHelper.getWebappContext());
|
||||
}
|
||||
|
||||
|
|
@ -141,13 +145,15 @@ public class NavigationFileResolver extends DefaultApplicationFileResolver {
|
|||
|
||||
sresp.setHeader("Location", redirectTo.toString());
|
||||
try {
|
||||
sresp.sendError(HttpServletResponse.SC_MOVED_PERMANENTLY);
|
||||
sresp
|
||||
.sendError(HttpServletResponse.SC_MOVED_PERMANENTLY);
|
||||
} catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (path.equals("/category.jsp")) {
|
||||
Navigation nav = (Navigation) Web.getWebContext().getApplication();
|
||||
|
|
|
|||
Loading…
Reference in New Issue