-
- 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 interface
NetworkingModule.UriHandler
Allows 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 interface
NetworkingModule.RequestBodyHandler
Allows adding custom handling to build the RequestBody from the JS body payload.
public interface
NetworkingModule.ResponseHandler
Allows adding custom handling to build the JS body payload from the ResponseBody.
public interface
NetworkingModule.CustomClientBuilder
-
Field Summary
Fields Modifier and Type Field Description public final static String
NAME
private static NetworkingModule.CustomClientBuilder
customClientBuilder
-
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 void
setCustomClientBuilder(NetworkingModule.CustomClientBuilder ccb)
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. String
getName()
void
invalidate()
The CatalystInstance is going away with Venice. void
addUriHandler(NetworkingModule.UriHandler handler)
void
addRequestBodyHandler(NetworkingModule.RequestBodyHandler handler)
void
addResponseHandler(NetworkingModule.ResponseHandler handler)
void
removeUriHandler(NetworkingModule.UriHandler handler)
void
removeRequestBodyHandler(NetworkingModule.RequestBodyHandler handler)
void
removeResponseHandler(NetworkingModule.ResponseHandler handler)
void
sendRequest(String method, String url, double requestIdAsDouble, ReadableArray headers, ReadableMap data, String responseType, boolean useIncrementalUpdates, double timeoutAsDouble, boolean withCredentials)
void
sendRequestInternal(String method, String url, int requestId, ReadableArray headers, ReadableMap data, String responseType, boolean useIncrementalUpdates, int timeout, boolean withCredentials)
void
abortRequest(double requestIdAsDouble)
void
clearCookies(Callback callback)
void
addListener(String eventName)
void
removeListeners(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)
-
-
-
-