You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Fernando Ribeiro <we...@fernandoribeiro.eti.br> on 2011/05/27 04:25:42 UTC

Dynamic Resource URIs

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

Re: Dynamic Resource URIs

Posted by Fernando Ribeiro <we...@fernandoribeiro.eti.br>.
Sure, I meant we could maybe find a way for Camel itself to do what that
code in the FreeMarker component is doing, does that make sense for you?

On Tue, May 31, 2011 at 5:21 PM, Richard Kettelerij <
richardkettelerij@gmail.com> wrote:

> Fernando, push down to to what framework? camel-core? I don't quite
> understand what you're proposing, can you elaborate it a bit?
>
> On Tue, May 31, 2011 at 4:18 PM, Fernando Ribeiro <
> webmaster@fernandoribeiro.eti.br> wrote:
>
> > Any feedback? Thanks.
> >
> > On Thu, May 26, 2011 at 11:25 PM, Fernando Ribeiro <
> > webmaster@fernandoribeiro.eti.br> wrote:
> >
> > > 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
> > >
> >
>

Re: Dynamic Resource URIs

Posted by Richard Kettelerij <ri...@gmail.com>.
Fernando, push down to to what framework? camel-core? I don't quite
understand what you're proposing, can you elaborate it a bit?

On Tue, May 31, 2011 at 4:18 PM, Fernando Ribeiro <
webmaster@fernandoribeiro.eti.br> wrote:

> Any feedback? Thanks.
>
> On Thu, May 26, 2011 at 11:25 PM, Fernando Ribeiro <
> webmaster@fernandoribeiro.eti.br> wrote:
>
> > 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
> >
>

Re: Dynamic Resource URIs

Posted by Fernando Ribeiro <we...@fernandoribeiro.eti.br>.
Any feedback? Thanks.

On Thu, May 26, 2011 at 11:25 PM, Fernando Ribeiro <
webmaster@fernandoribeiro.eti.br> wrote:

> 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
>