From: Niels Erik G. Nielsen Date: Tue, 30 Apr 2013 15:44:14 +0000 (-0400) Subject: Makes init doc debug response optional X-Git-Tag: v0.0.7~137 X-Git-Url: http://git.indexdata.com/?a=commitdiff_plain;h=4e4ec6c08e54b7872b22495a54a7c2fb6439c4fd;hp=ea445c5a431fc84116de10c2cb0bb476a3b98eef;p=mkjsf-moved-to-github.git Makes init doc debug response optional --- diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2ProxyBean.java b/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2ProxyBean.java index 989cc06..09e500a 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2ProxyBean.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2ProxyBean.java @@ -70,7 +70,10 @@ public class Pz2ProxyBean extends Pz2Bean implements ServiceProxyInterface { } public void ipAuthenticate (ServiceProxyUser user) { - if (!user.isAuthenticated()) { + if (!user.isIpAuthenticated()) { + if (user.isAuthenticated()) { + user.clear(); + } ((ServiceProxyClient)searchClient).ipAuthenticate(user); } } @@ -125,14 +128,13 @@ public class Pz2ProxyBean extends Pz2Bean implements ServiceProxyInterface { } @Override - public String postInit(byte[] initDoc) throws UnsupportedEncodingException, IOException { + public String postInit(byte[] initDoc, boolean includeDebug) throws UnsupportedEncodingException, IOException { pzresp.reset(); - byte[] response = ((ServiceProxyClient)searchClient).postInitDoc(initDoc); + byte[] response = ((ServiceProxyClient)searchClient).postInitDoc(initDoc,includeDebug); initDocResponse = new String(response,"UTF-8"); return initDocResponse; } - @Override public String getInitResponse() { return initDocResponse; diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/sp/ServiceProxyClient.java b/src/main/java/com/indexdata/mkjsf/pazpar2/sp/ServiceProxyClient.java index 14bec03..fb3c867 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/sp/ServiceProxyClient.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/sp/ServiceProxyClient.java @@ -293,8 +293,8 @@ public class ServiceProxyClient implements SearchClient { return initDocPaths; } - public byte[] postInitDoc(byte[] initDoc) throws IOException { - HttpPost post = new HttpPost(selectedServiceUrl+"?command=init&includeDebug=yes"); + public byte[] postInitDoc(byte[] initDoc, boolean includeDebug) throws IOException { + HttpPost post = new HttpPost(selectedServiceUrl+"?command=init" + (includeDebug? "&includeDebug=yes" : "")); post.setEntity(new ByteArrayEntity(initDoc)); byte[] response = client.execute(post, handler); logger.debug("Response on POST was: " + new String(response,"UTF-8")); diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/sp/ServiceProxyInterface.java b/src/main/java/com/indexdata/mkjsf/pazpar2/sp/ServiceProxyInterface.java index 46d4e77..abbb1ec 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/sp/ServiceProxyInterface.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/sp/ServiceProxyInterface.java @@ -10,7 +10,7 @@ public interface ServiceProxyInterface extends Pz2Interface { public void setInitFileName (String fileName); public String getInitFileName(); public String postInit() throws UnsupportedEncodingException, IOException; - public String postInit(byte[] initDoc) throws UnsupportedEncodingException, IOException; + public String postInit(byte[] initDoc, boolean includeDebug) throws UnsupportedEncodingException, IOException; public String getInitResponse(); public void setServiceProxyUrl(String url); public String getServiceProxyUrl();