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

Transform message to String automatically in HttpMessageComposer#decompose method

    Details

    • Type: Enhancement
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.1.0
    • Fix Version/s: None
    • Component/s: component-http
    • Labels:
      None

      Description

      HttpMessageComposer#decompose should automatically try to transform message content to String. Otherwise you get status HttpServletResponse.SC_BAD_GATEWAY.

      User has to add custom message composer now, e.g.

      public class CustomHttpMessageComposer extends HttpMessageComposer {
      	@Override
      	public HttpBindingData decompose(Exchange exchange, HttpBindingData target) throws Exception {
      		exchange.getMessage().setContent(
      				exchange.getMessage().getContent(String.class)
      		);
      		return super.decompose(exchange, target);
      	}
      }
      

      I would check if current object is instance of expected output and if so I would transform the content to String. If user has registered a proper transformer it should work.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  tcunning Thomas Cunningham
                  Reporter:
                  mbasovni Martin Basovnik
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: