Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-4629

Add support for loading script from file/classpath in the groovy/ognl/mvel etc components

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.11.0
    • Component/s: None
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      This allows these language components to be more usable, and for people to have scripts in external resources in the classpath or the file system.

      The script can be loaded like this code:

              if (ResourceHelper.hasScheme(script)) {
                  InputStream is = loadResource(script);
                  answer = getCamelContext().getTypeConverter().convertTo(String.class, is);
                  IOHelper.close(is);
              } else {
                  // already a script so no need to load
      

        Issue Links

          Activity

          Hide
          davsclaus Claus Ibsen added a comment -

          You can now prefix with "resource:classpath:foo.txt" to load the script from teh foo.txt from the classpath etc.

          Show
          davsclaus Claus Ibsen added a comment - You can now prefix with "resource:classpath:foo.txt" to load the script from teh foo.txt from the classpath etc.

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              davsclaus Claus Ibsen
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development