com.indexdata.mkjsf.pazpar2
Class ClientCommandResponse

java.lang.Object
  extended by com.indexdata.mkjsf.pazpar2.ClientCommandResponse
All Implemented Interfaces:
HttpResponseWrapper

public class ClientCommandResponse
extends Object
implements HttpResponseWrapper

Contains one HTTP response to a command executed against a Pazpar2 service in such a way as to give the response parser a common interface to responses, whether they are from Pazpar2, from the Service Proxy, or are error messages created by the JSF application during processing.

Author:
Niels Erik

Constructor Summary
ClientCommandResponse(int statusCode, byte[] content, String contentType)
          Used for storing Service Proxy based response
ClientCommandResponse(int statusCode, String content, String contentType)
          Used for storing error response
ClientCommandResponse(com.indexdata.masterkey.pazpar2.client.Pazpar2HttpResponse pz2response, ByteArrayOutputStream content)
          Used for storing Pazpar2 based response
 
Method Summary
 byte[] getBytes()
           
 String getContentType()
           
 String getResponseString()
          Gets the response as a String - unless the response is marked as binary
 byte[] getResponseToParse()
          Used by the parser to get the response for further processing.
 int getStatusCode()
           
 boolean isBinary()
           
 void setResponseToParse(String parseString)
          Overrides the original response with a modified response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientCommandResponse

public ClientCommandResponse(com.indexdata.masterkey.pazpar2.client.Pazpar2HttpResponse pz2response,
                             ByteArrayOutputStream content)
Used for storing Pazpar2 based response

Parameters:
pz2response -
content -

ClientCommandResponse

public ClientCommandResponse(int statusCode,
                             String content,
                             String contentType)
Used for storing error response

Parameters:
statusCode -
content -
contentType -

ClientCommandResponse

public ClientCommandResponse(int statusCode,
                             byte[] content,
                             String contentType)
Used for storing Service Proxy based response

Parameters:
statusCode -
content -
contentType -
Method Detail

getStatusCode

public int getStatusCode()
Specified by:
getStatusCode in interface HttpResponseWrapper

getContentType

public String getContentType()
Specified by:
getContentType in interface HttpResponseWrapper

getResponseString

public String getResponseString()
Gets the response as a String - unless the response is marked as binary

Specified by:
getResponseString in interface HttpResponseWrapper

getBytes

public byte[] getBytes()
Specified by:
getBytes in interface HttpResponseWrapper

setResponseToParse

public void setResponseToParse(String parseString)
Overrides the original response with a modified response. Used for one instance of a response that is not named by the command that created it - such as the parser expects.

Parameters:
parseString -

getResponseToParse

public byte[] getResponseToParse()
Used by the parser to get the response for further processing.

Returns:

isBinary

public boolean isBinary()
Specified by:
isBinary in interface HttpResponseWrapper


Copyright © 2013. All Rights Reserved.