[Yanel-commits] rev 44764 - in public/yanel/trunk/src/webapp:
WEB-INF src/java/org/wyona/yanel/servlet
michi at wyona.com
michi at wyona.com
Thu Sep 17 13:59:04 CEST 2009
Author: michi
Date: 2009-09-17 13:59:02 +0200 (Thu, 17 Sep 2009)
New Revision: 44764
Modified:
public/yanel/trunk/src/webapp/WEB-INF/web.xml
public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
Log:
display a 404 if workflowable, but no live version exists and config parameter set to false
Modified: public/yanel/trunk/src/webapp/WEB-INF/web.xml
===================================================================
--- public/yanel/trunk/src/webapp/WEB-INF/web.xml 2009-09-17 05:26:38 UTC (rev 44763)
+++ public/yanel/trunk/src/webapp/WEB-INF/web.xml 2009-09-17 11:59:02 UTC (rev 44764)
@@ -39,13 +39,20 @@
<param-value>xslt/login-screen.xsl</param-value>
</init-param>
- <!-- Enable resp. disable toolbar functionality. For security and performance reasons one might want to disable the toolbar functionality completely with this parameter -->
+ <!-- Enable/Disable toolbar functionality. For security and performance reasons one might want to disable the toolbar functionality completely with this parameter -->
<init-param>
<param-name>toolbar-master-switch</param-name>
<param-value>on</param-value>
<!--<param-value>off</param-value>-->
</init-param>
+ <!-- If a resource is workflowable, has a workflow, but is not live yet, then the most recent version shall be displayed in order to stay backwards compatible -->
+ <init-param>
+ <param-name>workflow.not-live.most-recent-version</param-name>
+ <param-value>true</param-value>
+ <!--<param-value>false</param-value>-->
+ </init-param>
+
<!-- Allow client-side caching of static htdocs content. Specify value in hours. -->
<init-param>
<param-name>static-content-cache-expires</param-name>
Modified: public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
===================================================================
--- public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java 2009-09-17 05:26:38 UTC (rev 44763)
+++ public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java 2009-09-17 11:59:02 UTC (rev 44764)
@@ -95,6 +95,7 @@
private File xsltInfoAndException;
private String xsltLoginScreenDefault;
+ private boolean displayMostRecentVersion = true;
public static final String IDENTITY_MAP_KEY = "identity-map";
private static final String TOOLBAR_USECASE = "toolbar"; //TODO is this the same as YanelAuthoringUI.TOOLBAR_KEY?
@@ -136,6 +137,7 @@
xsltInfoAndException = org.wyona.commons.io.FileUtil.file(servletContextRealPath, config.getInitParameter("exception-and-info-screen-xslt"));
xsltLoginScreenDefault = config.getInitParameter("login-screen-xslt");
+ displayMostRecentVersion = new Boolean(config.getInitParameter("workflow.not-live.most-recent-version")).booleanValue();
try {
yanelInstance = Yanel.getInstance();
yanelInstance.init();
@@ -430,15 +432,18 @@
if (workflowable.isLive()) {
view = workflowable.getLiveView(viewId);
} else {
- String message = "The viewable (V2) resource '" + res.getPath() + "' is WorkflowableV1, but has not been published yet. Instead the live version, the most recent version will be displayed!";
+ String message = "The viewable (V2) resource '" + res.getPath() + "' is WorkflowableV1, but has not been published yet.";
log.warn(message);
- view = ((ViewableV2) res).getView(viewId);
-
- // TODO: Maybe sending a 404 instead the most recent version should be configurable!
- /*
- do404(request, response, doc, message);
- return;
- */
+ // TODO: Make this configurable per realm
+ if (displayMostRecentVersion) {
+ log.warn("Instead the live version, the most recent version will be displayed!");
+ view = ((ViewableV2) res).getView(viewId);
+ } else {
+ log.warn("Instead the live version, a 404 will be displayed!");
+ // TODO: Instead a 404 one might want to show a different kind of screen
+ do404(request, response, doc, message);
+ return;
+ }
}
} else {
view = ((ViewableV2) res).getView(viewId);
More information about the Yanel-commits
mailing list