From what I understand, the Pzn Engine runs in the /wps context and most likely stores the application object on init in the HttpSession in that context. Therefore, since my deployed portlet is its own web application, it will have its own context (ie. /wps/PA_fubar). So is there any way to programmatically access the Pzn Engine context and affect objects during runtime?
Thanks for any insight anyone may have.
Attached you will find a simple example of an application object, and below the code you can use in your portlet.
MySelectionBean bean = new MySelectionBean();
bean.setValue("some value");
Have Fun!!
package beans;
import com.ibm.websphere.personalization.RequestContext;
import com.ibm.websphere.personalization.applicationObjects.SelfInitializingApplicationObject;
import java.io.Serializable;
public class MySelectionBean implements SelfInitializingApplicationObject,Serializable {
private static final long serialVersionUID = -8133816174182658933L;
public void init(RequestContext rc) {
rc.setSessionAttribute("MySelectionBean", this );
}
public MySelectionBean() {
}
public String getInsuranceType() {
return SessionData.getInsuranceType();
}
public void setInsuranceType(String insuranceType) {
SessionData.setInsuranceType(insuranceType);
}
private static class SessionData {
private static SessionData sessionData;
private static String insuranceType;
public static String getInsuranceType() {
return insuranceType;
}
public static void setInsuranceType(String insuranceType) {
SessionData.insuranceType = insuranceType;
}
private SessionData() {
insuranceType="";
}
public SessionData getInstance() {
if (sessionData==null) {
sessionData=new SessionData();
}
return sessionData;
}
}
}
Have Fun!