All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.feilong.net.http.callback.ResultCallback Maven / Gradle / Ivy

Go to download

feilong is a suite of core and expanded libraries that include utility classes, http, excel,cvs, io classes, and much much more.

There is a newer version: 4.0.8
Show newest version
/*
 * Copyright (C) 2008 feilong
 *
 * 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
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * 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.
 */
package com.feilong.net.http.callback;

import java.util.Date;

import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpUriRequest;

import com.feilong.net.http.ConnectionConfig;
import com.feilong.net.http.HttpRequest;

/**
 * A callback interface,用来执行httpclient之后,渲染拿到的结果.
 * 
 * 

* 是feilong httpclient 底层接口,目前有的实现有: *

* *
    *
  1. {@link HttpResponseResultCallback}:用来构造全的返回数据,包含字符串,状态码,时间等等
  2. *
  3. {@link ResponseBodyAsStringResultCallback}:用来获得接口的返回字符串(常用)
  4. *
  5. {@link StatusCodeResultCallback}:用来只需要获得状态码
  6. *
*

* 设计思想,类似于 org.springframework.data.redis.core.RedisCallback *

* * @param * the generic type * @see com.feilong.net.http.builder.HttpRequestExecuter#execute(HttpRequest, ConnectionConfig, ResultCallback) * @see HttpResponseResultCallback * @see ResponseBodyAsStringResultCallback * @see StatusCodeResultCallback */ public interface ResultCallback { /** * On. * *

* 注意:每个参数都不会为null *

* * @param httpRequest * the http request * @param httpUriRequest * the http uri request * @param httpResponse * the http response * @param useConnectionConfig * the use connection config * @param beginDate * http调用开始时间 * @return the t */ T on( HttpRequest httpRequest, HttpUriRequest httpUriRequest, HttpResponse httpResponse, ConnectionConfig useConnectionConfig, Date beginDate); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy