myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From we...@apache.org
Subject svn commit: r1099709 - /myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/DebugPhaseListener.java
Date Thu, 05 May 2011 08:02:55 GMT
Author: weber
Date: Thu May  5 08:02:55 2011
New Revision: 1099709

URL: http://svn.apache.org/viewvc?rev=1099709&view=rev
Log:
(TOBAGO-997) Extend DebugPhaseListener: log RequestURI, RequestHeaders, ResponseCharset, ...
<https://issues.apache.org/jira/browse/TOBAGO-997>

Modified:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/DebugPhaseListener.java

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/DebugPhaseListener.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/DebugPhaseListener.java?rev=1099709&r1=1099708&r2=1099709&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/DebugPhaseListener.java
(original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/DebugPhaseListener.java
Thu May  5 08:02:55 2011
@@ -26,6 +26,9 @@ import javax.faces.event.PhaseEvent;
 import javax.faces.event.PhaseId;
 import javax.faces.event.PhaseListener;
 import javax.faces.application.FacesMessage;
+import javax.portlet.PortletRequest;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.util.Date;
 import java.util.Map;
 import java.util.Iterator;
@@ -60,13 +63,20 @@ public class DebugPhaseListener implemen
       }
 
       if (phaseEvent.getPhaseId().getOrdinal() == 6) {
+        if (LOG.isTraceEnabled()) {
+          HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
+          LOG.trace(" response Locale            = \"" + response.getLocale() + "\"");
+          LOG.trace(" response ContentType       = \"" + response.getContentType() + "\"");
+          LOG.trace(" response CharacterEncoding = \"{" + response.getCharacterEncoding()
+ "}\"");
+        }
+
         Date start = (Date) map.get(KEY + "1S");
         if (start != null) {
           LOG.info("Total response time : "
               + (end.getTime() - start.getTime() + " milliseconds"));
         }
       }
-      for (Iterator iter = phaseEvent.getFacesContext().getClientIdsWithMessages(); iter.hasNext();)
{
+      for (Iterator iter = facesContext.getClientIdsWithMessages(); iter.hasNext();) {
         String clientId = (String) iter.next();
 
         for (Iterator msgIter = facesContext.getMessages(clientId); msgIter.hasNext();) {
@@ -92,9 +102,19 @@ public class DebugPhaseListener implemen
 
         if (LOG.isTraceEnabled() && PhaseId.RESTORE_VIEW == phaseId) {
           // this is before restoreView
-          Map params = externalContext.getRequestParameterMap();
-          for (Object key : params.keySet()) {
-            LOG.trace("Param : \"" + key + "\" = \"" + params.get(key) + "\"");
+
+          Object request = externalContext.getRequest();
+          if (request instanceof HttpServletRequest) {
+            HttpServletRequest servletRequest = (HttpServletRequest) request;
+            LOG.trace("RequestURI = " + servletRequest.getRequestURI());
+          }
+          Map headerMap = externalContext.getRequestHeaderMap();
+          for (Object key : headerMap.keySet()) {
+            LOG.trace("Header : \"" + key + "\" = \"" + headerMap.get(key) + "\"");
+          }
+          Map parameterMap = externalContext.getRequestParameterMap();
+          for (Object key : parameterMap.keySet()) {
+            LOG.trace("Param  : \"" + key + "\" = \"" + parameterMap.get(key) + "\"");
           }
         }
 



Mime
View raw message