Package org.apache.camel.support
Class RestComponentHelper
java.lang.Object
org.apache.camel.support.RestComponentHelper
Helper class for rest-dsl components.
-
Method Summary
Modifier and TypeMethodDescriptionaddHttpRestrictParam
(Map<String, Object> queryMap, String verb, boolean addOptions) static String
createRestConsumerUrl
(String componentName, String scheme, String host, int port, String path, Map<String, Object> queryMap) Creates the Rest consumers url based on component and url options.static String
Creates the Rest consumers url based on component and url options.static String
Creates the Rest consumers url based on component and url options.initRestEndpointProperties
(String componentName, org.apache.camel.spi.RestConfiguration config) Creates an endpoint properties based on properties set in the component's RestConfiguration.static String
resolveRestHostName
(String host, org.apache.camel.spi.RestConfiguration config) Sets the Rest consumer host based on RestConfiguration
-
Method Details
-
addHttpRestrictParam
public static Map<String,Object> addHttpRestrictParam(Map<String, Object> queryMap, String verb, boolean addOptions) - Parameters:
queryMap
- the map of Endpoint options to apply the HTTP restrict settings toverb
- the HTTP verb for the routeaddOptions
- should OPTIONS verb be added.- Returns:
- the map of Endpoint Properties with HTTP Restrict Options set
-
initRestEndpointProperties
public static Map<String,Object> initRestEndpointProperties(String componentName, org.apache.camel.spi.RestConfiguration config) Creates an endpoint properties based on properties set in the component's RestConfiguration.- Parameters:
componentName
- the Rest Component nameconfig
- the RestConfiguration- Returns:
- the map of endpoint properties set in the RestConfiguration
-
resolveRestHostName
public static String resolveRestHostName(String host, org.apache.camel.spi.RestConfiguration config) throws UnknownHostException Sets the Rest consumer host based on RestConfiguration- Parameters:
host
- the existing host configurationconfig
- the RestConfiguration- Returns:
- the host based on RestConfiguration
- Throws:
UnknownHostException
- thrown when local host or local ip can't be resolved via network interfaces.
-
createRestConsumerUrl
public static String createRestConsumerUrl(String componentName, String verb, String path, Map<String, Object> queryMap) Creates the Rest consumers url based on component and url options.- Parameters:
componentName
- the name of the rest componentverb
- the HTTP verbpath
- the HTTP path of the routequeryMap
- the endpoint query options- Returns:
- a string of the component route url
- Throws:
URISyntaxException
- - is thrown if uri has invalid syntax.
-
createRestConsumerUrl
public static String createRestConsumerUrl(String componentName, String path, Map<String, Object> queryMap) Creates the Rest consumers url based on component and url options.- Parameters:
componentName
- the name of the rest componentpath
- the HTTP path of the routequeryMap
- the endpoint query options- Returns:
- a string of the component route url
- Throws:
URISyntaxException
- - is thrown if uri has invalid syntax.
-
createRestConsumerUrl
public static String createRestConsumerUrl(String componentName, String scheme, String host, int port, String path, Map<String, Object> queryMap) Creates the Rest consumers url based on component and url options.- Parameters:
componentName
- the name of the rest componentscheme
- the scheme of the HTTP route http/httpshost
- the host of the HTTP routeport
- the port the route will be exposed throughpath
- the HTTP path of the routequeryMap
- the endpoint query options- Returns:
- a string of the component route url
- Throws:
URISyntaxException
- - is thrown if uri has invalid syntax.
-