X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fcom%2Findexdata%2Fmkjsf%2Fpazpar2%2FServiceProxyClient.java;h=2db45586c21fa76071465c92d50acea8ef846e38;hb=3d72901f9f5e443837bf67603024de8c7d06a68e;hp=152ee33475067678a4db954046f2f6d91398537e;hpb=6da388f43fedda3e61e630f826244608d2da6301;p=mkjsf-moved-to-github.git diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyClient.java b/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyClient.java index 152ee33..2db4558 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyClient.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyClient.java @@ -100,13 +100,14 @@ public class ServiceProxyClient implements SearchClient { byte[] response = null; try { response = client.execute(httpget, handler); - if (handler.getStatusCode()==200 && handler.getContentType().contains("xml")) { + if (handler.getStatusCode()==200 && (handler.getContentType().contains("xml") || handler.getContentType().contains("octet-stream"))) { + logger.debug("Creating command response holding content of type " + handler.getContentType()); commandResponse = new ClientCommandResponse(handler.getStatusCode(),response,handler.getContentType()); } else { logger.error("Service Proxy status code: " + handler.getStatusCode()); String errorXml = ""; if (handler.getContentType().contains("xml")) { - errorXml = CommandError.insertErrorXml(command.getCommandName(), String.valueOf(handler.getStatusCode()), "Service Proxy error: "+handler.getStatusCode(), new String(response,"UTF-8")); + errorXml = CommandError.insertErrorXml(command.getCommandName(), String.valueOf(handler.getStatusCode()), "Service Proxy error: "+handler.getStatusCode(), new String(response,"UTF-8")); } else { if (handler.getContentType().contains("html")) { String htmlStrippedOfTags = (new String(response,"UTF-8")).replaceAll("\\<[^>]*>",""); @@ -117,9 +118,9 @@ public class ServiceProxyClient implements SearchClient { } } else { errorXml = CommandError.createErrorXml(command.getCommandName(), String.valueOf(handler.getStatusCode()), "Unexpected response type from Service Proxy: "+handler.getContentType(), "Could not process non-XML response from Service Proxy", new String(response,"UTF-8")); - } - commandResponse = new ClientCommandResponse(handler.getStatusCode(),errorXml,handler.getContentType()); + } } + commandResponse = new ClientCommandResponse(handler.getStatusCode(),errorXml,handler.getContentType()); } } catch (Exception e) { e.printStackTrace();