Fixes comment typo
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / mkjsf / pazpar2 / Pz2ProxyBean.java
index 09e500a..7bc0145 100644 (file)
@@ -15,6 +15,7 @@ import org.apache.log4j.Logger;
 \r
 import com.indexdata.mkjsf.config.ConfigurationReader;\r
 import com.indexdata.mkjsf.pazpar2.sp.ServiceProxyClient;\r
+import com.indexdata.mkjsf.pazpar2.sp.ServiceProxyCommandResponse;\r
 import com.indexdata.mkjsf.pazpar2.sp.ServiceProxyInterface;\r
 import com.indexdata.mkjsf.pazpar2.sp.auth.ServiceProxyUser;\r
 import com.indexdata.mkjsf.utils.Utils;\r
@@ -74,6 +75,9 @@ public class Pz2ProxyBean extends Pz2Bean implements ServiceProxyInterface {
       if (user.isAuthenticated()) {\r
         user.clear();\r
       }\r
+      pzreq.getRecord().removeParametersInState();\r
+      pzreq.getSearch().removeParametersInState();\r
+      pzresp.reset();\r
       ((ServiceProxyClient)searchClient).ipAuthenticate(user);\r
     }\r
   }\r
@@ -94,6 +98,10 @@ public class Pz2ProxyBean extends Pz2Bean implements ServiceProxyInterface {
     return ((ServiceProxyClient)searchClient).getServiceProxyUrl();\r
   }\r
   \r
+  public boolean getServiceProxyUrlIsDefined() {\r
+    return ((ServiceProxyClient)searchClient).getServiceProxyUrl().length()>0;\r
+  }\r
+  \r
   public List<String> getServiceProxyUrls() {\r
     List<String> urls = new ArrayList<String>();\r
     urls.add("");\r
@@ -117,22 +125,20 @@ public class Pz2ProxyBean extends Pz2Bean implements ServiceProxyInterface {
   }\r
 \r
   @Override\r
-  public String postInit() throws UnsupportedEncodingException, IOException {    \r
+  public ServiceProxyCommandResponse postInit() throws UnsupportedEncodingException, IOException {    \r
     String initDocPath = ((ServiceProxyClient)searchClient).getInitDocPaths().get(0);\r
     logger.info("Paths: " + ((ServiceProxyClient)searchClient).getInitDocPaths());\r
     logger.info("Path: " + initDocPath);\r
     pzresp.reset();\r
-    byte[] response = ((ServiceProxyClient)searchClient).postInitDoc(initDocPath + getInitFileName());\r
-    initDocResponse = new String(response,"UTF-8");\r
-    return initDocResponse;\r
+    ServiceProxyCommandResponse response = ((ServiceProxyClient)searchClient).postInitDoc(initDocPath + getInitFileName());    \r
+    return response;\r
   }\r
   \r
   @Override\r
-  public String postInit(byte[] initDoc, boolean includeDebug) throws UnsupportedEncodingException, IOException {    \r
+  public ServiceProxyCommandResponse postInit(byte[] initDoc, boolean includeDebug) throws UnsupportedEncodingException, IOException {    \r
     pzresp.reset();\r
-    byte[] response = ((ServiceProxyClient)searchClient).postInitDoc(initDoc,includeDebug);\r
-    initDocResponse = new String(response,"UTF-8");\r
-    return initDocResponse;\r
+    ServiceProxyCommandResponse response = ((ServiceProxyClient)searchClient).postInitDoc(initDoc,includeDebug);    \r
+    return response;\r
   }\r
 \r
   @Override\r