You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by rm...@apache.org on 2011/03/10 18:49:17 UTC

svn commit: r1080299 - in /incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher: Dispatcher.java view/HelpLink.java

Author: rmatthews
Date: Thu Mar 10 17:49:17 2011
New Revision: 1080299

URL: http://svn.apache.org/viewvc?rev=1080299&view=rev
Log:
A missing page is now simply logged, rather than being raised as an error.

Help links are now created as images, allowing them to be positioned popping up over the relevant components.

Modified:
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java?rev=1080299&r1=1080298&r2=1080299&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java Thu Mar 10 17:49:17 2011
@@ -114,6 +114,16 @@ public class Dispatcher {
             context.endRequest();
             UserManager.endRequest(context.getSession());
 
+        } catch (ScimpiNotFoundException e) {
+            LOG.info("invalid page request "+ e.getMessage());
+            try {
+                UserManager.endRequest(context.getSession());
+            } catch (Exception e1) {
+                LOG.error("endRequest call failed", e1);
+            }
+            context.addVariable("_error-message", e.getHtmlMessage(), Scope.REQUEST);
+            //context.addVariable("_error-details", e.getHtmlMessage(), Scope.REQUEST);
+            context.raiseError(404);
         } catch (Throwable e) {
             LOG.debug(e.getMessage(), e);
             
@@ -160,8 +170,6 @@ public class Dispatcher {
                 context.addVariable("_security_identifier", ((ForbiddenException) ex).getIdentifier(), Scope.REQUEST);
                 context.addVariable("_security_roles", ((ForbiddenException) ex).getRoles(), Scope.REQUEST);
                 context.raiseError(403);
-            } else if (ex instanceof ScimpiNotFoundException) {
-                context.raiseError(404);
             } else {
                 context.raiseError(500);    
             }

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java?rev=1080299&r1=1080298&r2=1080299&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java Thu Mar 10 17:49:17 2011
@@ -22,6 +22,7 @@ import org.apache.isis.core.commons.conf
 import org.apache.isis.runtimes.dflt.runtime.context.IsisContext;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
+
 public class HelpLink {
 
     private static String site;
@@ -35,7 +36,7 @@ public class HelpLink {
         if (site == null) {
             site = IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT + "scimpi.help-site", "/help/");
         }
-        if (suffix == null) {   
+        if (suffix == null) {
             suffix = IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT + "scimpi.help-suffix", "shtml");
             if (suffix == null || suffix.equals("")) {
                 suffix = "";
@@ -43,7 +44,7 @@ public class HelpLink {
                 suffix = "." + suffix;
             }
         }
-        
+
         if (helpReference == null || helpReference.equals("No help available")) {
             return "";
         } else {
@@ -51,7 +52,8 @@ public class HelpLink {
             String link = site + helpReference + suffix;
             String linkText = "Help";
             String target = "scimpi-help";
-            return "<a class=\"" + elementClass + "\" href=\"" + link + "\" target=\"" + target + "\" title=\"" + description + "\">" + linkText + "</a>";
+            return "<a class=\"" + elementClass + "\" href=\"" + link + "\" target=\"" + target + "\" title=\"" + description
+                    + "\"><img src=\"/images/help.png\" alt=\"" + linkText + "\" /></a>";
         }
     }