You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Chris Pimlott (JIRA)" <ji...@apache.org> on 2015/07/14 00:39:04 UTC
[jira] [Commented] (CAMEL-8962) CamelVelocityResourceUri does not
work when velocity URL contains URL encoded characters
[ https://issues.apache.org/jira/browse/CAMEL-8962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14625510#comment-14625510 ]
Chris Pimlott commented on CAMEL-8962:
--------------------------------------
This happens because of the second line in VelocityEndpoint.findOrCreateEndpoint:
{code}
public VelocityEndpoint findOrCreateEndpoint(String uri, String newResourceUri) {
String newUri = uri.replace(getResourceUri(), newResourceUri);
log.debug("Getting endpoint with URI: {}", newUri);
return getCamelContext().getEndpoint(newUri, VelocityEndpoint.class);
}
{code}
The problem is a mismatch in encoding between {{uri}} and {{getResourceUri()}}.
{code}
* url: velocity://%5Btemplate-in-header%5D
* getResourceUri(): [template-in-header]
{code}
The solution may just to be urlencode the first argument to {{replace.call}} but I'm not confident enough about my understanding of where and when encoding is done in Camel URIs to be absolutely certain.
> CamelVelocityResourceUri does not work when velocity URL contains URL encoded characters
> ----------------------------------------------------------------------------------------
>
> Key: CAMEL-8962
> URL: https://issues.apache.org/jira/browse/CAMEL-8962
> Project: Camel
> Issue Type: Bug
> Components: camel-velocity
> Reporter: Chris Pimlott
>
> Specifying the a velocity template via the {{CamelVelocityResourceUri}} does not work correctly if the {{velocity:}} used contains a character that is URL encoded.
> For example:
> {code}
> from("direct:input")
> .setHeader(VelocityConstants.VELOCITY_RESOURCE_URI).constant("velocity/letter.vm")
> .to("velocity:[template-in-header]")
> .to("mock:results");
> {code}
> Results in: java.io.FileNotFoundException: Cannot find resource: [template-in-header] in classpath for URI: [template-in-header]
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)