Search in sources :

Example 6 with IrregularUrlException

use of com.eros.framework.http.okhttp.exception.IrregularUrlException in project WeexErosFramework by bmfe.

the class AxiosManager method head.

public void head(String url, HashMap<String, String> params, 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<>();
    }
    if (params == null) {
        params = new HashMap<>();
    }
    setTimeout(timeout);
    OkHttpUtils.head().url(url).tag(tag).headers(header).params(params).build().execute(callback);
}
Also used : IrregularUrlException(com.eros.framework.http.okhttp.exception.IrregularUrlException)

Example 7 with IrregularUrlException

use of com.eros.framework.http.okhttp.exception.IrregularUrlException 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

IrregularUrlException (com.eros.framework.http.okhttp.exception.IrregularUrlException)7 OtherRequestBuilder (com.eros.framework.http.okhttp.builder.OtherRequestBuilder)3 GetBuilder (com.eros.framework.http.okhttp.builder.GetBuilder)1 CancelException (com.eros.framework.http.okhttp.exception.CancelException)1 HttpException (com.eros.framework.http.okhttp.exception.HttpException)1 AxiosResultBean (com.eros.framework.model.AxiosResultBean)1 HashMap (java.util.HashMap)1