|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface HttpExecuteInterceptor
HTTP request execute interceptor to intercept the start of HttpRequest.execute() before
executing the HTTP request.
For example, this might be used to sign a request for OAuth:
public class OAuthSigner implements HttpExecuteInterceptor {
public void intercept(HttpRequest request) throws IOException {
// sign request...
}
}
Sample usage with a request factory:
public static HttpRequestFactory createRequestFactory(HttpTransport transport) {
final OAuthSigner signer = new OAuthSigner(...);
return transport.createRequestFactory(new HttpRequestInitializer() {
public void initialize(HttpRequest request) {
request.interceptor = signer;
}
});
}
If you have a custom request execute interceptor, use this more complex example:
public static HttpRequestFactory createRequestFactory(HttpTransport transport) {
final OAuthSigner signer = new OAuthSigner(...);
return transport.createRequestFactory(new HttpRequestInitializer() {
public void initialize(HttpRequest request) {
request.interceptor = new HttpExecuteInterceptor() {
public void intercept(HttpRequest request) throws IOException {
signer.intercept(request);
}
};
}
});
}
Implementations should normally be thread-safe.
| Method Summary | |
|---|---|
void |
intercept(HttpRequest request)
Invoked at the start of HttpRequest.execute() before executing the HTTP request. |
| Method Detail |
|---|
void intercept(HttpRequest request)
throws IOException
HttpRequest.execute() before executing the HTTP request.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||