Class HeaderInterceptor
- java.lang.Object
-
- com.contentful.java.cda.interceptor.HeaderInterceptor
-
- All Implemented Interfaces:
okhttp3.Interceptor
- Direct Known Subclasses:
AuthorizationHeaderInterceptor,ContentfulUserAgentHeaderInterceptor,UserAgentHeaderInterceptor
public class HeaderInterceptor extends java.lang.Object implements okhttp3.InterceptorThis class adds custom headers to all requests it intercepts.
-
-
Constructor Summary
Constructors Constructor Description HeaderInterceptor(java.lang.String name, java.lang.String value)Create an arbitrary header adding interceptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetName()java.lang.StringgetValue()okhttp3.Responseintercept(okhttp3.Interceptor.Chain chain)Method called by framework, to enrich current request chain with the header information requested.
-
-
-
Method Detail
-
intercept
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws java.io.IOExceptionMethod called by framework, to enrich current request chain with the header information requested.- Specified by:
interceptin interfaceokhttp3.Interceptor- Parameters:
chain- the execution chain for the request.- Returns:
- the response received.
- Throws:
java.io.IOException- in case of failure down the line.
-
getName
public java.lang.String getName()
- Returns:
- the name of this header.
-
getValue
public java.lang.String getValue()
- Returns:
- the value of this header.
-
-