@Generated(value="OracleSDKGenerator", comments="API Version: 20210930") public final class DynamicHttpResponseBody extends HttpResponseBody
Allows returning dynamically generated HTTP response body based on the provided template. The template allows variable interpolation by specifying variable name between the ‘${’ and ‘}’ delimiters. Escape sequences using ‘\’ are supported to allow usage of ‘\\’ and ‘\${’ in the template to return ‘\’ and ‘\${’ in final response.
The following variables are supported:
http.request.id - the HTTP request ID. For example: "d5fa953f75ef417e4c8008ef9336d779".
Example: { "type": "DYNAMIC", "template": "{\ \\"code\\": 403,\ \\"message\\":\\"Unauthorised\\",\ \\"incidentId\\": \\"${http.request.id}\\"\ }" }
Example with escape sequence: { "type": "DYNAMIC", "template": "\\\\${Returned as plain text}"
}
Note: Objects should always be created or deserialized using the DynamicHttpResponseBody.Builder
. This model
distinguishes fields that are null
because they are unset from fields that are explicitly
set to null
. This is done in the setter methods of the DynamicHttpResponseBody.Builder
, which maintain a
set of all explicitly set fields called DynamicHttpResponseBody.Builder.__explicitlySet__
. The hashCode()
and equals(Object)
methods are implemented to take the explicitly set
fields into account. The constructor, on the other hand, does not take the explicitly set fields
into account (since the constructor cannot distinguish explicit null
from unset null
).
Modifier and Type | Class and Description |
---|---|
static class |
DynamicHttpResponseBody.Builder |
HttpResponseBody.Type
EXPLICITLY_SET_FILTER_NAME, EXPLICITLY_SET_PROPERTY_NAME
Constructor and Description |
---|
DynamicHttpResponseBody(String template)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static DynamicHttpResponseBody.Builder |
builder()
Create a new builder.
|
boolean |
equals(Object o) |
String |
getTemplate()
Dynamic response body
|
int |
hashCode() |
DynamicHttpResponseBody.Builder |
toBuilder() |
String |
toString() |
String |
toString(boolean includeByteArrayContents)
Return a string representation of the object.
|
markPropertyAsExplicitlySet, wasPropertyExplicitlySet
@Deprecated public DynamicHttpResponseBody(String template)
public static DynamicHttpResponseBody.Builder builder()
Create a new builder.
public DynamicHttpResponseBody.Builder toBuilder()
public String getTemplate()
Dynamic response body
public String toString()
toString
in class HttpResponseBody
public String toString(boolean includeByteArrayContents)
Return a string representation of the object.
toString
in class HttpResponseBody
includeByteArrayContents
- true to include the full contents of byte arrayspublic boolean equals(Object o)
equals
in class HttpResponseBody
public int hashCode()
hashCode
in class HttpResponseBody
Copyright © 2016–2024. All rights reserved.