Renames class, removes obsolete, javadoc
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / mkjsf / pazpar2 / ClientCommandResponse.java
index 01444ef..ef22114 100644 (file)
@@ -5,6 +5,15 @@ import java.io.UnsupportedEncodingException;
 \r
 import com.indexdata.masterkey.pazpar2.client.Pazpar2HttpResponse;\r
 \r
+/**\r
+ * Contains one HTTP response to a command executed against a Pazpar2 service in such a \r
+ * way as to give the response parser a common interface to responses, whether \r
+ * they are from Pazpar2, from the Service Proxy, or are error messages created \r
+ * by the JSF application during processing.\r
+ *  \r
+ * @author Niels Erik\r
+ *\r
+ */\r
 public class ClientCommandResponse implements HttpResponseWrapper {\r
     \r
   private int statusCode;\r
@@ -13,18 +22,38 @@ public class ClientCommandResponse implements HttpResponseWrapper {
   private String contentString = null;\r
   private byte[] bytesForParsing = null;\r
   \r
+  /**\r
+   * Used for storing Pazpar2 based response\r
+   * \r
+   * @param pz2response\r
+   * @param content\r
+   */\r
   public ClientCommandResponse(Pazpar2HttpResponse pz2response, ByteArrayOutputStream content) {    \r
     this.content = content.toByteArray();\r
     this.statusCode = pz2response.getStatusCode();\r
     this.contentType = pz2response.getContentType();\r
   }\r
     \r
+  /**\r
+   * Used for storing error response\r
+   *  \r
+   * @param statusCode\r
+   * @param content\r
+   * @param contentType\r
+   */\r
   public ClientCommandResponse(int statusCode, String content, String contentType) {\r
     this.statusCode = statusCode;\r
     this.contentString = content;\r
     this.contentType = contentType;\r
   }\r
   \r
+  /**\r
+   * Used for storing Service Proxy based response\r
+   * \r
+   * @param statusCode\r
+   * @param content\r
+   * @param contentType\r
+   */\r
   public ClientCommandResponse(int statusCode, byte[] content, String contentType) {\r
     this.statusCode = statusCode;\r
     this.content = content;\r
@@ -41,6 +70,9 @@ public class ClientCommandResponse implements HttpResponseWrapper {
     return contentType;\r
   }\r
 \r
+  /**\r
+   * Gets the response as a String - unless the response is marked as binary\r
+   */\r
   @Override\r
   public String getResponseString() {\r
     if (content == null) {\r
@@ -62,6 +94,13 @@ public class ClientCommandResponse implements HttpResponseWrapper {
     return content;\r
   }\r
   \r
+  /**\r
+   * Overrides the original response with a modified response. Used for\r
+   * one instance of a response that is not named by the command that \r
+   * created it - such as the parser expects. \r
+   * \r
+   * @param parseString\r
+   */\r
   public void setResponseToParse(String parseString) {    \r
     try {\r
       this.bytesForParsing = parseString.getBytes("UTF-8");\r
@@ -70,6 +109,10 @@ public class ClientCommandResponse implements HttpResponseWrapper {
     }\r
   }\r
 \r
+  /**\r
+   * Used by the parser to get the response for further processing. \r
+   * @return\r
+   */\r
   public byte[] getResponseToParse() {\r
     if (bytesForParsing != null) {\r
       return bytesForParsing;\r