Interface URLConnectionProcessor

All Known Implementing Classes:
AbstractURLConnectionProcessor, AWS4AuthenticationURLConnectionProcessor, CookieStoreURLConnectionProcessor, OAuth2AuthenticationURLConnectionProcessor, PasswordAuthenticationURLConnectionProcessor, SSLURLConnectionProcessor

public interface URLConnectionProcessor
A URLConnectionProcessor can be applied to any URL2Connection to modify it either before or after connection is made. Any modifications can be made, such as
  • Method Summary

    Modifier and Type
    Method
    Description
    If this processer matches, this method is called after the supplied URL connection is made.
    void
    If this processer matches, this method is called before the supplied URL connection is made.
    boolean
    Return true if this URLConnectionProcessor should be called for the specified connection
  • Method Details

    • matches

      boolean matches(URL2Connection con)
      Return true if this URLConnectionProcessor should be called for the specified connection
      Parameters:
      con - the connection
    • before

      void before(URL2Connection con) throws IOException
      If this processer matches, this method is called before the supplied URL connection is made. It can alter any request headers.
      Parameters:
      con - the connection
      Throws:
      IOException
    • after

      If this processer matches, this method is called after the supplied URL connection is made. It can act on the response headers, modify them for the next processor, and if it returns non-null, the request headers and URI of the returned value will be used for another request. For example to implement a redirect on a return code of 301
      
        if (con.getCode() == 301) {
            con.setURI(parse(con.getResponseHeader("location")));
            return con;
        } else {
            return null;
        }
       
      Parameters:
      con - the connection
      Returns:
      the next connection to make, or null to accept this response
      Throws:
      IOException