Makes init doc debug response optional
authorNiels Erik G. Nielsen <nielserik@indexdata.com>
Tue, 30 Apr 2013 15:44:14 +0000 (11:44 -0400)
committerNiels Erik G. Nielsen <nielserik@indexdata.com>
Tue, 30 Apr 2013 15:44:14 +0000 (11:44 -0400)
src/main/java/com/indexdata/mkjsf/pazpar2/Pz2ProxyBean.java
src/main/java/com/indexdata/mkjsf/pazpar2/sp/ServiceProxyClient.java
src/main/java/com/indexdata/mkjsf/pazpar2/sp/ServiceProxyInterface.java

index 989cc06..09e500a 100644 (file)
@@ -70,7 +70,10 @@ public class Pz2ProxyBean extends Pz2Bean implements ServiceProxyInterface {
   }\r
   \r
   public void ipAuthenticate (ServiceProxyUser user) {\r
-    if (!user.isAuthenticated()) {\r
+    if (!user.isIpAuthenticated()) {\r
+      if (user.isAuthenticated()) {\r
+        user.clear();\r
+      }\r
       ((ServiceProxyClient)searchClient).ipAuthenticate(user);\r
     }\r
   }\r
@@ -125,14 +128,13 @@ public class Pz2ProxyBean extends Pz2Bean implements ServiceProxyInterface {
   }\r
   \r
   @Override\r
-  public String postInit(byte[] initDoc) throws UnsupportedEncodingException, IOException {    \r
+  public String postInit(byte[] initDoc, boolean includeDebug) throws UnsupportedEncodingException, IOException {    \r
     pzresp.reset();\r
-    byte[] response = ((ServiceProxyClient)searchClient).postInitDoc(initDoc);\r
+    byte[] response = ((ServiceProxyClient)searchClient).postInitDoc(initDoc,includeDebug);\r
     initDocResponse = new String(response,"UTF-8");\r
     return initDocResponse;\r
   }\r
 \r
-\r
   @Override\r
   public String getInitResponse() {\r
     return initDocResponse;\r
index 14bec03..fb3c867 100644 (file)
@@ -293,8 +293,8 @@ public class ServiceProxyClient implements SearchClient {
     return initDocPaths;\r
   }\r
   \r
-  public byte[] postInitDoc(byte[] initDoc) throws IOException {\r
-    HttpPost post = new HttpPost(selectedServiceUrl+"?command=init&includeDebug=yes");\r
+  public byte[] postInitDoc(byte[] initDoc, boolean includeDebug) throws IOException {\r
+    HttpPost post = new HttpPost(selectedServiceUrl+"?command=init" + (includeDebug? "&includeDebug=yes" : ""));\r
     post.setEntity(new ByteArrayEntity(initDoc));\r
     byte[] response = client.execute(post, handler);\r
     logger.debug("Response on POST was: " + new String(response,"UTF-8"));    \r
index 46d4e77..abbb1ec 100644 (file)
@@ -10,7 +10,7 @@ public interface ServiceProxyInterface extends Pz2Interface {
   public void setInitFileName (String fileName);  \r
   public String getInitFileName();\r
   public String postInit() throws UnsupportedEncodingException, IOException;\r
-  public String postInit(byte[] initDoc) throws UnsupportedEncodingException, IOException;\r
+  public String postInit(byte[] initDoc, boolean includeDebug) throws UnsupportedEncodingException, IOException;\r
   public String getInitResponse();\r
   public void setServiceProxyUrl(String url);\r
   public String getServiceProxyUrl();\r