本文整理匯總了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;
}