Search in sources :

Example 1 with OtherRequestBuilder

use of com.eros.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, Callback 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.eros.framework.http.okhttp.builder.OtherRequestBuilder) IrregularUrlException(com.eros.framework.http.okhttp.exception.IrregularUrlException)

Example 2 with OtherRequestBuilder

use of com.eros.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, Callback 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.eros.framework.http.okhttp.builder.OtherRequestBuilder) IrregularUrlException(com.eros.framework.http.okhttp.exception.IrregularUrlException)

Example 3 with OtherRequestBuilder

use of com.eros.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, Callback 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.eros.framework.http.okhttp.builder.OtherRequestBuilder) IrregularUrlException(com.eros.framework.http.okhttp.exception.IrregularUrlException)

Aggregations

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