use of io.apiman.gateway.engine.beans.ApiResponse in project apiman-plugins by apiman.
the class ProduceXmlBackEndApi method invoke.
@Override
public PolicyTestBackEndApiResponse invoke(ApiRequest apiRequest, byte[] requestBody) {
try {
String responseBody = "<name>apiman</name>";
ApiResponse apiResponse = new ApiResponse();
apiResponse.getHeaders().put("Content-Type", "application/xml");
apiResponse.getHeaders().put("Content-Length", String.valueOf(responseBody.getBytes("UTF-8").length));
return new PolicyTestBackEndApiResponse(apiResponse, responseBody);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
Aggregations