Search in sources :

Example 1 with OtherRequestBuilder

use of com.benmu.framework.http.okhttp.builder.OtherRequestBuilder in project WeexErosFramework by bmfe.

the class AxiosManager method patch.

public void patch(String url, String content, HashMap<String, String> header, StringCallback callback, Object tag, long timeout) {
    url = safeUrl(url);
    if (url == null) {
        if (callback != null) {
            callback.onError(null, new IrregularUrlException("url不合法"), 0);
        }
        return;
    }
    if (header == null) {
        header = new HashMap<>();
    }
    setTimeout(timeout);
    OtherRequestBuilder builder = OkHttpUtils.patch().url(url).tag(tag).headers(header);
    if (content != null) {
        builder.requestBody(createRequestBodyByMediaType(header, content));
    }
    builder.build().execute(callback);
}
Also used : OtherRequestBuilder(com.benmu.framework.http.okhttp.builder.OtherRequestBuilder) IrregularUrlException(com.benmu.framework.http.okhttp.exception.IrregularUrlException)

Example 2 with OtherRequestBuilder

use of com.benmu.framework.http.okhttp.builder.OtherRequestBuilder in project WeexErosFramework by bmfe.

the class AxiosManager method delete.

public void delete(String url, String content, HashMap<String, String> header, StringCallback callBack, Object tag, long timeout) {
    url = safeUrl(url);
    if (url == null) {
        if (callBack != null) {
            callBack.onError(null, new IrregularUrlException("url不合法"), 0);
        }
        return;
    }
    if (header == null) {
        header = new HashMap<>();
    }
    setTimeout(timeout);
    OtherRequestBuilder builder = OkHttpUtils.delete().url(url).tag(tag).headers(header);
    if (content != null) {
        builder.requestBody(createRequestBodyByMediaType(header, content));
    }
    builder.build().execute(callBack);
}
Also used : OtherRequestBuilder(com.benmu.framework.http.okhttp.builder.OtherRequestBuilder) IrregularUrlException(com.benmu.framework.http.okhttp.exception.IrregularUrlException)

Example 3 with OtherRequestBuilder

use of com.benmu.framework.http.okhttp.builder.OtherRequestBuilder in project WeexErosFramework by bmfe.

the class AxiosManager method put.

public void put(String url, String content, HashMap<String, String> header, StringCallback callBack, Object tag, long timeout) {
    url = safeUrl(url);
    if (url == null) {
        if (callBack != null) {
            callBack.onError(null, new IrregularUrlException("url不合法"), 0);
        }
        return;
    }
    if (header == null) {
        header = new HashMap<>();
    }
    setTimeout(timeout);
    OtherRequestBuilder builder = OkHttpUtils.put().url(url).tag(tag).headers(header);
    if (content != null) {
        builder.requestBody(createRequestBodyByMediaType(header, content));
    }
    builder.build().execute(callBack);
}
Also used : OtherRequestBuilder(com.benmu.framework.http.okhttp.builder.OtherRequestBuilder) IrregularUrlException(com.benmu.framework.http.okhttp.exception.IrregularUrlException)

Aggregations

OtherRequestBuilder (com.benmu.framework.http.okhttp.builder.OtherRequestBuilder)3 IrregularUrlException (com.benmu.framework.http.okhttp.exception.IrregularUrlException)3