Interface HttpExecuteInterceptor

All Known Implementing Classes:
BasicAuthentication

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.setInterceptor(signer);
 }
 });
 }
 

More complex usage example:

 public static HttpRequestFactory createRequestFactory2(HttpTransport transport) {
 final OAuthSigner signer = new OAuthSigner(...);
 return transport.createRequestFactory(new HttpRequestInitializer() {
 public void initialize(HttpRequest request) {
 request.setInterceptor(new HttpExecuteInterceptor() {
 public void intercept(HttpRequest request) throws IOException {
 signer.intercept(request);
 }
 });
 }
 });
 }
 

Implementations should normally be thread-safe.

Since:
1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Invoked at the start of HttpRequest.execute() before executing the HTTP request.