That makes totally perfect sense, and yes, I am storing an enum value
in session. So I had enum defined internally in the page, and then
@Persist on its value...  I understand the limitation, and I can only
image what cool things could be accomplished if Tapestry was budnled
with embedded Jetty....

public class AddBaseItemArticle {

 @Persist
 private DisplayMode _displayMode = DisplayMode.Fresh;

 /**
  * Represents modes in which page can be rendered. If page is entered
  * directly, or if it is reset, display mode is [EMAIL PROTECTED] 
DisplayMode#Fresh}.
  * If after fresh input block has been validated and article information
  * is being collected, the mode is [EMAIL PROTECTED] 
DisplayMode#BlockValidated}. If
  * another page referred block input (create new block for a known base
  * item), then display mode is [EMAIL PROTECTED] DisplayMode#DefineBlock}. 
Finally,
  * if another page referred article input (which requires fully defined
  * block input), display mode is [EMAIL PROTECTED] DisplayMode#DefineArticle}.
  *
  * @author Adam Zimowski
  */
 public enum DisplayMode {
         Fresh, BlockValidated, DefineBlock, DefineArticle
 }

 void setDisplayMode(DisplayMode aDisplayMode) {
        _displayMode = aDisplayMode;
 }

}

On Tue, Mar 25, 2008 at 4:57 PM, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:
> I'm kind of surprised about that;  are you storing the enum values
>  outside of the page instance (i.e. in the session?)
>
>  Inner classes are loaded by the disposable component class loader (the
>  class loader that handles retry logic and class transformation).  When
>  a class changes, the class loader, plus and objects instantiated from
>  that class loader, are discarded.
>
>  If you place such an object in the session, it will hang around
>  (keeping the class loader from being garbage collected) ... AND when
>  the stored value is assigned to a field of the newly loaded page
>  instance, it will fail with a ClassCastException because there's a new
>  class (with the same name) loaded by a new class loader.
>
>  I'd love to patch up these "leaky abstractions" a bit better, but
>  that's partt of the price of running in your choice of servlet
>  container; short of Tapestry being an application server, and not an
>  application framework, it doesn't have sufficient control of things to
>  make it any more seamless.
>
>
>
>  On Tue, Mar 25, 2008 at 2:49 PM, Adam Zimowski <[EMAIL PROTECTED]> wrote:
>  > If Page or Component defines Enum internally, Tapestry throws a
>  >  ClassCastException the moment said page or component  class (or even
>  >  the template) is "hot" reloaded due to any kind of change.
>  >
>  >  Can this be fixed/change to allow inner Enums?
>  >
>  >  -adam
>  >  as of 5.0.11
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  >  For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>
>
>
>  --
>  Howard M. Lewis Ship
>
>  Creator Apache Tapestry and Apache HiveMind
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to