svnno****@sourc*****
svnno****@sourc*****
2008年 6月 5日 (木) 10:34:15 JST
Revision: 961 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=961 Author: shinsuke Date: 2008-06-05 10:34:14 +0900 (Thu, 05 Jun 2008) Log Message: ----------- patch for j2 663332. Modified Paths: -------------- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java -------------- next part -------------- Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java 2008-06-05 01:24:31 UTC (rev 960) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java 2008-06-05 01:34:14 UTC (rev 961) @@ -16,6 +16,9 @@ */ package org.apache.jetspeed.pipeline.valve.impl; +import java.io.ByteArrayOutputStream; +import java.io.ObjectOutputStream; +import java.util.Enumeration; import java.util.Stack; import javax.servlet.RequestDispatcher; @@ -39,7 +42,7 @@ * attempts to includde them. * * @author <a href="mailto:weave****@apach*****">Scott T. Weaver</a> - * @version $Id: CleanupValveImpl.java 516448 2007-03-09 16:25:47Z ate $ + * @version $Id$ * */ public class CleanupValveImpl extends AbstractValve implements CleanupValve @@ -81,6 +84,10 @@ rd.include(httpRequest, request.getResponse()); } } + if (log.isDebugEnabled()) + { + dumpSession(request); + } } catch (Exception e) { @@ -99,4 +106,49 @@ return "CleanupValveImpl"; } + public void dumpSession(RequestContext context) + { + try + { + int count = 0; + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(bout); + Enumeration e = context.getRequest().getSession() + .getAttributeNames(); + while (e.hasMoreElements()) + { + String name = (String) e.nextElement(); + Object o = context.getSessionAttribute(name); + serializeObject(name, o); + out.writeObject(o); + count++; + } + out.close(); + log.debug("Session object: " + count); + log.debug("Session footprint: " + bout.size()); + } + catch (Throwable t) + { + log.debug("Exception in dumpSession().", t); + } + } + + public void serializeObject(String name, Object o) + { + try + { + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(bout); + out.writeObject(o); + out.close(); + log.debug("o = " + name + ", " + o + ", size = " + bout.size()); + } + catch (Throwable t) + { + log + .debug( + "Exception in serializeObject(String name, Object o).", + t); + } + } }