Class ODataSerializableResponse
java.lang.Object
com.ptc.odata.windchill.internalinvoker.ODataSerializableResponse
- All Implemented Interfaces:
Serializable
Response to
Supported API: true
Extendable: false
ODataSerializableRequest.
Only used when making internal WRS calls (i.e. from within the MethodServer).
Supported API: true
Extendable: false
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet all headers with the according values.byte[]Get the content as byte array.org.json.JSONObjectConvenience method to get the response body as JSONObject.Convenience method to get the response body as an XML Document.Returns the content type of this response.Gets first header value for a given name.getHeaders(String name) Gets header value for a given name.Convenience method to retrieve the $skiptoken value in "odata.nextLink", so it can be used in subsequent calls in WRSCaller as a query parameter.intGets the status code.toString()Override of toString() for debug purposes Supported API: true
-
Constructor Details
-
ODataSerializableResponse
public ODataSerializableResponse()Empty constructor for serialization support. Supported API: true
-
-
Method Details
-
getStatusCode
public int getStatusCode()Gets the status code. Supported API: true- See Also:
-
getAllHeaders
Get all headers with the according values. Supported API: true- Returns:
- an unmodifiable Map of header names/values
-
getHeaders
Gets header value for a given name. Supported API: true- Parameters:
name- the header name as a case-insensitive key- Returns:
- the header value(s) or null if not found
-
getHeader
Gets first header value for a given name. If header name is not knownnullis returned. Supported API: true- Parameters:
name- the header name as a case-insensitive key- Returns:
- the first header value or null if not found
-
getContent
public byte[] getContent()Get the content as byte array. This is a generic method that allows to transform the byte array into any object type. Use this in conjunction with the content type (seegetContentType()) to determine how to transform the byte array into the proper object type. Supported API: true- Returns:
-
getContentAsJSON
public org.json.JSONObject getContentAsJSON() throws org.json.JSONException, UnsupportedOperationExceptionConvenience method to get the response body as JSONObject. Be aware that if the response body is NOT as valid JSON object, this operation will fail and throw an exception. Supported API: true- Returns:
- Throws:
org.json.JSONException- if the response body is a malformed JSONUnsupportedOperationException- if the content type is not JSON
-
getContentAsXML
Convenience method to get the response body as an XML Document. Be aware that if the response body is NOT as valid XML object, this operation will fail and throw an exception. Supported API: true- Returns:
- Throws:
UnsupportedOperationException- if the content type is not XMLException- if the XML is malformed
-
getSkipToken
Convenience method to retrieve the $skiptoken value in "odata.nextLink", so it can be used in subsequent calls in WRSCaller as a query parameter. Returns null if the response is not JSON or if the response does not contain a next link.
Supported API: true- Returns:
- the $skiptoken
-
getContentType
Returns the content type of this response. Supported API: true- Returns:
-
toString
Override of toString() for debug purposes Supported API: true
-