mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-02-28 13:49:13 +00:00
parent
b5b39efd72
commit
4bd79fb3dd
@ -176,7 +176,7 @@ private ResponseInterceptorEntry(final ResponseInterceptorEntry.Postion postion,
|
||||
|
||||
private static class ExecInterceptorEntry {
|
||||
|
||||
enum Postion { BEFORE, AFTER, REPLACE }
|
||||
enum Postion { BEFORE, AFTER, REPLACE, FIRST, LAST }
|
||||
|
||||
final ExecInterceptorEntry.Postion postion;
|
||||
final String name;
|
||||
@ -430,6 +430,26 @@ public final HttpAsyncClientBuilder replaceExecInterceptor(final String existing
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an interceptor to the head of the processing list.
|
||||
*/
|
||||
public final HttpAsyncClientBuilder addExecInterceptorFirst(final String name, final AsyncExecChainHandler interceptor) {
|
||||
Args.notNull(name, "Name");
|
||||
Args.notNull(interceptor, "Interceptor");
|
||||
execInterceptors.add(new ExecInterceptorEntry(ExecInterceptorEntry.Postion.FIRST, name, interceptor, null));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an interceptor to the tail of the processing list.
|
||||
*/
|
||||
public final HttpAsyncClientBuilder addExecInterceptorLast(final String name, final AsyncExecChainHandler interceptor) {
|
||||
Args.notNull(name, "Name");
|
||||
Args.notNull(interceptor, "Interceptor");
|
||||
execInterceptors.add(new ExecInterceptorEntry(ExecInterceptorEntry.Postion.LAST, name, interceptor, null));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds this protocol interceptor to the head of the protocol processing list.
|
||||
*/
|
||||
@ -913,6 +933,12 @@ public void execute(final IOSession ioSession) {
|
||||
case BEFORE:
|
||||
execChainDefinition.addBefore(entry.existing, entry.interceptor, entry.name);
|
||||
break;
|
||||
case FIRST:
|
||||
execChainDefinition.addFirst(entry.interceptor, entry.name);
|
||||
break;
|
||||
case LAST:
|
||||
execChainDefinition.addLast(entry.interceptor, entry.name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ private ResponseInterceptorEntry(final Postion postion, final HttpResponseInterc
|
||||
|
||||
private static class ExecInterceptorEntry {
|
||||
|
||||
enum Postion { BEFORE, AFTER, REPLACE }
|
||||
enum Postion { BEFORE, AFTER, REPLACE, FIRST, LAST }
|
||||
|
||||
final Postion postion;
|
||||
final String name;
|
||||
@ -443,6 +443,26 @@ public final HttpClientBuilder replaceExecInterceptor(final String existing, fin
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an interceptor to the head of the processing list.
|
||||
*/
|
||||
public final HttpClientBuilder addExecInterceptorFirst(final String name, final ExecChainHandler interceptor) {
|
||||
Args.notNull(name, "Name");
|
||||
Args.notNull(interceptor, "Interceptor");
|
||||
execInterceptors.add(new ExecInterceptorEntry(ExecInterceptorEntry.Postion.FIRST, name, interceptor, null));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an interceptor to the tail of the processing list.
|
||||
*/
|
||||
public final HttpClientBuilder addExecInterceptorLast(final String name, final ExecChainHandler interceptor) {
|
||||
Args.notNull(name, "Name");
|
||||
Args.notNull(interceptor, "Interceptor");
|
||||
execInterceptors.add(new ExecInterceptorEntry(ExecInterceptorEntry.Postion.LAST, name, interceptor, null));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables state (cookie) management.
|
||||
*/
|
||||
@ -902,6 +922,12 @@ public boolean keepAlive(
|
||||
case REPLACE:
|
||||
execChainDefinition.replace(entry.existing, entry.interceptor);
|
||||
break;
|
||||
case FIRST:
|
||||
execChainDefinition.addFirst(entry.interceptor, entry.name);
|
||||
break;
|
||||
case LAST:
|
||||
execChainDefinition.addLast(entry.interceptor, entry.name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user