Class OkHttpClientHandler

  • All Implemented Interfaces:
    net.morimekta.providence.PServiceCallHandler

    public class OkHttpClientHandler
    extends java.lang.Object
    implements net.morimekta.providence.PServiceCallHandler
    HTTP client handler using the OkHTTP client interface.
    • Constructor Summary

      Constructors 
      Constructor Description
      OkHttpClientHandler​(java.util.function.Supplier<java.net.URL> urlSupplier)
      Create a HTTP client with default transport, serialization and no instrumentation.
      OkHttpClientHandler​(java.util.function.Supplier<java.net.URL> urlSupplier, okhttp3.OkHttpClient factory)
      Create a HTTP client with default serialization and no instrumentation.
      OkHttpClientHandler​(java.util.function.Supplier<java.net.URL> urlSupplier, okhttp3.OkHttpClient factory, net.morimekta.providence.serializer.SerializerProvider serializerProvider)
      Create a HTTP client with no instrumentation.
      OkHttpClientHandler​(java.util.function.Supplier<java.net.URL> urlSupplier, okhttp3.OkHttpClient factory, net.morimekta.providence.serializer.SerializerProvider serializerProvider, net.morimekta.providence.PServiceCallInstrumentation instrumentation)
      Create a HTTP client.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <Request extends net.morimekta.providence.PMessage<Request>,​Response extends net.morimekta.providence.PMessage<Response>>
      net.morimekta.providence.PServiceCall<Response>
      handleCall​(net.morimekta.providence.PServiceCall<Request> call, net.morimekta.providence.descriptor.PService service)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OkHttpClientHandler

        public OkHttpClientHandler​(@Nonnull
                                   java.util.function.Supplier<java.net.URL> urlSupplier)
        Create a HTTP client with default transport, serialization and no instrumentation.
        Parameters:
        urlSupplier - The HTTP url supplier.
      • OkHttpClientHandler

        public OkHttpClientHandler​(@Nonnull
                                   java.util.function.Supplier<java.net.URL> urlSupplier,
                                   @Nonnull
                                   okhttp3.OkHttpClient factory)
        Create a HTTP client with default serialization and no instrumentation.
        Parameters:
        urlSupplier - The HTTP url supplier.
        factory - The HTTP request factory.
      • OkHttpClientHandler

        public OkHttpClientHandler​(@Nonnull
                                   java.util.function.Supplier<java.net.URL> urlSupplier,
                                   @Nonnull
                                   okhttp3.OkHttpClient factory,
                                   @Nonnull
                                   net.morimekta.providence.serializer.SerializerProvider serializerProvider)
        Create a HTTP client with no instrumentation.
        Parameters:
        urlSupplier - The HTTP url supplier.
        factory - The HTTP request factory.
        serializerProvider - The serializer provider.
      • OkHttpClientHandler

        public OkHttpClientHandler​(@Nonnull
                                   java.util.function.Supplier<java.net.URL> urlSupplier,
                                   @Nonnull
                                   okhttp3.OkHttpClient factory,
                                   @Nonnull
                                   net.morimekta.providence.serializer.SerializerProvider serializerProvider,
                                   @Nonnull
                                   net.morimekta.providence.PServiceCallInstrumentation instrumentation)
        Create a HTTP client.
        Parameters:
        urlSupplier - The HTTP url supplier.
        factory - The HTTP request factory.
        serializerProvider - The serializer provider.
        instrumentation - The service call instrumentation.
    • Method Detail

      • handleCall

        public <Request extends net.morimekta.providence.PMessage<Request>,​Response extends net.morimekta.providence.PMessage<Response>> net.morimekta.providence.PServiceCall<Response> handleCall​(net.morimekta.providence.PServiceCall<Request> call,
                                                                                                                                                                                                          net.morimekta.providence.descriptor.PService service)
                                                                                                                                                                                                   throws java.io.IOException
        Specified by:
        handleCall in interface net.morimekta.providence.PServiceCallHandler
        Throws:
        java.io.IOException