portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r772479 - in /portals/jetspeed-2/portal/trunk: applications/jetspeed/src/main/webapp/ applications/jetspeed/src/main/webapp/WEB-INF/ applications/jetspeed/src/main/webapp/WEB-INF/conf/ components/jetspeed-portal/src/main/java/org/apache/jet...
Date Thu, 07 May 2009 00:43:29 GMT
Author: ate
Date: Thu May  7 00:43:28 2009
New Revision: 772479

URL: http://svn.apache.org/viewvc?rev=772479&view=rev
Log:
JS2-992: New generic and extendable RequestDiagnostics feature
See: https://issues.apache.org/jira/browse/JS2-992

Added:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsFactory.java   (with props)
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsImpl.java   (with props)
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestDiagnostics.java   (with props)
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsHolder.java   (with props)
Modified:
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/conf/Log4j.properties
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/web.xml
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/server-diag.jsp
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/engine/JetspeedServlet.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/exception/JetspeedException.java

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/conf/Log4j.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/conf/Log4j.properties?rev=772479&r1=772478&r2=772479&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/conf/Log4j.properties (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/conf/Log4j.properties Thu May  7 00:43:28 2009
@@ -42,6 +42,12 @@
 
 
 #
+# Diagnostics Logfile
+#
+log4j.category.diagnostics = ERROR, diagnostics
+log4j.additivity.diagnostics = false
+
+#
 # Velocity Logfile
 #
 log4j.category.velocity = ERROR, velocity
@@ -93,6 +99,18 @@
 log4j.appender.jetspeed.layout.conversionPattern = %d [%t] %-5p %c - %m%n
 log4j.appender.jetspeed.append = false
 
+#
+# jetspeed-diagnostics.log
+#
+log4j.appender.diagnostics = org.apache.log4j.FileAppender
+log4j.appender.diagnostics.file = ${org.apache.portals.jetspeed-2.applicationRoot}/logs/jetspeed-diagnostics.log
+log4j.appender.diagnostics.layout = org.apache.log4j.PatternLayout
+log4j.appender.diagnostics.layout.conversionPattern = %d [%t] %-5p %c - %m%n
+log4j.appender.diagnostics.append = false
+
+#
+# digester.log
+#
 log4j.appender.digester = org.apache.log4j.FileAppender
 log4j.appender.digester.file = ${org.apache.portals.jetspeed-2.applicationRoot}/logs/digester.log
 log4j.appender.digester.layout = org.apache.log4j.PatternLayout

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/web.xml?rev=772479&r1=772478&r2=772479&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/web.xml (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/web.xml Thu May  7 00:43:28 2009
@@ -87,6 +87,10 @@
       <param-name>applicationRoot</param-name>
       <param-value>webContext</param-value>
     </init-param>
+    <init-param>
+      <param-name>errorHandlerPath</param-name>
+      <param-value>/diagnostics</param-value>
+    </init-param>    
     <load-on-startup>1</load-on-startup>
   </servlet>
 

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/server-diag.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/server-diag.jsp?rev=772479&r1=772478&r2=772479&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/server-diag.jsp (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/server-diag.jsp Thu May  7 00:43:28 2009
@@ -14,27 +14,59 @@
 See the License for the specific language governing permissions and
 limitations under the License.
 --%>
+<%-- 
+This page is meant to be used for diagnostics when the portal becomes unavailable
+TODO: provide other diagnostic information, Heap Usage, Number of users 
+--%>
+<%@page import="org.apache.jetspeed.PortalReservedParameters" session="false"%>
+<%@page import="org.apache.jetspeed.request.RequestDiagnostics"%>
+<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
 <html>
   <title>Portal Diagnostic Information</title>
   <body>
-  <h2>Portal Diagnostic Information</h2>
-	<p>
-	<b>General Message: <%= request.getSession().getAttribute("org.apache.portals.jestspeed.diagnostics") %></b>
-	</p>
-	<p>
-	  To return to the server, click here: <a href='<%= request.getContextPath() + "/portal" %>'>Return to Server</a>
-	</p>
-    <h3>Server Information:</h3>
-	<p>
-	<ul>
-		<li>Free Memory (KB): <%= Runtime.getRuntime().freeMemory()/1024 %></li>
-		<li>Total Memory (KB): <%= Runtime.getRuntime().totalMemory()/1024  %></li>
-	</ul>
-	</p>
-<!-- 
-This page is meant to be used for diagnostics when the portal becomes unavailable
-TODO: provide other diagnostic information, Heap Usage, Number of users 
--->
+  <%-- ensure no session is created --%>
+  <% if (request.getSession(false) != null)
+     {
+       pageContext.setAttribute("rd",request.getSession().getAttribute(PortalReservedParameters.REQUEST_DIAGNOSTICS_ATTRIBUTE));
+     } 
+  %>
+  <c:if test="${rd != null}">
+    <h2>Request Error Diagnostics</h2>
+    <table border="0">
+      <tr><td><b>Error ID</b></td><td>&nbsp;&nbsp;&nbsp;</td><td><c:out value="${rd.id}"/></td></tr>
+      <tr><td><b>Message</b></td><td></td><td><c:out value="${rd.errorDescription}"/></td></tr>
+    <c:if test="${rd.path != null}">
+      <tr><td><b>Path</b></td><td></td><td><c:out value="${rd.path}"/></td></tr>
+    </c:if>
+    <c:if test="${rd.userPrincipalName != null}">
+      <tr><td><b>User</b></td><td></td><td><c:out value="${rd.userPrincipalName}"/></td></tr>
+    </c:if>
+    <c:if test="${rd.portletApplicationName != null}">
+      <tr><td><b>Application</b></td><td></td><td><c:out value="${rd.portletApplicationName}"/></td></tr>
+    </c:if>
+    <c:if test="${rd.portletName != null}">
+      <tr><td><b>Portlet</b></td><td></td><td><c:out value="${rd.portletName}"/></td></tr>
+    </c:if>
+    <c:if test="${rd.portletWindowId != null}">
+      <tr><td><b>Window ID</b></td><td></td><td><c:out value="${rd.portletWindowId}"/></td></tr>
+    </c:if>
+    </table>
+    <p>
+      Click <a href='javascript:history.go(-1)'>here</a> to go back to the previous page.
+    </p>
+  </c:if>
+  <c:choose>
+    <%-- only show Server Status either on when already showing a RequestDiagnostics or when logged in --%>
+    <c:when test="${rd != null || pageContext.request.userPrincipal != null}">
+      <h3>Server Status</h3>
+      <table border="0">
+        <tr><td><b>Free Memory (KB)</b></td><td>&nbsp;&nbsp;&nbsp;</td><td><%= Runtime.getRuntime().freeMemory()/1024 %></td></tr>
+        <tr><td><b>Total Memory (KB)</b></td><td></td><td><%= Runtime.getRuntime().totalMemory()/1024  %></td></tr>
+      </table>
+    </c:when>
+    <c:otherwise>
+      <p>Please <a href='<c:url value="/"/>'>login</a></p>
+    </c:otherwise>
+  </c:choose>
   </body>
 </html> 
-

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/engine/JetspeedServlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/engine/JetspeedServlet.java?rev=772479&r1=772478&r2=772479&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/engine/JetspeedServlet.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/engine/JetspeedServlet.java Thu May  7 00:43:28 2009
@@ -28,6 +28,7 @@
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
 import javax.servlet.http.HttpSessionEvent;
 import javax.servlet.http.HttpSessionListener;
 
@@ -50,6 +51,9 @@
 import org.apache.jetspeed.pipeline.valve.SecurityValve;
 import org.apache.jetspeed.request.RequestContext;
 import org.apache.jetspeed.request.RequestContextComponent;
+import org.apache.jetspeed.request.RequestDiagnostics;
+import org.apache.jetspeed.request.RequestDiagnosticsFactory;
+import org.apache.jetspeed.request.RequestDiagnosticsHolder;
 import org.apache.jetspeed.security.SubjectHelper;
 import org.apache.jetspeed.security.UserSubjectPrincipal;
 import org.apache.jetspeed.services.JetspeedPortletServices;
@@ -62,9 +66,7 @@
  * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor </a>
  * @version $Id$
  */
-public class JetspeedServlet 
-extends HttpServlet 
-implements JetspeedEngineConstants, HttpSessionListener
+public class JetspeedServlet extends HttpServlet implements JetspeedEngineConstants, HttpSessionListener
 {
     private static Logger log;
     private static Logger console;
@@ -85,6 +87,18 @@
      * Should initialization activities be performed during doGet() execution?
      */
     private static boolean firstDoGet = true;
+    
+    /**
+     * The servlet init parameter name providing the portal url path mapped to a error handler servlet/jsp
+     * for handling request processing exceptions thrown.
+     */
+    private static final String ERROR_HANDLER_PATH_PARM = "errorHandlerPath";
+
+    /**
+     * The default portal url path used as error handler servlet/jsp when the ERROR_HANDLER_PATH_PARAM
+     * servlet init parameter isn't configured
+     */
+    private static final String DEFAULT_ERROR_HANDLER_PATH = "/diagnostics";
 
     /**
      * The Jetspeed Engine
@@ -248,8 +262,13 @@
      */
     public final void doGet( HttpServletRequest req, HttpServletResponse res ) throws IOException, ServletException
     {
+        // define RequestContext here to allow protential usage and state processing in case of an exception
+        // in outer catch errorHandler method call
+        RequestContext context = null;
         try
         {
+            cleanupError(req);
+            
             // Check to make sure that we started up properly.
             if (initFailure != null)
             {
@@ -275,7 +294,6 @@
                 res.setHeader("Expires", "0");                               // HTTP/1.0 browser/proxy
 
                 // send request through pipeline
-                RequestContext context = null;
                 try
                 {
                     context = contextComponent.create(req, res, getServletConfig());
@@ -290,10 +308,7 @@
         }
         catch (Throwable e)
         {            
-            final String msg = "Fatal error encountered while processing portal request: "+e.getMessage();
-            log.error(msg, e);
-            req.getSession(true).setAttribute("org.apache.portals.jestspeed.diagnostics", e.getLocalizedMessage());
-            res.sendRedirect(req.getContextPath() + "/diagnostics");
+            handleError(req, res, context, e);
         }
     }
 
@@ -407,4 +422,64 @@
         UserContentCacheManager userContentCacheManager = (UserContentCacheManager)engine.getComponentManager().getComponent("userContentCacheManager");
         userContentCacheManager.evictUserContentCache(subjectUserPrincipal.getName(), se.getSession().getId());
     }
+           
+    /**
+     * Extendable and overridable default main request error handling method.
+     * <p>
+     * Be aware: the context parameter might not (yet) be initialized, or not anymore here, so it should always
+     * be checked against null. Furthermore, not all RequestContext methods might be valid to use or call (anymore) either.
+     * </p>
+     * @param req the original portal request
+     * @param res the original portal response
+     * @param context the context created for handling this request
+     * @param e the exception as occurred 
+     * @throws IOException
+     * @throws ServletException
+     */
+    protected void handleError(HttpServletRequest req, HttpServletResponse res, RequestContext context, Throwable t) throws IOException, ServletException
+    {
+        String errorHandlerPath = getInitParameter(ERROR_HANDLER_PATH_PARM);
+        if (errorHandlerPath == null || errorHandlerPath.trim().length() == 0)
+        {
+            errorHandlerPath = DEFAULT_ERROR_HANDLER_PATH;
+        }
+        final String msg = "Request error encountered while processing portal request: "+t.getMessage();
+        log.error(msg, t);
+        
+        // try to unwind and see if an Exception was thrown containing a RequestDiagnostics
+        RequestDiagnostics rd = null;
+        Throwable e = t;
+        do
+        {
+            if (e instanceof RequestDiagnosticsHolder && ((RequestDiagnosticsHolder)e).getRequestDiagnostics() != null)
+            {
+                rd = ((RequestDiagnosticsHolder)e).getRequestDiagnostics();
+                break;
+            }
+            e = e.getCause();
+        }
+        while (e != null);
+        
+        if (rd == null)
+        {
+            rd = RequestDiagnosticsFactory.newRequestDiagnostics();
+        }
+        RequestDiagnosticsFactory.fillInRequestContext(rd, req, context, t);
+        rd.logAsError();
+        req.getSession(true).setAttribute(PortalReservedParameters.REQUEST_DIAGNOSTICS_ATTRIBUTE, rd);
+        res.sendRedirect(req.getContextPath() + errorHandlerPath);
+    }
+    
+    /**
+     * Cleanup errorHandler state usefull if/when the errorHandler stores error state within the session
+     * @param req
+     */
+    protected void cleanupError(HttpServletRequest req)
+    {
+        HttpSession session = req.getSession(false);
+        if (session != null)
+        {
+            session.removeAttribute(PortalReservedParameters.REQUEST_DIAGNOSTICS_ATTRIBUTE);
+        }
+    }
 }

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsFactory.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsFactory.java?rev=772479&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsFactory.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsFactory.java Thu May  7 00:43:28 2009
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.request;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.jetspeed.container.PortletWindow;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * RequestDiagnosticsFactory provides a static factory method for creating a RequestDiagnostics instance.
+ * <p>
+ * In addition, it provides some convenience methods for filling in part of the diagnostics state.
+ * </p>
+ * @version $Id$
+ *
+ */
+public class RequestDiagnosticsFactory
+{
+    private static final Logger logger = LoggerFactory.getLogger("diagnostics");
+    
+    static Logger getLogger()
+    {
+        return logger;
+    }
+    
+    public static boolean isInfoLoggingEnabled()
+    {
+        return logger.isInfoEnabled();
+    }
+
+    public static boolean isWarnLoggingEnabled()
+    {
+        return logger.isWarnEnabled();
+    }
+    
+    public static boolean isErrorLoggingEnabled()
+    {
+        return logger.isErrorEnabled();
+    }
+
+    public static boolean isDebugLoggingEnable()
+    {
+        return logger.isDebugEnabled();
+    }
+
+    public static boolean isTraceLoggingEnable()
+    {
+        return logger.isTraceEnabled();
+    }
+    
+    public static RequestDiagnostics newRequestDiagnostics()
+    {
+        return new RequestDiagnosticsImpl();
+    }
+    
+    public static void fillInPortletWindow(RequestDiagnostics rd, PortletWindow pw, Throwable e)
+    {
+        if (pw != null)
+        {
+            rd.setPortletWindowId(pw.getWindowId());
+            PortletDefinition pd = pw.getPortletDefinition();
+            rd.setPortletApplicationName(pd.getApplication().getName());
+            rd.setPortletName(pd.getPortletName());
+        }
+        if (e != null)
+        {
+            fillInException(rd, e);
+        }
+    }
+    
+    public static void fillInRequestContext(RequestDiagnostics rd, HttpServletRequest req, RequestContext context, Throwable e)
+    {
+        if (req != null)
+        {
+            if (rd.getServer() == null)
+            {           
+                StringBuilder sb = new StringBuilder();
+                sb.append(req.getScheme()).append("://").append(req.getServerName()).append(":").append(req.getServerPort());
+                rd.setServer(sb.toString());
+            }
+            if (rd.getRemoteAddr() == null)
+            {
+                rd.setRemoteAddr(req.getRemoteAddr());
+            }
+            if (rd.getLocalAddr() == null)
+            {
+                rd.setLocalAddr(req.getLocalAddr());
+            }
+            if (rd.getContextPath() == null)
+            {
+                rd.setContextPath(req.getContextPath());
+            }
+            if (rd.getServletPath() == null)
+            {
+                rd.setServletPath(req.getServletPath());            
+            }
+            if (rd.getPathInfo() == null)
+            {
+                rd.setPathInfo(req.getPathInfo());
+            }
+            if (rd.getQueryString() == null)
+            {
+                rd.setQueryString(req.getQueryString());
+            }
+            if (rd.getRequestURI() == null)
+            {
+                rd.setRequestURI(req.getRequestURI());
+            }
+            if (rd.getRequestMethod() == null)
+            {
+                rd.setRequestMethod(req.getMethod());
+            }
+            if (rd.getPagePath() == null && context != null && context.getPortalURL() != null)
+            {
+                rd.setPagePath(context.getPortalURL().getPath());
+            }
+            if (rd.getPageId() == null && context != null && context.getPage() != null)
+            {
+                rd.setPageId(context.getPage().getId());
+            }
+            if (rd.getPortalURLType() == null && context != null && context.getPortalURL() != null)
+            {
+                rd.setPortalURLType(context.getPortalURL().getNavigationalState().getURLType());
+            }
+            if (rd.getUserPrincipalName() == null && req.getUserPrincipal() != null)
+            {
+                rd.setUserPrincipalName(req.getUserPrincipal().getName());
+            }
+        }
+        if (e != null)
+        {
+            fillInException(rd, e);
+        }
+    }
+    
+    public static void fillInException(RequestDiagnostics rd, Throwable e)
+    {
+        if (e != null)
+        {
+            if (rd.getException() == null)
+            {
+                rd.setException(e);
+            }
+            if (rd.getCause() == null)
+            {
+                Throwable t = rd.getException();
+                while (t.getCause() != null)
+                {
+                    t = t.getCause();
+                }
+                rd.setCause(t);
+            }
+            if (rd.getErrorMessage() == null)
+            {
+                rd.setErrorMessage(rd.getCause().toString());
+            }
+        }
+    }
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsFactory.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsImpl.java?rev=772479&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsImpl.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsImpl.java Thu May  7 00:43:28 2009
@@ -0,0 +1,742 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.request;
+
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.jetspeed.container.url.PortalURL;
+import org.slf4j.Logger;
+
+/**
+ * Default implementation of the RequestDiagnostics
+ * @version $Id$
+ *
+ */
+public class RequestDiagnosticsImpl implements RequestDiagnostics
+{
+    private static final long serialVersionUID = -2516862911706710811L;
+    
+    private static final Logger logger = RequestDiagnosticsFactory.getLogger();
+    
+    protected static enum LogLevel { INFO, WARNING, ERROR, DEBUG, TRACE };
+    
+    private static long idBase = System.currentTimeMillis();
+    
+    protected static final String LOG_LINE_PREFIX = "  ";
+    protected static final String LOG_FIELD_POSTFIX = ": ";
+    protected static final String DATE_FORMAT = "z yyyy-MM-dd HH:mm:ss:SSS";
+    protected static final String LINE_SEPARATOR = System.getProperty("line.separator");
+    
+    private final String id;
+    private final String timeRecorded;
+    private final String thread;
+    private boolean internal;
+    private String server;
+    private String remoteAddr;
+    private String localAddr;
+    private String contextPath;
+    private String servletPath;
+    private String pathInfo;
+    private String queryString;
+    private String requestURI;
+    private String requestMethod;
+    private String pagePath;
+    private String pageId;
+    private PortalURL.URLType portalURLType;
+    private String portletApplicationName;
+    private String portletName;
+    private String portletWindowId;
+    private String userPrincipalName;
+    private Throwable exception;
+    private Throwable cause;
+    private String errorMessage;
+    private String errorDescription;
+    private Map<String,Serializable> attributes;
+
+    private transient StringBuilder logBuilder;
+    private transient LogLevel logLevel;
+    
+    public RequestDiagnosticsImpl()
+    {
+        this(nextId());
+    }
+    
+    private static String nextId()
+    {
+        long nextId;
+        synchronized (RequestDiagnosticsImpl.class)
+        {
+            nextId = idBase++;
+        }
+        // create shortest possible long.toString() representation
+        return Long.toString(nextId, Character.MAX_RADIX).toUpperCase();
+    }
+    
+    protected RequestDiagnosticsImpl(String id)
+    {
+        this.id = id;
+        this.timeRecorded = formatDate(new Date());
+        this.thread = Thread.currentThread().toString();
+    }
+    
+    public String getId()
+    {
+        return id;
+    }
+    public String getTimeRecorded()
+    {
+        return timeRecorded;
+    }
+    public String getThread()
+    {
+        return thread;
+    }
+    public boolean isInternal()
+    {
+        return internal;
+    }
+    public void setInternal(boolean internal)
+    {
+        this.internal = internal;
+    }
+    public String getServer()
+    {
+        return server;
+    }
+    public void setServer(String server)
+    {
+        this.server = server;
+    }
+    public String getRemoteAddr()
+    {
+        return remoteAddr;
+    }
+    public void setRemoteAddr(String remoteAddr)
+    {
+        this.remoteAddr = remoteAddr;
+    }
+    public String getLocalAddr()
+    {
+        return localAddr;
+    }
+    public void setLocalAddr(String localAddr)
+    {
+        this.localAddr = localAddr;
+    }
+    public String getContextPath()
+    {
+        return contextPath;
+    }
+    public void setContextPath(String contextPath)
+    {
+        this.contextPath = contextPath;
+    }
+    public String getServletPath()
+    {
+        return servletPath;
+    }
+    public void setServletPath(String servletPath)
+    {
+        this.servletPath = servletPath;
+    }
+    public String getPathInfo()
+    {
+        return pathInfo;
+    }
+    public void setPathInfo(String pathInfo)
+    {
+        this.pathInfo = pathInfo;
+    }
+    public String getQueryString()
+    {
+        return queryString;
+    }
+    public void setQueryString(String queryString)
+    {
+        this.queryString = queryString;
+    }
+    public String getRequestURI()
+    {
+        return requestURI;
+    }
+    public void setRequestURI(String requestURI)
+    {
+        this.requestURI = requestURI;
+    }
+    public String getRequestMethod()
+    {
+        return requestMethod;
+    }
+    public void setRequestMethod(String method)
+    {
+        this.requestMethod = method;
+    }
+    public String getPagePath()
+    {
+        return pagePath;
+    }
+    public void setPagePath(String pagePath)
+    {
+        this.pagePath = pagePath;
+    }
+    public String getPageId()
+    {
+        return pageId;
+    }
+    public void setPageId(String pageId)
+    {
+        this.pageId = pageId;
+    }
+    public String getPath()
+    {
+        if (contextPath != null)
+        {
+            StringBuilder sb = new StringBuilder(contextPath);
+            if (servletPath != null)
+            {
+                sb.append(servletPath);
+            }
+            if (pagePath != null)
+            {
+                sb.append(pagePath);
+            }
+            return sb.toString();
+        }
+        return null;
+    }
+    public PortalURL.URLType getPortalURLType()
+    {
+        return portalURLType;
+    }
+    public void setPortalURLType(PortalURL.URLType portalURLType)
+    {
+        this.portalURLType = portalURLType;
+    }
+    public String getPortletApplicationName()
+    {
+        return portletApplicationName;
+    }
+    public void setPortletApplicationName(String portletApplicationName)
+    {
+        this.portletApplicationName = portletApplicationName;
+    }
+    public String getPortletName()
+    {
+        return portletName;
+    }
+    public void setPortletName(String portletName)
+    {
+        this.portletName = portletName;
+    }
+    public String getPortletWindowId()
+    {
+        return portletWindowId;
+    }
+    public void setPortletWindowId(String portletWindowId)
+    {
+        this.portletWindowId = portletWindowId;
+    }
+    public String getUserPrincipalName()
+    {
+        return userPrincipalName;
+    }
+    public void setUserPrincipalName(String userPrincipalName)
+    {
+        this.userPrincipalName = userPrincipalName;
+    }
+    public Throwable getException()
+    {
+        return exception;
+    }
+    public void setException(Throwable exception)
+    {
+        this.exception = exception;
+    }
+    public Throwable getCause()
+    {
+        return cause;
+    }
+    public void setCause(Throwable cause)
+    {
+        this.cause = cause;
+    }
+    public String getErrorMessage()
+    {
+        return errorMessage;
+    }
+    public void setErrorMessage(String errorMessage)
+    {
+        this.errorMessage = errorMessage;
+    }    
+    public String getErrorDescription()
+    {
+        return errorDescription != null ? errorDescription : errorMessage;
+    }
+    public void setErrorDescription(String value)
+    {
+        this.errorDescription = value;
+    }
+    public boolean isAttributesEmpty()
+    {
+        return attributes == null || attributes.isEmpty();
+    }
+    public Map<String, Serializable> getAttributes()
+    {
+        if (attributes == null)
+        {
+            attributes = new TreeMap<String,Serializable>();
+        }
+        return attributes;
+    }
+    
+    public void logAsInfo()
+    {
+        if (logger.isInfoEnabled())
+        {
+            log(LogLevel.INFO);
+        }
+    }
+
+    public void logAsWarning()
+    {
+        if (logger.isWarnEnabled())
+        {
+            log(LogLevel.WARNING);
+        }
+    }
+    
+    public void logAsError()
+    {
+        if (logger.isErrorEnabled())
+        {
+            log(LogLevel.ERROR);
+        }
+    }
+
+    public void logAsDebug()
+    {
+        if (logger.isDebugEnabled())
+        {
+            log(LogLevel.DEBUG);
+        }
+    }
+
+    public void logAsTrace()
+    {
+        if (logger.isTraceEnabled())
+        {
+            log(LogLevel.TRACE);
+        }
+    }
+    
+    protected String formatDate(Date date)
+    {
+        return new SimpleDateFormat(DATE_FORMAT).format(date);
+    }
+
+    protected void createLog(LogLevel level)
+    {
+        logBuilder = new StringBuilder();
+        logLevel = level;
+    }
+    
+    protected LogLevel getCurrentLogLevel()
+    {
+        return logLevel;
+    }
+    
+    protected void initLog()
+    {
+        logBuilder.append(LINE_SEPARATOR).append(LINE_SEPARATOR);
+    }
+    
+    protected void writeLog()
+    {
+        if (logBuilder != null && logBuilder.length() > 0)
+        {
+            LogLevel level = getCurrentLogLevel();
+            if (LogLevel.INFO == level)
+            {
+                logger.info(logBuilder.toString());
+            }
+            else if (LogLevel.WARNING == level)
+            {
+                logger.warn(logBuilder.toString());
+            }
+            else if (LogLevel.ERROR == level)
+            {
+                logger.error(logBuilder.toString());
+            }
+            else if (LogLevel.DEBUG == level)
+            {
+                logger.debug(logBuilder.toString());
+            }
+            else if (LogLevel.TRACE == level)
+            {
+                logger.trace(logBuilder.toString());
+            }
+        }
+    }
+    
+    protected void finalizeLog()
+    {
+    }
+    
+    protected void closeLog()
+    {
+        logBuilder = null;
+        logLevel = null;
+    }
+    
+    protected void log(LogLevel level)
+    {
+        try
+        {            
+            createLog(level);
+            initLog();
+            logElements();
+            finalizeLog();
+            writeLog();
+        }
+        finally
+        {
+            closeLog();
+        }
+    }
+
+    protected void logElements()
+    {
+        logId();
+        logTimeRecorded();
+        logThread();
+        logInternal();
+        logUserPrincipalName();
+        logServer();
+        logRemoteAddr();
+        logLocalAddr();
+        logContextPath();
+        logServletPath();
+        logPathInfo();
+        logQueryString();
+        logRequestURI();
+        logPortalURLType();
+        logRequestMethod();
+        logPagePath();
+        logPageId();
+        logPortletApplicationName();
+        logPortletName();
+        logPortletWindowId();
+        logErrorDescription();
+        logErrorMessage();
+        logException();
+        logCause();
+        logAttributes();
+    }
+    
+    protected void logId()
+    {
+        addElementToLog("Id", id, true);
+    }
+    
+    protected void logTimeRecorded()
+    {
+        addElementToLog("Time", timeRecorded, true);
+    }
+    
+    protected void logThread()
+    {
+        addElementToLog("Thread", thread, true);
+    }
+    
+    protected void logInternal()
+    {
+        addElementToLog("Internal", Boolean.toString(internal), true);
+    }
+    
+    protected void logServer()
+    {
+        addElementToLog("Server", server, false);
+    }
+    
+    protected void logRemoteAddr()
+    {
+        addElementToLog("Remote IP address", remoteAddr, false);
+    }
+    
+    protected void logLocalAddr()
+    {
+        addElementToLog("Local IP address", localAddr, false);
+    }
+    
+    protected void logContextPath()
+    {
+        addElementToLog("Context path", contextPath, false);
+    }
+    
+    protected void logServletPath()
+    {
+        addElementToLog("Servlet path", servletPath, false);
+    }
+    
+    protected void logPathInfo()
+    {
+        addElementToLog("Path info", pathInfo, false);
+    }
+    
+    protected void logQueryString()
+    {
+        addElementToLog("Query string", queryString, false);
+    }
+    
+    protected void logRequestURI()
+    {
+        addElementToLog("Request URI", requestURI, false);
+    }
+    
+    protected void logRequestMethod()
+    {
+        addElementToLog("Request method", requestMethod, false);
+    }
+    
+    protected void logPagePath()
+    {
+        addElementToLog("Page path", pagePath, false);
+    }
+    
+    protected void logPageId()
+    {
+        addElementToLog("Page id", pageId, false);
+    }
+    
+    protected void logPortalURLType()
+    {
+        if (portalURLType != null)
+        {
+            addElementToLog("URL type", portalURLType.toString(), true);
+        }
+    }
+    
+    protected void logPortletApplicationName()
+    {
+        addElementToLog("Portlet application", portletApplicationName, false);
+    }
+    
+    protected void logPortletName()
+    {
+        addElementToLog("Portlet", portletName, false);
+    }
+    
+    protected void logPortletWindowId()
+    {
+        addElementToLog("Portlet window id", portletWindowId, false);
+    }
+    
+    protected void logUserPrincipalName()
+    {
+        addElementToLog("User", userPrincipalName, false);
+    }
+    
+    protected void logErrorDescription()
+    {
+        addElementToLog("Error description", errorDescription, false);
+    }
+    
+    protected void logErrorMessage()
+    {
+        addElementToLog("Error message", errorMessage, false);
+    }
+    
+    protected void logException()
+    {
+        if (exception != null)
+        {
+            addElementExceptionToLog("Exception", exception);
+        }
+    }
+    
+    protected void logCause()
+    {
+        if (cause != null && exception == null)
+        {
+            addElementExceptionToLog("Cause", cause);
+        }
+    }
+    
+    protected void logAttributes()
+    {
+        if (!isAttributesEmpty())
+        {
+            addElementToLog("Attributes", null, true);
+            int seq = 0;
+            for (Map.Entry<String,Serializable> entry : getAttributes().entrySet())
+            {
+                addElementDetailToLog("Attributes", 
+                                      entry.getKey(), 
+                                      entry.getValue() != null ? entry.getValue().toString() : null, 
+                                      seq++);
+            }
+        }
+    }
+    
+
+    protected void addLinePrefixToLog(int num)
+    {
+        for (int i = 0; i < num; i++)
+        {
+            logBuilder.append(LOG_LINE_PREFIX);
+        }
+    }
+    
+    protected void addElementToLog(String element, String value, boolean empty)
+    {
+        if (empty || value != null)
+        {
+            logBuilder.append(LOG_LINE_PREFIX);
+            logBuilder.append(element);
+            logBuilder.append(LOG_FIELD_POSTFIX);
+            if (value != null)
+            {
+                logBuilder.append(value);
+            }
+            logBuilder.append(LINE_SEPARATOR);
+        }
+    }
+    
+    protected void addElementDetailToLog(String element, String detail, String value, int seq)
+    {
+        logBuilder.append(LOG_LINE_PREFIX);
+        logBuilder.append(LOG_LINE_PREFIX);
+        logBuilder.append(detail);
+        logBuilder.append(LOG_FIELD_POSTFIX);
+        if (value != null)
+        {
+            logBuilder.append(value);
+        }
+        logBuilder.append(LINE_SEPARATOR);
+    }    
+    
+    protected void addElementExceptionToLog(String element, Throwable t)
+    {
+        try
+        {
+            logBuilder.append(LOG_LINE_PREFIX);
+            logBuilder.append(element);
+            logBuilder.append(LOG_FIELD_POSTFIX);
+            if (t != null)
+            {
+                logBuilder.append(t.toString());
+                logBuilder.append(LINE_SEPARATOR);
+                
+                // Throwable logging borrowed from Harmony Throwable.java
+                StackTraceElement[] stackTrace = t.getStackTrace();
+                if (stackTrace != null && stackTrace.length != 0)
+                {
+                    for (int i = 0; i < stackTrace.length; i++)
+                    {
+                        logBuilder.append(LOG_LINE_PREFIX).append(LOG_LINE_PREFIX);
+                        logBuilder.append("at: ").append(stackTrace[i].toString());
+                        logBuilder.append(LINE_SEPARATOR);
+                    }
+                }
+                else
+                {
+                    logBuilder.append(LOG_LINE_PREFIX).append(LOG_LINE_PREFIX);
+                    logBuilder.append("<no stack trace available>");
+                    logBuilder.append(LINE_SEPARATOR);
+                }
+                Throwable wCause = t;
+                int prefixLevel = 2;
+                while (wCause != wCause.getCause() && wCause.getCause() != null)
+                {
+                    StackTraceElement[] parentStackTrace = wCause.getStackTrace();
+                    wCause = wCause.getCause();
+                    addLinePrefixToLog(prefixLevel);
+                    logBuilder.append("caused by: ").append(wCause.toString());
+                    logBuilder.append(LINE_SEPARATOR);
+                    prefixLevel++;
+                    StackTraceElement[] causeStackTrace = wCause.getStackTrace();
+                    if (causeStackTrace != null && causeStackTrace.length != 0)
+                    {
+                        if (parentStackTrace == null || parentStackTrace.length == 0)
+                        {
+                            for (int i = 0; i < causeStackTrace.length; i++)
+                            {
+                                addLinePrefixToLog(prefixLevel);
+                                logBuilder.append("at: ").append(causeStackTrace[i].toString());
+                                logBuilder.append(LINE_SEPARATOR);
+                            }
+                        }
+                        else
+                        {
+                            int thisCount = causeStackTrace.length - 1;
+                            int parentCount = parentStackTrace.length - 1;
+                            int framesEqual = 0;
+                            while (parentCount > -1 && thisCount > -1) 
+                            {
+                                if (causeStackTrace[thisCount].equals(parentStackTrace[parentCount]))
+                                {
+                                    framesEqual++;
+                                    thisCount--;
+                                    parentCount--;
+                                } 
+                                else
+                                {
+                                    break;
+                                }
+                            }
+                            if (framesEqual > 1)
+                            { //to conform with the spec and the common practice (F1F1EE)
+                                framesEqual--;
+                            }
+                            int len = causeStackTrace.length - framesEqual;
+                            for (int i = 0; i < len; i++)
+                            {
+                                addLinePrefixToLog(prefixLevel);
+                                logBuilder.append("at: ").append(causeStackTrace[i].toString());
+                                logBuilder.append(LINE_SEPARATOR);
+                            }
+                            if (framesEqual > 0)
+                            {
+                                addLinePrefixToLog(prefixLevel);
+                                logBuilder.append("... ").append(framesEqual).append(" more");
+                                logBuilder.append(LINE_SEPARATOR);
+                            }
+                        }
+                    } 
+                    else 
+                    {
+                        addLinePrefixToLog(prefixLevel);
+                        logBuilder.append("<no stack trace available>");
+                        logBuilder.append(LINE_SEPARATOR);
+                    }
+                }
+            }
+            else
+            {
+                logBuilder.append(LINE_SEPARATOR);
+            }
+        }
+        catch (Exception e)
+        {
+            // what to do???
+        }
+    }
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java?rev=772479&r1=772478&r2=772479&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java (original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java Thu May  7 00:43:28 2009
@@ -44,6 +44,7 @@
     public static final String PAGE_EDIT_ACCESS_ATTRIBUTE = "org.apache.jetspeed.decoration.PageEditAccess";
     public static final String SESSION_KEY_SUBJECT = "org.apache.jetspeed.security.subject";
     public static final String REQUEST_CONTEXT_ATTRIBUTE = "org.apache.jetspeed.request.RequestContext";
+    public static final String REQUEST_DIAGNOSTICS_ATTRIBUTE = "org.apache.jetspeed.request.RequestDiagnostics";
     public static final String REQUEST_CONTEXT_OBJECTS = "org.apache.jetspeed.request.RequestContextObjects";
     public static final String FRAGMENT_ATTRIBUTE = "org.apache.jetspeed.Fragment";
     public static final String MAXIMIZED_FRAGMENT_ATTRIBUTE = "org.apache.jetspeed.maximized.Fragment";    

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/exception/JetspeedException.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/exception/JetspeedException.java?rev=772479&r1=772478&r2=772479&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/exception/JetspeedException.java (original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/exception/JetspeedException.java Thu May  7 00:43:28 2009
@@ -20,6 +20,8 @@
 import java.util.ResourceBundle;
 
 import org.apache.jetspeed.i18n.KeyedMessage;
+import org.apache.jetspeed.request.RequestDiagnostics;
+import org.apache.jetspeed.request.RequestDiagnosticsHolder;
 
 
 /**
@@ -30,11 +32,12 @@
  * @version $Id$
  **/
 
-public class JetspeedException extends Exception 
+public class JetspeedException extends Exception implements RequestDiagnosticsHolder
 {
     public static final String KEYED_MESSAGE_BUNDLE = "org.apache.jetspeed.exception.JetspeedExceptionMessages";
     
     private KeyedMessage keyedMessage;
+    private RequestDiagnostics rd;
     
     public JetspeedException() 
     {
@@ -99,4 +102,14 @@
         }
         return super.getMessage();
     }
+    
+    public void setRequestDiagnostics(RequestDiagnostics rd)
+    {
+        this.rd = rd;
+    }
+    
+    public RequestDiagnostics getRequestDiagnostics()
+    {
+        return rd;
+    }
 }

Added: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestDiagnostics.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestDiagnostics.java?rev=772479&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestDiagnostics.java (added)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestDiagnostics.java Thu May  7 00:43:28 2009
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.request;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Map;
+
+import org.apache.jetspeed.container.url.PortalURL;
+
+/**
+ * Base Portal Request Diagnostics view to be provided to a pluggable DiagnosticsServlet/JSP
+ * to handle a Portal Request error.
+ * <p>
+ * Because this RequestDiagnostics view might get stored (temporarily) in the session and the
+ * DiagnosticsServlet might get redirected too, this view captures most common and important
+ * request state as Serializable data.
+ * </p>
+ * <p>
+ * In addition, there is also an auxillary attributes Map which can be used to add additional
+ * data to be passed on to the DiagnosticsServlet without immediate need to extend this interface,
+ * although that's possible too of course.
+ * </p>
+ * @version $Id$
+ */
+public interface RequestDiagnostics extends Serializable
+{
+    String getId();
+    String getTimeRecorded();
+    String getThread();
+    boolean isInternal();
+    void setInternal(boolean internal);
+    String getServer();
+    void setServer(String value);
+    String getRemoteAddr();
+    void setRemoteAddr(String value);
+    String getLocalAddr();
+    void setLocalAddr(String value);
+    String getContextPath();
+    void setContextPath(String value);
+    String getServletPath();
+    void setServletPath(String value);
+    String getPathInfo();
+    void setPathInfo(String value);
+    String getQueryString();
+    void setQueryString(String value);
+    String getRequestURI();
+    void setRequestURI(String value);
+    String getRequestMethod();
+    void setRequestMethod(String value);
+    String getPagePath();
+    void setPagePath(String value);
+    String getPageId();
+    void setPageId(String value);
+    String getPath();
+    PortalURL.URLType getPortalURLType();
+    void setPortalURLType(PortalURL.URLType value);
+    String getPortletApplicationName();
+    void setPortletApplicationName(String value);
+    String getPortletName();
+    void setPortletName(String value);
+    String getPortletWindowId();
+    void setPortletWindowId(String value);
+    String getUserPrincipalName();
+    void setUserPrincipalName(String value);
+    Throwable getException();
+    void setException(Throwable value);
+    Throwable getCause();
+    void setCause(Throwable value);
+    String getErrorMessage();
+    void setErrorMessage(String value);
+    String getErrorDescription();
+    void setErrorDescription(String value);
+    boolean isAttributesEmpty();
+    Map<String, Serializable> getAttributes();
+    void logAsInfo();
+    void logAsWarning();
+    void logAsError();
+    void logAsTrace();
+    void logAsDebug();
+}

Propchange: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestDiagnostics.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestDiagnostics.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestDiagnostics.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsHolder.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsHolder.java?rev=772479&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsHolder.java (added)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsHolder.java Thu May  7 00:43:28 2009
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.request;
+
+/**
+ * RequestDiagnosticsHolder can be used to "attach" RequestDiagnostics to any possible object.
+ * <p>
+ * The JetspeedServlet.errorHandler method for instance uses it to detect if an Exception
+ * already holds an RequestDiagnostics object and will use it then instead of creating a new
+ * one.
+ * </p>
+ * @version $Id$
+ */
+public interface RequestDiagnosticsHolder
+{
+    RequestDiagnostics getRequestDiagnostics();
+    void setRequestDiagnostics(RequestDiagnostics rd);
+}

Propchange: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsHolder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsHolder.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestDiagnosticsHolder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message