Class HttpRestClientSugar



  • public class HttpRestClientSugar
    extends RestDeleteClientSugar
    Declarative syntactic sugar which may be statically imported in order to allow declarative definitions of REST client functionality: import static org.refcodes.rest.HttpRestClientSugar.*;
    • Constructor Detail

      • HttpRestClientSugar

        public HttpRestClientSugar​()
    • Method Detail

      • open

        public static void open​()
                         throws org.refcodes.component.OpenException
        Throws:
        org.refcodes.component.OpenException - thrown in case something went wrong.
      • open

        public static void open​(org.refcodes.security.TrustStoreDescriptor aStoreDescriptor)
                         throws org.refcodes.component.OpenException
        Parameters:
        aStoreDescriptor - The store descriptor describing your KeyStore required by HTTPS.
        Throws:
        org.refcodes.component.OpenException - thrown in case something went wrong.
      • open

        public static void open​(org.refcodes.net.Url aBaseUrl)
                         throws org.refcodes.component.OpenException
        Parameters:
        aBaseUrl - The base Url to be used.
        Throws:
        org.refcodes.component.OpenException - thrown in case something went wrong.
      • open

        public static void open​(org.refcodes.net.Url aBaseUrl,
                                org.refcodes.security.TrustStoreDescriptor aStoreDescriptor)
                         throws org.refcodes.component.OpenException
        Parameters:
        aBaseUrl - The base Url to be used.
        aStoreDescriptor - The store descriptor describing your KeyStore required by HTTPS.
        Throws:
        org.refcodes.component.OpenException - thrown in case something went wrong.
      • open

        public static HttpRestServer open​(org.refcodes.net.HttpServerContext aCtx)
                                   throws org.refcodes.component.OpenException
        See ConnectionOpenable.open(Object)
        Parameters:
        aCtx - The context describing the parameters required to open the connection.
        Returns:
        The HttpRestServer
        Throws:
        org.refcodes.component.OpenException - thrown in case something went wrong.
      • withBaseUrl

        public static HttpRestClient withBaseUrl​(java.lang.String aBaseUrl)
                                          throws java.net.MalformedURLException
        See also BaseUrlAccessor.BaseUrlBuilder.withBaseUrl(String)
        Parameters:
        aBaseUrl - The base url
        Returns:
        The HTTP rest client
        Throws:
        java.net.MalformedURLException - the malformed URL exception
      • withBaseUrl

        public static HttpRestClient withBaseUrl​(java.net.URL aBaseUrl)
        See also BaseUrlAccessor.BaseUrlBuilder.withBaseUrl(URL)
        Parameters:
        aBaseUrl - The base url
        Returns:
        The HTTP rest client
      • withUserAgent

        public static HttpRestClient withUserAgent​(java.lang.String aUserAgent)
                                            throws java.net.MalformedURLException
        Parameters:
        aUserAgent - The user agent
        Returns:
        The HTTP rest client
        Throws:
        java.net.MalformedURLException - the malformed URL exception