-
- All Implemented Interfaces:
-
com.facebook.react.bridge.NativeModule,com.facebook.react.bridge.ReactModuleWithSpec,com.facebook.react.turbomodule.core.interfaces.TurboModule
public final class NetworkingModule extends NativeNetworkingAndroidSpec
Implements the XMLHttpRequest JavaScript interface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceNetworkingModule.UriHandlerAllows to implement a custom fetching process for specific URIs. It is the handler's job tofetch the URI and return the JS body payload.
public interfaceNetworkingModule.RequestBodyHandlerAllows adding custom handling to build the RequestBody from the JS body payload.
public interfaceNetworkingModule.ResponseHandlerAllows adding custom handling to build the JS body payload from the ResponseBody.
public interfaceNetworkingModule.CustomClientBuilder
-
Field Summary
Fields Modifier and Type Field Description public final static StringNAMEprivate static NetworkingModule.CustomClientBuildercustomClientBuilder
-
Constructor Summary
Constructors Constructor Description NetworkingModule(ReactApplicationContext context)NetworkingModule(ReactApplicationContext context, List<NetworkInterceptorCreator> networkInterceptorCreators)NetworkingModule(ReactApplicationContext context, String defaultUserAgent)
-
Method Summary
Modifier and Type Method Description static voidsetCustomClientBuilder(NetworkingModule.CustomClientBuilder ccb)voidinitialize()This is called at the end of createCatalystInstance afterthe CatalystInstance has been created, in order to initialize NativeModules that require theCatalystInstance or JS modules. StringgetName()voidinvalidate()The CatalystInstance is going away with Venice. voidaddUriHandler(NetworkingModule.UriHandler handler)voidaddRequestBodyHandler(NetworkingModule.RequestBodyHandler handler)voidaddResponseHandler(NetworkingModule.ResponseHandler handler)voidremoveUriHandler(NetworkingModule.UriHandler handler)voidremoveRequestBodyHandler(NetworkingModule.RequestBodyHandler handler)voidremoveResponseHandler(NetworkingModule.ResponseHandler handler)voidsendRequest(String method, String url, double requestIdAsDouble, ReadableArray headers, ReadableMap data, String responseType, boolean useIncrementalUpdates, double timeoutAsDouble, boolean withCredentials)voidsendRequestInternal(String method, String url, int requestId, ReadableArray headers, ReadableMap data, String responseType, boolean useIncrementalUpdates, int timeout, boolean withCredentials)voidabortRequest(double requestIdAsDouble)voidclearCookies(Callback callback)voidaddListener(String eventName)voidremoveListeners(double count)-
Methods inherited from class com.facebook.fbreact.specs.NativeNetworkingAndroidSpec
abortRequest, clearCookies, sendRequest -
Methods inherited from class com.facebook.react.bridge.BaseJavaModule
canOverrideExistingModule, getConstants, hasConstants, onCatalystInstanceDestroy -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
NetworkingModule
NetworkingModule(ReactApplicationContext context)
- Parameters:
context- the ReactContext of the application
-
NetworkingModule
NetworkingModule(ReactApplicationContext context, List<NetworkInterceptorCreator> networkInterceptorCreators)
- Parameters:
context- the ReactContext of the applicationnetworkInterceptorCreators- list of NetworkInterceptorCreator's whose create()methods would be called to attach the interceptors to the client.
-
NetworkingModule
NetworkingModule(ReactApplicationContext context, String defaultUserAgent)
- Parameters:
context- the ReactContext of the applicationdefaultUserAgent- the User-Agent header that will be set for all requests where thecaller does not provide one explicitly
-
-
Method Detail
-
setCustomClientBuilder
static void setCustomClientBuilder(NetworkingModule.CustomClientBuilder ccb)
-
initialize
void initialize()
This is called at the end of createCatalystInstance afterthe CatalystInstance has been created, in order to initialize NativeModules that require theCatalystInstance or JS modules.
-
invalidate
void invalidate()
The CatalystInstance is going away with Venice. Therefore, the TurboModule infra introduces theinvalidate() method to allow NativeModules to clean up after themselves.
-
addUriHandler
void addUriHandler(NetworkingModule.UriHandler handler)
-
addRequestBodyHandler
void addRequestBodyHandler(NetworkingModule.RequestBodyHandler handler)
-
addResponseHandler
void addResponseHandler(NetworkingModule.ResponseHandler handler)
-
removeUriHandler
void removeUriHandler(NetworkingModule.UriHandler handler)
-
removeRequestBodyHandler
void removeRequestBodyHandler(NetworkingModule.RequestBodyHandler handler)
-
removeResponseHandler
void removeResponseHandler(NetworkingModule.ResponseHandler handler)
-
sendRequest
void sendRequest(String method, String url, double requestIdAsDouble, ReadableArray headers, ReadableMap data, String responseType, boolean useIncrementalUpdates, double timeoutAsDouble, boolean withCredentials)
-
sendRequestInternal
void sendRequestInternal(String method, String url, int requestId, ReadableArray headers, ReadableMap data, String responseType, boolean useIncrementalUpdates, int timeout, boolean withCredentials)
- Parameters:
timeout- value of 0 results in no timeout
-
abortRequest
void abortRequest(double requestIdAsDouble)
-
clearCookies
void clearCookies(Callback callback)
-
addListener
void addListener(String eventName)
-
removeListeners
void removeListeners(double count)
-
-
-
-