Class RestComponentHelper


  • public final class RestComponentHelper
    extends Object
    Helper class for rest-dsl components.
    • Method Detail

      • 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 to
        verb - the HTTP verb for the route
        addOptions - 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 name
        config - 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 configuration
        config - 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)
                                            throws URISyntaxException
        Creates the Rest consumers url based on component and url options.
        Parameters:
        componentName - the name of the rest component
        verb - the HTTP verb
        path - the HTTP path of the route
        queryMap - 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)
                                            throws URISyntaxException
        Creates the Rest consumers url based on component and url options.
        Parameters:
        componentName - the name of the rest component
        path - the HTTP path of the route
        queryMap - 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)
                                            throws URISyntaxException
        Creates the Rest consumers url based on component and url options.
        Parameters:
        componentName - the name of the rest component
        scheme - the scheme of the HTTP route http/https
        host - the host of the HTTP route
        port - the port the route will be exposed through
        path - the HTTP path of the route
        queryMap - the endpoint query options
        Returns:
        a string of the component route url
        Throws:
        URISyntaxException - - is thrown if uri has invalid syntax.