public class NetworkingModule extends ReactContextBaseJavaModule
NativeModule.NativeMethod| Modifier and Type | Field and Description |
|---|---|
static int |
CHUNK_TIMEOUT_NS |
static java.lang.String |
CONTENT_ENCODING_HEADER_NAME |
static java.lang.String |
CONTENT_TYPE_HEADER_NAME |
static int |
MAX_CHUNK_SIZE_BETWEEN_FLUSHES |
expolib_v1.okhttp3.OkHttpClient |
mClient |
ForwardingCookieHandler |
mCookieHandler |
CookieJarContainer |
mCookieJarContainer |
java.lang.String |
mDefaultUserAgent |
java.util.Set<java.lang.Integer> |
mRequestIds |
boolean |
mShuttingDown |
static java.lang.String |
NAME |
static java.lang.String |
REQUEST_BODY_KEY_BASE64 |
static java.lang.String |
REQUEST_BODY_KEY_FORMDATA |
static java.lang.String |
REQUEST_BODY_KEY_STRING |
static java.lang.String |
REQUEST_BODY_KEY_URI |
static java.lang.String |
USER_AGENT_HEADER_NAME |
METHOD_TYPE_ASYNC, METHOD_TYPE_PROMISE, METHOD_TYPE_SYNC| Constructor and Description |
|---|
NetworkingModule(ReactApplicationContext context) |
NetworkingModule(ReactApplicationContext context,
java.util.List<NetworkInterceptorCreator> networkInterceptorCreators) |
NetworkingModule(ReactApplicationContext context,
java.lang.String defaultUserAgent) |
| Modifier and Type | Method and Description |
|---|---|
void |
abortRequest(int requestId) |
void |
clearCookies(Callback callback) |
java.lang.String |
getName() |
void |
initialize()
This is called at the end of
CatalystApplicationFragment#createCatalystInstance()
after the CatalystInstance has been created, in order to initialize NativeModules that require
the CatalystInstance or JS modules. |
void |
onCatalystInstanceDestroy()
Called before {CatalystInstance#onHostDestroy}
|
void |
sendRequest(java.lang.String method,
java.lang.String url,
int requestId,
ReadableArray headers,
ReadableMap data,
java.lang.String responseType,
boolean useIncrementalUpdates,
int timeout,
boolean withCredentials) |
getCurrentActivity, getReactApplicationContextcanOverrideExistingModule, getConstants, hasConstantspublic static final java.lang.String NAME
public static java.lang.String CONTENT_ENCODING_HEADER_NAME
public static java.lang.String CONTENT_TYPE_HEADER_NAME
public static java.lang.String REQUEST_BODY_KEY_STRING
public static java.lang.String REQUEST_BODY_KEY_URI
public static java.lang.String REQUEST_BODY_KEY_FORMDATA
public static java.lang.String REQUEST_BODY_KEY_BASE64
public static java.lang.String USER_AGENT_HEADER_NAME
public static int CHUNK_TIMEOUT_NS
public static int MAX_CHUNK_SIZE_BETWEEN_FLUSHES
public final expolib_v1.okhttp3.OkHttpClient mClient
public final ForwardingCookieHandler mCookieHandler
@Nullable public final java.lang.String mDefaultUserAgent
public final CookieJarContainer mCookieJarContainer
public final java.util.Set<java.lang.Integer> mRequestIds
public boolean mShuttingDown
public NetworkingModule(ReactApplicationContext context)
context - the ReactContext of the applicationpublic NetworkingModule(ReactApplicationContext context, java.util.List<NetworkInterceptorCreator> networkInterceptorCreators)
context - the ReactContext of the applicationnetworkInterceptorCreators - list of NetworkInterceptorCreator's whose create()
methods would be called to attach the interceptors to the client.public NetworkingModule(ReactApplicationContext context, java.lang.String defaultUserAgent)
context - the ReactContext of the applicationdefaultUserAgent - the User-Agent header that will be set for all requests where the
caller does not provide one explicitlypublic void initialize()
NativeModuleCatalystApplicationFragment#createCatalystInstance()
after the CatalystInstance has been created, in order to initialize NativeModules that require
the CatalystInstance or JS modules.initialize in interface NativeModuleinitialize in class BaseJavaModulepublic java.lang.String getName()
require() this module
from javascript.public void onCatalystInstanceDestroy()
NativeModuleonCatalystInstanceDestroy in interface NativeModuleonCatalystInstanceDestroy in class BaseJavaModulepublic void sendRequest(java.lang.String method,
java.lang.String url,
int requestId,
ReadableArray headers,
ReadableMap data,
java.lang.String responseType,
boolean useIncrementalUpdates,
int timeout,
boolean withCredentials)
public void abortRequest(int requestId)
public void clearCookies(Callback callback)