Check if the transactionStart() is called for UIDL messages or "normal" req

Hi,

I’m implementing my own TransactionListener in an application.

In the MyTransactionListener.transactionStart(Application app, Object req) I need to know whether the transactionStart is called by a UIDL request or if i has something to do with my business logic.

Is there a nice and fancy way to distinguish UIDL requests from other’s?
Currently I do it by checking the end of the requestURL for /UIDL/, but not sure if it’s the most proper way of doing it.


StringBuffer s = ((HttpServletRequest)req).getRequestURL();
boolean UIDLrequest = false;
if (s != null && s.toString().endsWith("/UIDL/")) {
    UIDLrequest = true;
}

// Jonas

I wonder if you can apply this workaround I have been using lately, by using a boolean ‘mutex’ and inline listener classes.


class Foo {
  private isInternalChange = false;

  class Listener {
    Listener() {
      if (!isInternalChange) {
        doStuff();
      }
    }
  }

  Foo() {
    isInternalChange = true;
    doSomethingThatTriggersTheListener();
    isInternalChange = false;
  }
}

it’s not exactly elegant, but it works.