Package aQute.bnd.url

Class DefaultURLConnectionHandler

java.lang.Object
aQute.bnd.url.DefaultURLConnectionHandler
All Implemented Interfaces:
Plugin, RegistryPlugin, URLConnectionHandler, aQute.service.reporter.Report, aQute.service.reporter.Reporter
Direct Known Subclasses:
BasicAuthentication, BearerAuthentication, BndAuthentication, ConnectionSettings, HttpsVerification

public class DefaultURLConnectionHandler extends Object implements URLConnectionHandler, Plugin, RegistryPlugin, aQute.service.reporter.Reporter
Base class for the URL Connection handlers. This class implements some convenient methods like the matching. In general you should subclass and implement handle(URLConnection). Be aware to call the matches(URLConnection) method to verify the plugin is applicable.
  • Field Details

    • registry

      protected Registry registry
  • Constructor Details

    • DefaultURLConnectionHandler

      public DefaultURLConnectionHandler()
  • Method Details

    • handle

      public void handle(URLConnection connection) throws Exception
      Not doing anything is perfect ok
      Specified by:
      handle in interface URLConnectionHandler
      Parameters:
      connection - The connection to modify
      Throws:
      Exception
    • matches

      public boolean matches(URL url)
      Verify if the URL matches one of our globs. If there are no globs, we always return true.
      Specified by:
      matches in interface URLConnectionHandler
      Parameters:
      url - the url to match
      Returns:
      true if matched, false if not.
    • matches

      protected boolean matches(URLConnection connection)
      Convenience method to make it easier to verify connections
      Parameters:
      connection - The connection to match
      Returns:
      true if this connection should be handled.
    • setRegistry

      public void setRegistry(Registry registry)
      We are a @link RegistryPlugin for convenience to our subclasses.
      Specified by:
      setRegistry in interface RegistryPlugin
    • setProperties

      public void setProperties(Map<String,String> map) throws Exception
      Set the properties for this plugin. Subclasses should call this method before they handle their own properties.
      Specified by:
      setProperties in interface Plugin
      Parameters:
      map - attributes and directives for this plugin's clause
      Throws:
      Exception
    • setReporter

      public void setReporter(aQute.service.reporter.Reporter processor)
      Description copied from interface: Plugin
      Set the current reporter. This is called at init time. This plugin should report all errors and warnings to this reporter.
      Specified by:
      setReporter in interface Plugin
    • getWarnings

      public List<String> getWarnings()
      Specified by:
      getWarnings in interface aQute.service.reporter.Report
    • getErrors

      public List<String> getErrors()
      Specified by:
      getErrors in interface aQute.service.reporter.Report
    • getLocation

      public aQute.service.reporter.Report.Location getLocation(String msg)
      Specified by:
      getLocation in interface aQute.service.reporter.Report
    • isOk

      public boolean isOk()
      Specified by:
      isOk in interface aQute.service.reporter.Report
    • error

      public aQute.service.reporter.Reporter.SetLocation error(String format, Object... args)
      Specified by:
      error in interface aQute.service.reporter.Reporter
    • warning

      public aQute.service.reporter.Reporter.SetLocation warning(String format, Object... args)
      Specified by:
      warning in interface aQute.service.reporter.Reporter
    • trace

      @Deprecated public void trace(String format, Object... args)
      Deprecated.
      Use SLF4J Logger.debug instead.
      Specified by:
      trace in interface aQute.service.reporter.Reporter
    • progress

      @Deprecated public void progress(float progress, String format, Object... args)
      Deprecated.
      Use SLF4J Logger.info() instead.
      Specified by:
      progress in interface aQute.service.reporter.Reporter
    • exception

      public aQute.service.reporter.Reporter.SetLocation exception(Throwable t, String format, Object... args)
      Specified by:
      exception in interface aQute.service.reporter.Reporter
    • isPedantic

      public boolean isPedantic()
      Specified by:
      isPedantic in interface aQute.service.reporter.Reporter
    • addMatcher

      public DefaultURLConnectionHandler addMatcher(String glob)