Uploaded image for project: 'SwitchYard'
  1. SwitchYard
  2. SWITCHYARD-1679

It seems that RESTEasy binding builds nested javax.ws.rs.core.Response

    Details

      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;
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  mageshbk Magesh Bojan
                  Reporter:
                  llibra Takayama Manabu
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: