Need help with NoHttpRxUtils?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

218 Stars 37 Forks 84 Commits 4 Opened issues


:tropical_fish: 本库是一款Android-Http标准协议网络通讯框架,基于RxJava+NoHttp封装。支持文件上传和断点续传、文件下载和断点下载、Http协议和Https协议队列网络请求、网络请求轮询。

Services available


Need anything else?

Contributors list

# 134,227
64 commits


---- v.2.0.5 New in version ---- * Compatible to NoHttp-v.1.1.11 * Repair BUGFix bug that download file is not available because the file name was not passed in at the time of download * NohttpDownloadUtils File download tool object added (getDownloadRequestsUrl() Get the path method corresponding to the download request What value)

Because NoHttpRxUtils through the RxJava face NoHttp network framework for a series of bundle.First of all against RxJava and NoHttp network framework to do a brief introduction

What is the RxJava framework?

RxJava is a responsive programming design frame.
In a responsive programming, when the data arrives, the consumer responds.
Responsive programming can pass events to registered observers.

RxJava Frame GitHub(ReactiveX)

What is the NoHttp framework?

NoHttp is a framework specifically for Android network communications

NoHttp framework characteristic

Easier to use than 'Retrofit' is easier to use.

Dynamic configuration of the underlying framework is OkHttp、HttpURLConnection

Support asynchronous requests, And supports synchronization requests

Support multi-file upload, support large file upload, support the form to submit data

Support file download and upload, and provide progress callback.

Support Json, xml, Map, List format submission

Support Http cache mode. Cache memory address can specify the database or SD card. The cached data has been encrypted securely.

Support for custom Request, you can directly request JsonObject or JavaBean and so on.

Support automatic maintenance of cookies. Project restart or system restart can continue to maintain.

Support Http 301, 302,303,304,307 redirect. Supports multi-layer nested redirection.

Support Https access, support two-way authentication.

Support failure retry mechanism to support request priority.

Support GET, POST, PUT, PATCH, HEAD, DELETE, OPTIONS, TRACE and other request agreement

Support queue request, support multiple requests concurrent.

Support the cancellation of a request, cancel the specified multiple requests, cancel all requests.

Support breakpoint upload and breakpoint download.

NoHttp Frame GitHub(Zhenjie Yan)

What is the NoHttpRxUtils framework?

NoHttpRxUtils is mainly through the RxJava framework for 'NoHttp' network framework operation re-encapsulation.
Reduce the user's cumbersome calls, so that users are more focused on the project business, rather than the client and the server network communication between.
Since the 'NoHttpRxUtils' network request is a 'NoHttp' synchronization request, the request queue is not a 'NoHttp' queue algorithm but a 'NoHttpRxUtils' queue algorithm.
Sorry, the queue request priority setting is not supported at this time. If you want to make a request priority, you can use the RxJava thread single request.
Sorry, because the Android system to write permissions on the SD card constraints, so all the cache data path points to the database.

NoHttpRxUtils framework characteristic
  • Frame initialization, network request, file download, all use chain response call.
  • Data request aspect, support RxJava thread queue request and RxJava thread single request.
  • RxJava thread request queue, "RxJava thread queue" is through the algorithm to customize the implementation of 'thread pool', and then through the 'thread pool' on the RxJava thread management and operation. Support for revoking individual requests, multiple requests, and specifying requests.
  • RxJava thread single request, directly open a RxJava thread, do not queue priority direct request. Irrevocable.
  • The file download queue is a NoHttp queue algorithm. The 'NoHttp file download' bundle into the Android-Service. Support a single download task to cancel (pause), Support multiple download tasks to cancel, Support single download task recovery (start),Support multiple download tasks to resume (start).
  • Support automatically through the specified object to get the server to return the data. Json format data conversion layer using Gson framework conversion (conversion object defined in the data structure must meet the Json data structure)
  • Supports polling requests,And supports undoing a single polling request or multiple polling requests or specifying a polling request.
  • Support the use of other network framework to polling requests.

For your use more clarity, please read the following tutorials carefully.

RxJava in the internal use of the version is RxJava-1.1.9 and RxJava-2.1.5
NoHttp in the internal use of the version is NoHttp-1.1.4
Gson in the internal use of the version is Gson-2.8.0

How to rely on remotely?


1:In the project root directory build.gradle

