Results 1 to 5 of 5

Thread: Command Class Object remains in memory

  1. #1
    Join Date
    Dec 2005
    Posts
    13

    Post Command Class Object remains in memory

    Hi Everybody,

    I have a problem. We are using AbstractWizradFormController. The problem is that the command object associated with Wizard remains in memory unless the "processCancel()" / "processFinish()" is called.

    Because of this, whenever I exit the wizard without clicking on "Cancel" button, and invoke the Wizards controller again, instead of cerating a new command object, the same object is using causing the wizard to show the page which was left while exiting without using "Cancel".

    Is there any method of the Wizard that can be used for removing the command object from the memory in order to avoid the above mentioned problem ?

    Any help regarding this will be extremely helpful...

    Thanks and Regards,
    Shweta

  2. #2
    Join Date
    Dec 2005
    Location
    Philadelphia, PA, USA
    Posts
    228

    Default

    I had the same issue working with the WizardController.
    I got around it by creating a web filter that on any HTTP get request would clear out any attribute from the session based on the "DEFAULT_COMMAND_NAME". I think I did a check for ".FROM." on the session attribute key and removed it. Also do not forget to clear the current page session attribute at the same time.

    Dmitry

  3. #3
    Join Date
    Dec 2005
    Posts
    13

    Default

    Hi there,

    Thanks for your help...but I did not actually understand what you are trying to say here. The session has the attribute named ".FROM." or does it mean anything else. Cause I tried retreiving the attribute named ".FROM."

    I guess I havent really understood what ur trying to say here...

    Regards,
    Shweta

  4. #4
    Join Date
    Dec 2005
    Location
    Philadelphia, PA, USA
    Posts
    228

    Default

    Current page is stored in a session with the string returned by getPageSessionAttributeName().

    I just looked at the code and object is stored in the session at:
    Code:
      getClass().getName() + ".PAGE." + getCommandName();
    Command object is stored in the session at key returned by getFormSessionAttributeName()
    Code:
    getClass().getName() + ".FORM." + getCommandName();
    So in you filter you could iterate over session attributes untill you stumble on
    Code:
    if (sessionKey.indexOf(".PAGE.") > 0 || sessionKey.indexOf(".FORM.") > 0)
    session.removeAttribute(sessionKey);
    This will clear the current wizard page from the session and clear the command object.

    Dmitry
    Last edited by dsklyut; Dec 19th, 2005 at 11:17 AM.

  5. #5
    Join Date
    Dec 2005
    Posts
    13

    Default

    Hi Dmitry,

    Thanks a lot for your help...the code u mentioned worked perfectly well for me...

    I have now written an interceptor for all the controllers except for the ones that use the Wizard, and removed the session attribute from there....

    Thanks once again...

    Regards,
    Shweta

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •