All,

In the FreeMarker component there is code for an endpoint to check if an
endpoint for a resource URI passed in a header already exists and, if so,
route the message to it, it reads like this:

String newResourceUri =
exchange.getIn().getHeader(FreemarkerConstants.FREEMARKER_RESOURCE_URI,
String.class);

if (newResourceUri != null) {

exchange.getIn().removeHeader(FreemarkerConstants.FREEMARKER_RESOURCE_URI);

  if (log.isDebugEnabled()) {
    log.debug(FreemarkerConstants.FREEMARKER_RESOURCE_URI + " set to " +
newResourceUri + " creating new endpoint to handle exchange");
  }

  FreemarkerEndpoint newEndpoint = findOrCreateEndpoint(getEndpointUri(),
newResourceUri);
  newEndpoint.onExchange(exchange);
  return;
}

I wonder if we can't push this behavior down to the framework, what do you
say?

Thanks,

Fernando

Reply via email to