public final class ResourceHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
appendParameters(String uri,
Map<String,Object> parameters)
Appends the parameters to the given uri
|
static String |
getScheme(String uri)
Gets the scheme from the URI (e.g.
|
static boolean |
hasScheme(String uri)
Determines whether the URI has a scheme (e.g.
|
static boolean |
isHttpUri(String uri)
Is the given uri a http uri?
|
static InputStream |
resolveMandatoryResourceAsInputStream(CamelContext camelContext,
String uri)
Resolves the mandatory resource.
|
static InputStream |
resolveMandatoryResourceAsInputStream(ClassResolver classResolver,
String uri)
Deprecated.
|
static URL |
resolveMandatoryResourceAsUrl(ClassResolver classResolver,
String uri)
Resolves the mandatory resource.
|
static String |
resolveOptionalExternalScript(CamelContext camelContext,
Exchange exchange,
String expression)
Resolves the expression/predicate whether it refers to an external script on the file/classpath etc.
|
static String |
resolveOptionalExternalScript(CamelContext camelContext,
String expression)
Resolves the expression/predicate whether it refers to an external script on the file/classpath etc.
|
static InputStream |
resolveResourceAsInputStream(ClassResolver classResolver,
String uri)
Resolves the resource.
|
static URL |
resolveResourceAsUrl(ClassResolver classResolver,
String uri)
Resolves the resource.
|
public static String resolveOptionalExternalScript(CamelContext camelContext, String expression)
public static String resolveOptionalExternalScript(CamelContext camelContext, Exchange exchange, String expression)
public static boolean hasScheme(String uri)
uri - the URIpublic static String getScheme(String uri)
uri - the uripublic static InputStream resolveMandatoryResourceAsInputStream(CamelContext camelContext, String uri) throws IOException
RegistryRegistry and call the methodURLStreamHandler registered for the resolveMandatoryResourceAsUrl(org.apache.camel.spi.ClassResolver, String)camelContext - the Camel Contexturi - URI of the resourceInputStream. Remember to close this stream after usage.IOException - is thrown if the resource file could not be found or loaded as InputStream@Deprecated public static InputStream resolveMandatoryResourceAsInputStream(ClassResolver classResolver, String uri) throws IOException
resolveMandatoryResourceAsInputStream(CamelContext, String)resolveMandatoryResourceAsUrl(org.apache.camel.spi.ClassResolver, String)classResolver - the class resolver to load the resource from the classpathuri - URI of the resourceInputStream. Remember to close this stream after usage.IOException - is thrown if the resource file could not be found or loaded as InputStreampublic static InputStream resolveResourceAsInputStream(ClassResolver classResolver, String uri) throws IOException
resolveMandatoryResourceAsUrl(org.apache.camel.spi.ClassResolver, String)classResolver - the class resolver to load the resource from the classpathuri - URI of the resourceInputStream. Remember to close this stream after usage. Or null if not found.IOException - is thrown if error loading the resourcepublic static URL resolveMandatoryResourceAsUrl(ClassResolver classResolver, String uri) throws FileNotFoundException, MalformedURLException
classResolver - the class resolver to load the resource from the classpathuri - uri of the resourceURL.FileNotFoundException - is thrown if the resource file could not be foundMalformedURLException - if the URI is malformedpublic static URL resolveResourceAsUrl(ClassResolver classResolver, String uri) throws MalformedURLException
classResolver - the class resolver to load the resource from the classpathuri - uri of the resourceURL. Or null if not found.MalformedURLException - if the URI is malformedpublic static boolean isHttpUri(String uri)
uri - the uripublic static String appendParameters(String uri, Map<String,Object> parameters) throws URISyntaxException
uri - the uriparameters - the additional parameters (will clear the map)URISyntaxException - is thrown if the uri is invalidApache Camel