Update of 
/var/cvs/contributions/CMSContainer/cmsc/portal/src/java/com/finalist/cmsc/portalImpl
In directory 
james.mmbase.org:/tmp/cvs-serv13603/cmsc/portal/src/java/com/finalist/cmsc/portalImpl

Modified Files:
      Tag: b1_4
        PortalErrorServlet.java 
Added Files:
      Tag: b1_4
        InternalDispatchNavigationRequest.java 
Log Message:
CMSC-942 Several issues with the Alias module


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/portal/src/java/com/finalist/cmsc/portalImpl
See also: http://www.mmbase.org/jira/browse/CMSC-942


InternalDispatchNavigationRequest.java is new



Index: PortalErrorServlet.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/portal/src/java/com/finalist/cmsc/portalImpl/PortalErrorServlet.java,v
retrieving revision 1.11.2.2
retrieving revision 1.11.2.3
diff -u -b -r1.11.2.2 -r1.11.2.3
--- PortalErrorServlet.java     21 Apr 2008 10:11:28 -0000      1.11.2.2
+++ PortalErrorServlet.java     26 Jun 2008 08:19:40 -0000      1.11.2.3
@@ -79,8 +79,8 @@
               }
           }
           // The incoming request has a servletPath of /PortalError. The 
mapped url to this servlet.
-          // Pretend it is  the uri which has the error in itss
-          HttpServletRequest errorUriRequest = new 
ErrorHttpServletRequest(request, errorUri);
+          // Pretend it is  the uri which has the error in it
+          HttpServletRequest errorUriRequest = new 
InternalDispatchNavigationRequest(request, errorUri);
           
          PortalEnvironment env = new PortalEnvironment(errorUriRequest, 
response, config);
          PortalURL currentURL = env.getRequestedPortalURL();
@@ -104,10 +104,9 @@
                   }
                }
             }
-            if (errorPageSite != null) {
                 logError(request); 
-
-                HttpServletRequest errorRequest = new 
ErrorHttpServletRequest(request, errorPageSite.getUrlfragment(), 
String.valueOf(statusCode)); 
+            if (errorPageSite != null) {
+                HttpServletRequest errorRequest = new 
InternalDispatchNavigationRequest(request, errorPageSite.getUrlfragment(), 
String.valueOf(statusCode)); 
                 PortalEnvironment errorEnv = new 
PortalEnvironment(errorRequest, response, config);
 
                 response.setContentType(CONTENT_TYPE);
@@ -142,7 +141,6 @@
          rd.forward(request, response);
       }
       else {
-         logError(request);
          basicErrorPage(request, response);
       }
    }
@@ -163,12 +161,12 @@
 
    public void logError(HttpServletRequest request) {
       Integer statusCode = (Integer) request.getAttribute(ERROR_STATUS_CODE);
-      Throwable exception = (Throwable) request.getAttribute(ERROR_EXCEPTION);
       if (statusCode == 500) {
          String version = 
VersionUtil.getApplicationVersion(config.getServletContext());
          // prepare error ticket
          long ticket = System.currentTimeMillis();
 
+         Throwable exception = (Throwable) 
request.getAttribute(ERROR_EXCEPTION);
          String msg = HttpUtil.getErrorInfo(request, exception, ticket, 
version);
 
          String message = "";
@@ -181,41 +179,12 @@
          // write errors to mmbase log
          log.error(ticket + ":\n" + msg);
       }
+      if (statusCode == 404) {
+         if (!ServerUtil.isProduction()) {
+            String path = (String) request.getAttribute(ERROR_REQUEST_URI);
+            log.error("missing resource: " + path);
    }
-   
-   class ErrorHttpServletRequest extends HttpServletRequestWrapper {
-
-      private String errorPagePath;
-      private String serverName;
-
-
-      public ErrorHttpServletRequest(HttpServletRequest request, String 
errorServletPath) {
-          super(request);
-          this.errorPagePath = errorServletPath;
-      }
-      
-      public ErrorHttpServletRequest(HttpServletRequest request, String 
errorSitePath, String errorServletPath) {
-         super(request);
-         if (ServerUtil.useServerName()) {
-             serverName = errorSitePath;
-             errorPagePath = errorServletPath;
-         }
-         else {
-             this.errorPagePath = errorSitePath + PATH_SP + errorServletPath;
          }
       }
 
-      @Override
-      public String getServletPath() {
-         return errorPagePath;
-      }
-      
-      @Override
-      public String getServerName() {
-        if (serverName != null) {
-            return serverName;
-        }
-        return super.getServerName();
-      }
-   }
 }
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to