Author: kevinshen Date: 2010-04-08 10:46:23 +0200 (Thu, 08 Apr 2010) New Revision: 41784
Added: CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/src/webapp/error/nopreview.jsp Modified: CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/resources/cmsc.properties CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/resources/cmsc_nl.properties CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/resources/cmsc_zh.properties CMSContainer/branches/b1_7/CMSContainer/cmsc/portal/src/java/com/finalist/cmsc/portalImpl/PortalErrorServlet.java Log: CMSC-1459 Problem with previewing content that isnt linked to a page Modified: CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/resources/cmsc.properties =================================================================== --- CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/resources/cmsc.properties 2010-04-08 08:39:44 UTC (rev 41783) +++ CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/resources/cmsc.properties 2010-04-08 08:46:23 UTC (rev 41784) @@ -217,4 +217,5 @@ modules.glossary = Glossary asset.notimage.warning = Only image files allowed! -simple.editor.login.title=Simple Editor Login \ No newline at end of file +simple.editor.login.title=Simple Editor Login +exception.404.no.previewpage= No preview page found for content element \ No newline at end of file Modified: CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/resources/cmsc_nl.properties =================================================================== --- CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/resources/cmsc_nl.properties 2010-04-08 08:39:44 UTC (rev 41783) +++ CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/resources/cmsc_nl.properties 2010-04-08 08:46:23 UTC (rev 41784) @@ -215,4 +215,5 @@ modules.glossary=Glossary asset.notimage.warning = Alleen plaatjes toegestaan! -simple.editor.login.title=Simple Editor Login \ No newline at end of file +simple.editor.login.title=Simple Editor Login +exception.404.no.previewpage= No preview page found for content element \ No newline at end of file Modified: CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/resources/cmsc_zh.properties =================================================================== --- CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/resources/cmsc_zh.properties 2010-04-08 08:39:44 UTC (rev 41783) +++ CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/resources/cmsc_zh.properties 2010-04-08 08:46:23 UTC (rev 41784) @@ -211,4 +211,5 @@ modules.glossary=Glossary asset.notimage.warning = 只允许图片文件上传! -simple.editor.login.title=简单编辑器登录 \ No newline at end of file +simple.editor.login.title=简单编辑器登录 +exception.404.no.previewpage= 没有相关的预览页面! \ No newline at end of file Added: CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/src/webapp/error/nopreview.jsp =================================================================== --- CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/src/webapp/error/nopreview.jsp (rev 0) +++ CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/src/webapp/error/nopreview.jsp 2010-04-08 08:46:23 UTC (rev 41784) @@ -0,0 +1,9 @@ +<%...@page language="java" contentType="text/html;charset=UTF-8"%> +<%...@include file="globals.jsp"%> +<c:set var="title" scope="request"><fmt:message key="exception.404.message" /></c:set> +<%...@include file="header.jsp"%> +<fmt:message key="exception.404.no.previewpage" /> + No preview page found for content element +<%...@include file="footer.jsp"%> + + Modified: CMSContainer/branches/b1_7/CMSContainer/cmsc/portal/src/java/com/finalist/cmsc/portalImpl/PortalErrorServlet.java =================================================================== --- CMSContainer/branches/b1_7/CMSContainer/cmsc/portal/src/java/com/finalist/cmsc/portalImpl/PortalErrorServlet.java 2010-04-08 08:39:44 UTC (rev 41783) +++ CMSContainer/branches/b1_7/CMSContainer/cmsc/portal/src/java/com/finalist/cmsc/portalImpl/PortalErrorServlet.java 2010-04-08 08:46:23 UTC (rev 41784) @@ -12,6 +12,7 @@ import java.io.IOException; import java.io.PrintWriter; import java.util.List; +import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.servlet.RequestDispatcher; @@ -68,6 +69,8 @@ private static final String SIMPLE_404 = "(.*/editors/.*[.](jpg$|gif$|png$|css$|js$|ico$))|robots.txt"; + private static final Pattern FILE_PATTERN = Pattern.compile(".*?\\D((?:session=.*?\\+)?\\d+(?:\\+.+?)?)(/.*)?"); + private Pattern excludePattern = Pattern.compile(SIMPLE_404); protected static final String[] vars = { ERROR_STATUS_CODE, ERROR_EXCEPTION_TYPE, @@ -127,6 +130,22 @@ break; } } + if(statusCode == 404 && ServerUtil.isStaging() && !ServerUtil.useServerName()) { + Matcher m = FILE_PATTERN.matcher(path); + String redirectPath = ""; + if (m.matches()) { + if (request.getContextPath() != null) { + redirectPath = request.getContextPath()+"/error/nopreview.jsp"; + } + else { + redirectPath = "/error/nopreview.jsp"; + } + } + if(!"".equals(redirectPath)) { + response.sendRedirect(redirectPath); + return; + } + } } logError(request); if (errorPageSite != null) { _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs