final ResponseDocType responseDoc = _resourceDoc.getResponse(m.getInvocable().getHandlingMethod().getDeclaringClass(),
m.getInvocable().getHandlingMethod());
List<Response> responses = new ArrayList<Response>();
if (responseDoc != null && responseDoc.hasRepresentations()) {
for (RepresentationDocType representationDoc : responseDoc.getRepresentations()) {
Response response = new Response();
final Representation wadlRepresentation = new Representation();
wadlRepresentation.setElement(representationDoc.getElement());
wadlRepresentation.setMediaType(representationDoc.getMediaType());
addDocForExample(wadlRepresentation.getDoc(), representationDoc.getExample());
addDoc(wadlRepresentation.getDoc(), representationDoc.getDoc());
response.getStatus().add(representationDoc.getStatus());
response.getRepresentation().add(wadlRepresentation);
responses.add(response);
}
if (!responseDoc.getWadlParams().isEmpty()) {
for (WadlParamType wadlParamType : responseDoc.getWadlParams()) {
final Param param = new Param();
param.setName(wadlParamType.getName());
param.setStyle(ParamStyle.fromValue(wadlParamType.getStyle()));
param.setType(wadlParamType.getType());
addDoc(param.getDoc(), wadlParamType.getDoc());
for (Response response : responses) {
response.getParam().add(param);
}
}
}
if (!isEmpty(responseDoc.getReturnDoc())) {
for (Response response : responses) {
addDoc(response.getDoc(), responseDoc.getReturnDoc());
}
}
} else {
responses = _delegate.createResponses(r, m);