本文整理汇总了Java中com.ning.http.client.filter.IOExceptionFilter类的典型用法代码示例。如果您正苦于以下问题:Java IOExceptionFilter类的具体用法?Java IOExceptionFilter怎么用?Java IOExceptionFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IOExceptionFilter类属于com.ning.http.client.filter包,在下文中一共展示了IOExceptionFilter类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAddGetAndRemoveNingIOExceptionFilter
import com.ning.http.client.filter.IOExceptionFilter; //导入依赖的package包/类
@Test
public void testAddGetAndRemoveNingIOExceptionFilter() throws Exception {
client = new ParsecAsyncHttpClient.Builder().build();
// Test default value
List<IOExceptionFilter> ioExceptionFilters = client.getIOExceptionFilters();
assertEquals(0, ioExceptionFilters.size());
// Test add
client = new ParsecAsyncHttpClient.Builder()
.addIOExceptionFilter(new MockIOExceptionFilter())
.build();
ioExceptionFilters = client.getIOExceptionFilters();
assertEquals(1, ioExceptionFilters.size());
assertTrue(ioExceptionFilters.get(0) instanceof MockIOExceptionFilter);
// Test remove
ParsecAsyncHttpClient.Builder builder = new ParsecAsyncHttpClient.Builder()
.addIOExceptionFilter(new MockIOExceptionFilter());
ioExceptionFilters = builder.build().getIOExceptionFilters();
assertEquals(1, ioExceptionFilters.size());
ioExceptionFilters = builder
.removeIOExceptionFilter(ioExceptionFilters.get(0)).build().getIOExceptionFilters();
assertEquals(0, ioExceptionFilters.size());
}
示例2: handleIoException
import com.ning.http.client.filter.IOExceptionFilter; //导入依赖的package包/类
private FilterContext handleIoException(FilterContext fc) throws FilterException {
for (IOExceptionFilter asyncFilter : config.getIOExceptionFilters()) {
fc = asyncFilter.filter(fc);
if (fc == null) {
throw new NullPointerException("FilterContext is null");
}
}
return fc;
}
示例3: getIOExceptionFilters
import com.ning.http.client.filter.IOExceptionFilter; //导入依赖的package包/类
@Override
public List<IOExceptionFilter> getIOExceptionFilters() {
return config.getIOExceptionFilters();
}
示例4: getIOExceptionFilters
import com.ning.http.client.filter.IOExceptionFilter; //导入依赖的package包/类
/**
* Get IO exception filters.
*
* @return {@link IOExceptionFilter} {@link List}
*/
public List<IOExceptionFilter> getIOExceptionFilters() {
return ningClientConfig.getIOExceptionFilters();
}
示例5: addIOExceptionFilter
import com.ning.http.client.filter.IOExceptionFilter; //导入依赖的package包/类
/**
* Add IO exception filter.
*
* @param ioExceptionFilter {@link IOExceptionFilter}
* @return {@link ParsecAsyncHttpClient.Builder}
*/
public Builder addIOExceptionFilter(IOExceptionFilter ioExceptionFilter) {
configBuilder.addIOExceptionFilter(ioExceptionFilter);
return this;
}
示例6: removeIOExceptionFilter
import com.ning.http.client.filter.IOExceptionFilter; //导入依赖的package包/类
/**
* Remove IO exception filter.
*
* @param ioExceptionFilter {@link IOExceptionFilter}
* @return {@link ParsecAsyncHttpClient.Builder}
*/
public Builder removeIOExceptionFilter(IOExceptionFilter ioExceptionFilter) {
configBuilder.removeIOExceptionFilter(ioExceptionFilter);
return this;
}