Can there now never be hanging feedback messages?
IF a component didn't have a page anymore (removed by listview or something
like that)
but it did report something.
Or if the Request Page did report an error but there was another Page set as
the response...

Also the clear of FeedbackMessages which does this:
messages.remove(message);

one by one for all the messages is pretty expensive because we use a
CopyOnWriteList..

But in the end we have 2 types of feedback right?
Session feedback messsages and Page or better said: Request feedback
messages
Why aren't we storing the request feedback messages in the RequestCycle?
Or should there be Page feedback messages that go over request?
But looking at the code this isn't being done now anyways.

johan




On 4/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Author: ehillenius
Date: Sat Apr 21 00:42:48 2007
New Revision: 530991

URL: http://svn.apache.org/viewvc?view=rev&rev=530991
Log:
WICKET-484

Modified:
    incubator/wicket/trunk/jdk-1.4
/wicket/src/main/java/org/apache/wicket/Session.java
    incubator/wicket/trunk/jdk-1.4
/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessages.java

Modified: incubator/wicket/trunk/jdk-1.4
/wicket/src/main/java/org/apache/wicket/Session.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java?view=diff&rev=530991&r1=530990&r2=530991

==============================================================================
--- 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java
(original)
+++ 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java
Sat Apr 21 00:42:48 2007
@@ -123,45 +123,6 @@
  */
public abstract class Session implements IClusterable, IConverterLocator
{
-               feedbackMessages.clear(MESSAGES_FOR_COMPONENTS);
+               // Render anything that was already rendered and what was
assigned to a
+               // page that was just rendered if any
+               final Page page = RequestCycle.get().getResponsePage();
+               final Counter notCleanedUpCounter = new Counter();
+               feedbackMessages.clear(new IFeedbackMessageFilter()
+               {
+                       private static final long serialVersionUID = 1L;
+
+                       public boolean accept(FeedbackMessage message)
+                       {
+                               if (message.isRendered())
+                               {
+                                       return true;
+                               }
+                               if (page != null)
+                               {
+                                       Component reporter =
message.getReporter();
+                                       if (reporter != null)
+                                       {
+                                               Page reporterPage =
reporter.findPage();
+                                               return reporterPage !=
null && reporterPage.equals(page);
+                                       }
+                               }
+                               notCleanedUpCounter.count++;
+                               return false;
+                       }
+               });
+
+               if (notCleanedUpCounter.count > 0)
+               {
+                       log.warn("still " + notCleanedUpCounter.count + "
messages unrendered");
+               }
        }


Reply via email to