Class ContentTypeInterceptor

  • All Implemented Interfaces:
    okhttp3.Interceptor

    public class ContentTypeInterceptor
    extends java.lang.Object
    implements okhttp3.Interceptor
    Interceptor to add content type header to requests
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface okhttp3.Interceptor

        okhttp3.Interceptor.Chain
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String HEADER_NAME  
    • Constructor Summary

      Constructors 
      Constructor Description
      ContentTypeInterceptor​(java.lang.String contentType)
      Create Header interceptor, saving parameters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      okhttp3.Response intercept​(okhttp3.Interceptor.Chain chain)
      Method called by framework, to enrich current request with the header information requested.
      • Methods inherited from class java.lang.Object

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

      • ContentTypeInterceptor

        public ContentTypeInterceptor​(java.lang.String contentType)
        Create Header interceptor, saving parameters.
        Parameters:
        contentType - type header to be send with all of the requests
    • Method Detail

      • intercept

        public okhttp3.Response intercept​(okhttp3.Interceptor.Chain chain)
                                   throws java.io.IOException
        Method called by framework, to enrich current request with the header information requested.
        Specified by:
        intercept in interface okhttp3.Interceptor
        Parameters:
        chain - the execution chain for the request.
        Returns:
        the response received
        Throws:
        java.io.IOException - if chain had an error