Class AbstractURLConnectionProcessor

java.lang.Object
org.faceless.publisher.type.AbstractURLConnectionProcessor
All Implemented Interfaces:
URLConnectionProcessor
Direct Known Subclasses:
AWS4AuthenticationURLConnectionProcessor, CookieStoreURLConnectionProcessor, OAuth2AuthenticationURLConnectionProcessor, PasswordAuthenticationURLConnectionProcessor, SSLURLConnectionProcessor

public class AbstractURLConnectionProcessor extends Object implements URLConnectionProcessor
A base implementation of URLConnectionProcessor that does nothing, but is suitable for extending. It has a pattern matching implementation based on a list of Pattern objects.
  • Constructor Details

    • AbstractURLConnectionProcessor

      public AbstractURLConnectionProcessor()
  • Method Details

    • getMatches

      public List<Pattern> getMatches()
      Return the modifiable list of Pattern objects that will be matched against the URL to see if this processor should be applied. An empty list (the default) matches all URLs.
      Returns:
      the list of Pattern objects which can be modified.
    • matches

      public boolean matches(URL2Connection con)
      Description copied from interface: URLConnectionProcessor
      Return true if this URLConnectionProcessor should be called for the specified connection
      Specified by:
      matches in interface URLConnectionProcessor
      Parameters:
      con - the connection
    • before

      public void before(URL2Connection con) throws IOException
      Description copied from interface: URLConnectionProcessor
      If this processer matches, this method is called before the supplied URL connection is made. It can alter any request headers.
      Specified by:
      before in interface URLConnectionProcessor
      Parameters:
      con - the connection
      Throws:
      IOException
    • after

      public URL2Connection after(URL2Connection con) throws IOException
      Description copied from interface: URLConnectionProcessor
      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;
        }
       
      Specified by:
      after in interface URLConnectionProcessor
      Parameters:
      con - the connection
      Returns:
      the next connection to make, or null to accept this response
      Throws:
      IOException