gradle allprojects {
repositories { 
    //Rely on the warehouse
   maven { url '' }

2:The project directory build.gradle relies on the NoHttpRxUtils framework
* RxJava-1 project depends on

compile 'com.github.liqinew:nohttprxutils:v.2.0.5'
  • RxJava-2 project depends on

    compile 'com.github.liqinew:nohttprxutils:v.2.0.7'

    NoHttpRxUtils use method

    Chained mode call initialization NoHttp, suggested to the Application onCreate life cycle method inside.

    //Initialize NoHttp
    // hint:in fact, you can call setDialogGetListener here to set the global load box.
          //Whether to maintain cookies,(If true maintain,else not maintained.)
          //Whether the cache into the database.(If true yes,else not.)
          //Whether to open debug.(If true yes,else not.)
          //Set debug to print Name
          //Set the global connection timeout. Unit seconds, default 30s.
          //Set the global server response timeout. Unit seconds, the default 30s.
          //Set the number of concurrent downloads, the default number of concurrent 3.
          //Set the number of concurrent requests for network requests, the default number of concurrent 3.
          //Set the global default load dialog box
          //Note:The incoming context must be the top of the stack.
          //You can get by using the method 'registerActivityLifecycleCallbacks()' to get.
          //Note:This method is not allowed to create a dialog object inside.
          .setDialogGetListener(new Dialog())
          //Set the bottom layer in that way to request.NoHttpInit.OKHTTP or NoHttpInit.URLCONNECTION two ways.
          //Set the global security protocol request with certificate.
          //Note: If the security protocol mode is toggled while the request is being called, the setting is overwritten.
          .setInputStreamSSL(new InputStream())
          //Set the global certificateless security protocol request
          //Note: If the security protocol mode is toggled while the request is being called, the setting is overwritten.
          //Add a global request header
          //Add global request parameters. Only the String type is supported.
          //Set up cookie management to listen.
          .setCookieStoreListener(new DBCookieStore.CookieStoreListener())
          //Set up global host authentication.
          //Note: This setting is not valid if the certificateless security protocol is switched when the request is called.
          .setHostnameVerifier(new HostnameVerifier())
          //Sets the number of global request failed retries.
          //Set global request network appears unknown error hint message
          .setAnUnknownErrorHint("Global unknown error hint message")
          //Start initialization.

How do I use 'NoHttpRxUtils' to download data?

* Start download(Using chain call)

//Get the download request builder

                //Add download file parameters
               .addDownloadParameter(DOWNLOAD_URL, "Download_Name.apk")

               //Set whether to continue downloading at breakpoint.If true yes,else not.

               //Set the download progress monitoring interface
               .setDownloadListener(new DownloadListener())

               //Set whether to delete the same file name file, and then re-download.If true yes,else not.

               //Set the download file to store the file path

               //Single request to set the read time. Unit seconds, default to global read timeout.

               //Single request to set the link timeout. Unit seconds, default to global link timeout.

               //Single request to set the number of failed request retries, default number of global link retries.

               //Open the download
               .satart(new Activity());

* Download Pause (Cancel)

//Pause all Downloading tasks

//Pause the specified download task NoHttpDownloadUtils.cancel(downloadUrl);

* Download recovery

//Restore the specified download

//Restore all downloads NoHttpDownloadUtils.startAllRequest();

* Download the 'what' value of the 'URL'

//Get the 'What' value for the download URL

//Remove the 'What' value for the download URL NoHttpDownloadUtils.removeWhatData(downloadUrl);

//Remove all downloads 'What' values NoHttpDownloadUtils.removeWhatAll();

* Manually clear the download request and close the download service.

//Empty the current download request object and stop the service.
Note: If the last download task is not completed or is not empty, the next click on any download will continue to perform the last failed task to continue to download

How do I use 'NoHttpRxUtils' to request data?

* NoHttpRxUtils network request, Using chain call.

//Get the request object

         //get request mode. In addition to get and post requests, but also support put, delete, head, patch, options, trace,
         //post request mode. In addition to get and post requests, but also support put, delete, head, patch, options, trace,

         //Set the request Url

         //Add the request parameters.
         //Note: When the incoming parameter type does not belong to the internal setting type,
         //the default call toString () of Object is converted to a String type parameter.

         //Add the request header.

         //Set the request bodyEntity to StringEntity and pass the request type.

         //Add a String value for the body for StringEntity.

         //Switch from bodyEntity to request configuration object

         //Set the request bodyEntity to JsonObjectEntity.Json format: {"xx": "xxx", "yy": "yyy"}

         //Add parameters and values to JsonObjectEntity

         //Switch from bodyEntity to request configuration object

         //Set the request bodyEntity to JsonListEntity.json format: [{"xx": "xxx"}, {"yy": "yyy"}]

         //Create an object for JsonList and pass key value parameters

         //Add key-value parameters to the created object

         //Brush the creation object into JsonList
         //Note: If you need to create multiple objects in the collection, 
         //you can continue to call addObjectEntityParameter () after this method to create.
         //The process is consistent with the above.

         //Switch from bodyEntity to request configuration object

         //Set the request bodyEntity to InputStreamEntity

         //Add an input stream to InputStreamEntity
         .addEntityInputStreamParameter(new InputStream())

         //Switch from bodyEntity to request configuration object

         //Single request to set the read time. Unit seconds, default to global read timeout.

         //Single request to set the link timeout. Unit seconds, default to global link timeout.

         //Single request to set the number of failed request retries, default number of global link retries.

         //Set a single request to set the cache key.

         //Single request to set the cache mode. With the original NoHttp five cache mode consistent.

            //Sets whether the current request is added to the Rx "thread pool" queue. default is to add RxJava 'thread pool'. //Note: If false is set, the request thread does not request it directly through the RxJava "thread pool" queue. //Only for data requests, not for polling requests. .setQueue(false)

            //Set the RxJava "thread pool" queue identifier,Please make sure to be unique. //Note: If setQueue (false) is set to false, the setSign (Sign) setting has no effect. .setSign(new Object())

         //Add HTTPS protocol without certificate parameters.

         //Add the HTTPS protocol with certificate parameters.
         .addHttpsIsCertificate(new InputStream())

         //Set the maximum width of the requested image.

         //Set the configuration and scale of the requested bitmap.
         .setBitmapConfigType(Bitmap.Config, ImageView.ScaleType)

         //Set the load box.
         //Note: If you do not set the load box here, then the default use of the global settings of the load box.
         //If the global setting does not set the load box, then the load box and built-in prompts are not displayed.
         //Note:This method is not allowed to create a dialog object inside.
         .setDialogGetListener(new Dialog())

         //Set request network appears unknown error hint message
         .setAnUnknownErrorHint("Unknown error hint message")

         //Create the request object to specify the response data conversion type,
         //and then set the request to succeed or fail the callback interface.
         .builder(Objects.class,new OnIsRequestListener<t>)

         //Start the request.

* Manually cancel the queue request in the RxJava "thread pool". Note: setQueue (false) If set to false, manual cancellation will be disabled.

//Single cancellation of the corresponding request for 'Sign'.

//Cancel the request for bulk 'Sign' RxNoHttpUtils.cancel(Sign[]);

//Cancel all requests in the RxJava 'thread pool'. // RxNoHttpUtils.cancelAll();

* NoHttpRxUtils poll request, Using chain call.

//Get the request object.

         //NoHttp The network request settings are set as described above

         //Set the current polling request 'Sign'
         .setSign(new Object())

         //Create a polling request object, 
         //and then specify the response data conversion type and setup request success and failure callback interface
         .builderPoll(Objects.class,new OnIsRequestListener<t>)

         //Set the initialization load delay
         .setInitialDelay(3 * 1000)

         //Set the polling interval, default 3s.
         .setPeriod(5 * 1000)

         //Set the behavior event listener generated by the observer
         //Note: If the behavioral event listener is implemented here,
         //then the polling request is not maintained inside the framework,
         //and the polling interceptor interface must be implemented to maintain the polling stop.
         //RxNoHttpUtils.cancelPoll () cancel polling will be invalid, set the internal loading box will be invalid.
         .setOnObserverEventListener(new OnObserverEventListener<restrequest>, RxInformationModel<t>&gt;(){
              public RxInformationModel<t> onObserverEvent(RestRequest<t> transferValue) {

                // RxInformationModel<t>Object method introduction.
                //getData() -&gt; Get request data
                //setData(T data) -&gt; Assignment request data
                //setException(boolean exception) -&gt; Assignment is abnormal state
                //isException() -&gt; Get the exception status
                //setThrowable(Throwable throwable) -&gt; Assignment exception class
                //getThrowable() -&gt; Get exception class
                //setStop(boolean stop) -&gt; Assign whether to stop the polling state
                //isStop() -&gt; Get the polling status

                //In this method inside the RxInformationModel <t> object needs new out.

                   //In this method can be replaced by their own framework to the network request.                    //If you set the network request parameters above, //in addition to the body, you can get from the RestRequest object.

               return informationModel;

         // Set the data to intercept the listening object
         .setBooleanFunc1(new Func1<rxinformationmodel>, Boolean&gt;() {
               public Boolean call(RxInformationModel<t> stringRxInformationModel) {

              //In this method, you can get the requested data by RxInformationModel <t> .getData (),
              //and then decide whether to stop the polling according to the requested data.

                return stringRxInformationModel.isStop();

         //Set the observer to make the corresponding handler based on the observed behavior

            //Note: If this interface is implemented, the implementation of the OnIsRequestListener in the builderPoll will be invalid. .setRxInformationModelAction1(new Action1>() { @Override public void call(RxInformationModel stringRxInformationModel) {

            //In this method, the corresponding action is made according to the data in RxInformationModel <t>.


         //Convert to polling request class

         //Start the request

* Cancel the polling request manually.

//Single Cancel the poll request corresponding to 'Sign'

//Cancel the batch request corresponding to 'Sign' RxNoHttpUtils.cancelPoll(Sign[]);

//Cancel all polling requests RxNoHttpUtils.cancelPollAll();

* Manually clear the cache

//Clear the cache data corresponding to 'Key'

//Clear all cached data RxNoHttpUtils.removeAllCacheData();

If you feel good, please give me the star.

Thank you very much.

NoHttpRxUtils data request, please check my blog documentation.(Chinese blog)

NoHttpRxUtils Network communication framework

NoHttpRxUtils polling request, please check my blog documentation.(Chinese blog)

Extended poller interprets blog

Based on the RxJava-1 source extension of the poller GitHub open source project.


Because NoHttpRxUtils request in the RxJava "thread pool" is written by the queue algorithm, I would like to see the I see the RxJava "thread pool" project.



Copyright 2016 Liqi

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.