/** * Resolve the query by loading the query from the classpath or file resource if needed. */ public static String resolveQuery(CamelContext camelContext, String query, String placeholder) throws NoTypeConversionAvailableException, IOException { String answer = query; if (ResourceHelper.hasScheme(query)) { InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(camelContext, query); answer = camelContext.getTypeConverter().mandatoryConvertTo(String.class, is); if (placeholder != null) { answer = answer.replaceAll(placeholder, "?"); } } return answer; } }
} else if (ResourceHelper.hasScheme(value)) {
/** * Resolves the script. * * @param script script or uri for a script to load * @return the script * @throws IOException is thrown if error loading the script */ protected String resolveScript(String script) throws IOException { String answer; if (ResourceHelper.hasScheme(script)) { InputStream is = loadResource(script); answer = currentExchange.get().getContext().getTypeConverter().convertTo(String.class, is); IOHelper.close(is); } else { answer = script; } return answer; }