Class RESTUtils


  • public class RESTUtils
    extends Object
    Utility class around REST webservices.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • RESTUtils

        public RESTUtils()
    • Method Detail

      • configureClient

        public static void configureClient​(adams.flow.core.Actor owner,
                                           Object servicePort,
                                           int connection,
                                           int receive,
                                           String url)
        Sets the timeouts for connection and receiving. Also configures the proxy settings in case there is a system-wide proxy configured.
        Parameters:
        owner - the owning actor
        servicePort - the service port to set the timeouts for
        connection - the timeout for the connection in msec, 0 is infinite
        receive - the timeout for receiving in msec, 0 is infinite
        url - the URL of the webservice, null to use default
        See Also:
        ProxyHelper
      • configureFactoryInterceptors

        public static void configureFactoryInterceptors​(adams.flow.core.Actor owner,
                                                        org.apache.cxf.jaxrs.JAXRSServerFactoryBean factory,
                                                        AbstractInInterceptorGenerator inInterceptor,
                                                        AbstractOutInterceptorGenerator outInterceptor)
        Configures the interceptors/logging for the service endpoint (incoming and outgoing).
        Parameters:
        owner - the owning actor
        factory - the server factory to update
        inInterceptor - the interceptor for incoming messages
        outInterceptor - the interceptor for outcoing messages
      • loadWsdl

        public static String loadWsdl​(URL location)
        Loads the WSDL from the given location.
        Parameters:
        location - the location of the WSDL
        Returns:
        the content of the WSDL, null if failed to load
      • getAdditionalInformation

        protected static String getAdditionalInformation​(Class cls)
        Returns the additional for the class, if any.
        Parameters:
        cls - the class to inspect
        Returns:
        the generated information, null if none available
      • getAdditionalInformation

        protected static String getAdditionalInformation​(Method method)
        Returns the additional for the method, if any.
        Parameters:
        method - the method to inspect
        Returns:
        the generated information, null if none available
      • getAdditionalInformation

        public static String getAdditionalInformation​(RESTPlugin plugin)
        Generates information about the plugin, to be used for the information return by AdditionalInformationHandler.
        Parameters:
        plugin - the plugin to generate the information for
        Returns:
        the information, null if none available