Fixes missing subscription to state changes by SP bean
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / pz2utils4jsf / pazpar2 / Pz2ProxyBean.java
index f37f98e..3eb0bba 100644 (file)
@@ -12,7 +12,6 @@ import javax.inject.Named;
 import org.apache.log4j.Logger;\r
 \r
 import com.indexdata.pz2utils4jsf.config.ConfigurationReader;\r
-import com.indexdata.pz2utils4jsf.pazpar2.commands.CommandParameter;\r
 import com.indexdata.pz2utils4jsf.pazpar2.sp.ServiceProxyClient;\r
 import com.indexdata.pz2utils4jsf.pazpar2.sp.ServiceProxyInterface;\r
 import com.indexdata.pz2utils4jsf.pazpar2.sp.auth.ServiceProxyUser;\r
@@ -41,6 +40,7 @@ public class Pz2ProxyBean extends Pz2Bean implements ServiceProxyInterface {
       logger.info("Using [" + Utils.objectId(searchClient) + "] configured by [" \r
                             + Utils.objectId(configurator) + "]" );    \r
       configureClient(searchClient,configurator);\r
+      stateMgr.addStateListener(this);\r
     } else {\r
       logger.debug("Pz2ProxyBean:postConstruct: searchClient already instantiated " +\r
                        "during construction of parent object Pz2Bean.");\r
@@ -61,6 +61,7 @@ public class Pz2ProxyBean extends Pz2Bean implements ServiceProxyInterface {
   public void setServiceProxyUrl(String url) {\r
     logger.info("Setting Service Proxy url: " + url);\r
     serviceProxyUrl = url;\r
+    pzreq.getRecordInState().removeParametersSilently();\r
     pzreq.getSearchInState().removeParametersSilently();\r
     pzresp.reset();\r
   }\r