You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Extend WebSession and add your custom getters/setters:

public final class MySession extends WebSession {

	private Object myObject;

	public PerManSession(Request request) {
		super(request);
	}

	public final Object getMyObject() {
		return myObject;
	}

	public final void setMyObject(Object myObject) {
		this.myObject = myObject;
	}

}

In your WebApplication you need to override the "newSession" method and return your session instance:

public final class MyApplication extends WebApplication {
...
    @Override
    public final WebSession newSession() {
        return new MySession();
    }
...
}

In your WebPage you can get/set your object:

...

((MySession)Session.get()).setMyObject(myObject);

...
  • No labels