Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-4426

Unknown response type exception

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Works as Designed
    • Affects Version/s: 5.0.3
    • Fix Version/s: None
    • Component/s: HTTP Support

      Description

      An AbstractHttpRequestExecutingMessageHandler lost build() operation:
      In spring-integration-http-5.0.*.RELEASE.jar method:

      public class HttpRequestExecutingMessageHandler extends AbstractHttpRequestExecutingMessageHandler {
      
      
      	@Override
      	protected Object handleRequestMessage(Message<?> requestMessage) {
      // some code.....
      		return exchange(() -> generateUri(requestMessage), httpMethod, httpRequest, expectedResponseType,
      				requestMessage);
      	}
      // some code.....
      	@Override
      	protected Object exchange(Supplier<URI> uriSupplier, HttpMethod httpMethod, HttpEntity<?> httpRequest,
      			Object expectedResponseType, Message<?> requestMessage) {
      // some code.....
      			return getReply(httpResponse);
      // some code.....
      	}
      // some code.....
      }
      
      protected Object getReply(ResponseEntity<?> httpResponse) {
      {
      // Lost build operation..
          return replyBuilder.copyHeaders(headers);
      }
      

      In spring-integration-http-4.2.4.RELEASE.

      rotected Object handleRequestMessage(Message<?> requestMessage) {
      {
      // Old code.....
          return replyBuilder.copyHeaders(headers).build();
      }
      

      This cause "Unknown response type exception". result should have "Message" type but it had "MessageBuilder" type:

          public <T> T sendRequest(Object request) throws HttpRequestException {
              Message<Object> message = MessageBuilder.withPayload(request)
                      .setHeader(HttpHeaders.CONTENT_TYPE, contentType)
                      .build();
              Object result = handleRequestMessage(message);
              if (result instanceof Message) {
                  return getResponse(((Message) result).getPayload());
              }
              throw new HttpRequestException("Unknown response type exception");
          }
      
      

        Attachments

          Activity

            People

            Assignee:
            abilan Artem Bilan
            Reporter:
            alexkhimach Alex Khimach
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: