How to Disable the Session State Feature.

  7 posts   Feedicon  
Replies: 6 - Last Post: June 04, 2010 17:18
by: etf
showing 1 - 7 of 7
 
Posted: May 18, 2010 16:18 by cnish_09
Hi All,
I am developing an application using the SAF and I love the way SAF works.
But is there any way by which i can disable the session state feature which comes with SAF. Is there any flag in the API for doing the same.
Like if isSaveSessionDisabled. Is it possible to disable the same.

Regards,
Nishanth.C
 
Posted: May 18, 2010 17:50 by Eric Heumann
As far as I know, there's no simple
setSessionStorageEnabled(false);
way of doing this.

What aspect of session storage are you trying to disable? Do you not want window states and locations to be stored, or do you not want table columns to be stored, or...?

If you're using BSAF, you can unregister a property support type by calling
application.getContext().getSessionStorage().register(aClass, null);

For aClass, put the type of object you don't want stored, such as Window.class, JTabbedPane.class, JSplitPane.class, or JTable.class.

If you're using SAF 1.03, you can't unregister property supports, so you have to stop the framework from saving the session altogether, which means overriding the shutdown method in your SingleFrameApplication and not calling super.shutdown() in it. This will stop the state of the main frame from being stored. If you have secondary windows or dialogs in your application, and you display them via the show methods in SingleFrameApplication, their session states will still be stored, and it would be very difficult to keep that from happening. If you're in that boat, I'd recommend upgrading to BSAF.

Hope that helps.

Eric
 
Posted: May 18, 2010 20:36 by etf
Thank you for your message. You gave me another reason to refactor SingleFrameApplication. We need all features like resources injection and session storage to be implemented as decoupled and reusable mixins for an concrete application class.
As for your question you could consider inheritance directly from Application class.
 
Posted: May 19, 2010 05:09 by cnish_09
Hi Eric,
Thanks for the reply. So if i use BSAF then i can stop restoring certain type of components like JTable or JTabbedPane etc.. right?
And one more question the method register(class,null) you meant is not there in the SessionStorage Class in bsaf-1.9RC4.jar. I just found this below method(registerPropertySupport()). Is this what i need to use?

public void registerPropertySupport(Class<? extends Component> clazz, PropertySupport propertySupport)
  {
    if (clazz == null) throw new IllegalArgumentException("Class argument must not ne null.");

    if (propertySupport == null) {
      this.propertyMap.remove(clazz);
      return;
    }


ETF: Thanks for your suggestion too. Will try in that way too Smile .
 
Posted: May 19, 2010 06:00 by Eric Heumann
Yes, that's correct, and yes, registerPropertySupport(clazz, support) is the method you want. Sorry about that; I forgot its name.

Eric
 
Posted: June 04, 2010 01:26 by Anonymous User
So if I want to turn it off I must pass my own class that implements PropertySupport interface?
I tried passing it a null, since in the source I found this comment


// Remove property support for the clazz in case property argument is null



What I'm trying to fix is the following:


[java]
[java] at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:408)
[java] at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:116)
[java] at java.beans.Encoder.writeObject(Encoder.java:74)
[java] at java.beans.XMLEncoder.writeObject(XMLEncoder.java:274)
[java] at java.beans.Encoder.writeExpression(Encoder.java:304)
[java] at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:389)
[java] at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:229)
[java] at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:264)
[java] at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:408)
[java] at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:116)



This prints out when I close a JDialog, I thought that disabling persistant would fix it.

So either
1.- Passing a null disabled persistence and I've got a different problem
2.- Persistence was not disabled.

note
Line 167 should be changed to:
ss.registerPropertySupport(JTable.class, new ExtendedTableProperty());

 
Posted: June 04, 2010 17:18 by etf
Please create a ticket in JIRA with full stack trace and detailed description of your problem.
showing 1 - 7 of 7
Replies: 6 - Last Post: June 04, 2010 17:18
by: etf
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close