Issue Type: Bug Bug
Affects Versions: 1.0
Assignee: Unassigned
Components: component-resteasy
Created: 04/Sep/13 5:54 AM
Description:

RESTEasy binding returns a nested javax.ws.rs.core.Response instance.
Is this expected behavior?

The following is the relevant code from the definition of invoke(Object, Method, Object) in RESTEasyProxy.java and my comments.

RESTEasyBindingData responseData = _serviceConsumer.invoke(requestData, method.getReturnType().equals(Void.TYPE));
// The next line means responseData.getParameters()[0] is an instance of Response.
if (method.getReturnType().equals(Response.class)) {
    Response.ResponseBuilder builder = Response.ok();
    if (responseData != null) {
        if (responseData.getStatusCode() != null) {
            builder.status(responseData.getStatusCode());
        }
        if (responseData.getParameters().length > 0) {
            // The next line means the result Response instance has an instance of Response class as entity.
            builder.entity(responseData.getParameters()[0]);
        }
        for (Map.Entry<String, List<String>> entry : responseData.getHeaders().entrySet()) {
            builder.header(entry.getKey(), entry.getValue());
        }
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Outgoing Headers from SwitchYard through InboundHandler [");
            for (Map.Entry<String, List<String>> entry : responseData.getHeaders().entrySet()) {
                LOGGER.trace(entry.getKey() + " = " + entry.getValue());
            }
            LOGGER.trace("]");
        }
    }
    return builder.build();
} else if ((responseData != null) && (responseData.getParameters().length > 0)) {
    return responseData.getParameters()[0];
}
return null;
Project: SwitchYard
Priority: Major Major
Reporter: Takayama Manabu
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira