You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Thomas (JIRA)" <ji...@apache.org> on 2013/01/09 08:58:15 UTC

[jira] [Updated] (CAMEL-5942) Custom URIResolve not used to load XSTL script

     [ https://issues.apache.org/jira/browse/CAMEL-5942?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas  updated CAMEL-5942:
---------------------------

    Description: 
My problem is to load a XSLT script from database or provided as byte array but not as file in classpath or http.

A custom uri resolver would do the job. XsltEndpoint uses a ResourceHelper to load the XSTL resource instead of a given custom uri resolver.

{code}
    private synchronized void loadResource(XsltBuilder xslt, String resourceUri) throws TransformerConfigurationException, IOException {
        LOG.trace("{} loading schema resource: {}", this, resourceUri);
        // prefer to use URL over InputStream as it loads better with http
        URL url = ResourceHelper.resolveMandatoryResourceAsUrl(getCamelContext().getClassResolver(), resourceUri);
        xslt.setTransformerURL(url);
        // now loaded so clear flag
        cacheCleared = false;
    }
{code}

The ResourceHelper or this method should use the same URIResolver as XsltBuilder.

Another way would be to make the method above protected to be able to overwrite the behaviour.

  was:
My problem is to load a XSLT script from database or provided as byte array but not as file in classpath or http.

A custom uri resolver would do the job. XsltEndpoint uses a ResourceHelper to load the XSTL resource instead of a given custom uri resolver.

{code}
    private synchronized void loadResource(XsltBuilder xslt, String resourceUri) throws TransformerConfigurationException, IOException {
        LOG.trace("{} loading schema resource: {}", this, resourceUri);
        // prefer to use URL over InputStream as it loads better with http
        URL url = ResourceHelper.resolveMandatoryResourceAsUrl(getCamelContext().getClassResolver(), resourceUri);
        xslt.setTransformerURL(url);
        // now loaded so clear flag
        cacheCleared = false;
    }
{code}

Another way would be to make the method above protected to overwrite the behaviour.

    
> Custom URIResolve not used to load XSTL script
> ----------------------------------------------
>
>                 Key: CAMEL-5942
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5942
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-xslt
>    Affects Versions: 2.10.3
>         Environment: Windows, Java 1.6
>            Reporter: Thomas 
>
> My problem is to load a XSLT script from database or provided as byte array but not as file in classpath or http.
> A custom uri resolver would do the job. XsltEndpoint uses a ResourceHelper to load the XSTL resource instead of a given custom uri resolver.
> {code}
>     private synchronized void loadResource(XsltBuilder xslt, String resourceUri) throws TransformerConfigurationException, IOException {
>         LOG.trace("{} loading schema resource: {}", this, resourceUri);
>         // prefer to use URL over InputStream as it loads better with http
>         URL url = ResourceHelper.resolveMandatoryResourceAsUrl(getCamelContext().getClassResolver(), resourceUri);
>         xslt.setTransformerURL(url);
>         // now loaded so clear flag
>         cacheCleared = false;
>     }
> {code}
> The ResourceHelper or this method should use the same URIResolver as XsltBuilder.
> Another way would be to make the method above protected to be able to overwrite the behaviour.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira