Groovy Documentation

com.ace.mws.plugins
[Java] Class MoabRestResponse

java.lang.Object
  com.ace.mws.plugins.MoabRestResponse

public class MoabRestResponse
extends Object

This class is used in the IMoabRestService to represent a response from MWS. It contains fields for the response, data, and metadata methods about the response.

Authors:
bsaville


Field Summary
private net.sf.json.JSON data

private HttpServletResponse response

private boolean success

 
Constructor Summary
MoabRestResponse(HttpServletResponse response, net.sf.json.JSON data, boolean success)

Constructs a new response from MWS.

 
Method Summary
net.sf.json.JSON getData()

The parsed JSON body data from the response.

HttpServletResponse getResponse()

The actual response object.

boolean hasError()

Returns true if an error was encountered during the request.

boolean isSuccess()

Returns if the request was successful or not.

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

data

private final net.sf.json.JSON data


response

private final HttpServletResponse response


success

private final boolean success


 
Constructor Detail

MoabRestResponse

public MoabRestResponse(HttpServletResponse response, net.sf.json.JSON data, boolean success)
Constructs a new response from MWS.
Parameters:
response - The HTTP servlet response
data - The data as net.sf.json.JSON
success - Whether or not the response is a success


 
Method Detail

getData

public net.sf.json.JSON getData()
The parsed JSON body data from the response.
Returns:
The parsed JSON body


getResponse

public HttpServletResponse getResponse()
The actual response object. This is actually an instance of org.springframework.mock.web.MockHttpServletResponse. This may be used to return any pertinent information from the response including headers and content type information.
Returns:
The HTTP response


hasError

public boolean hasError()
Returns true if an error was encountered during the request.
Returns:
True if the HTTP code is 400 or greater, false otherwise


isSuccess

public boolean isSuccess()
Returns if the request was successful or not.
Returns:
True if a 2xx or 3xx HTTP code was encountered or false otherwise


 

Groovy Documentation