Package aQute.bnd.url
Class DefaultURLConnectionHandler
java.lang.Object
aQute.bnd.url.DefaultURLConnectionHandler
- All Implemented Interfaces:
Plugin
,RegistryPlugin
,URLConnectionHandler
,Report
,Reporter
- Direct Known Subclasses:
BasicAuthentication
,BearerAuthentication
,BndAuthentication
,ConnectionSettings
,HttpsVerification
public class DefaultURLConnectionHandler
extends Object
implements URLConnectionHandler, Plugin, RegistryPlugin, 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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interface
Nested classes/interfaces inherited from interface aQute.service.reporter.Report
Report.Location
Nested classes/interfaces inherited from interface aQute.service.reporter.Reporter
Reporter.SetLocation
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
protected Registry
private Reporter
Fields inherited from interface aQute.bnd.service.url.URLConnectionHandler
MATCH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddMatcher
(String glob) Create an error.Dedicated message for an exception.Return the errors.getLocation
(String msg) Return the errors for the given error or warning.Return the warnings.void
handle
(URLConnection connection) Not doing anything is perfect okboolean
isOk()
Check if this report has any relevant errors that should make the run associated with this report invalid.boolean
The provider of the reporter wants pedantic reporting, meaning every possible warning should be reported.boolean
Verify if the URL matches one of our globs.protected boolean
matches
(URLConnection connection) Convenience method to make it easier to verify connectionsvoid
Deprecated.Use SLF4J Logger.info() instead.void
setProperties
(Map<String, String> map) Set the properties for this plugin.void
setRegistry
(Registry registry) We are a @linkRegistryPlugin
for convenience to our subclasses.void
setReporter
(Reporter processor) Set the current reporter.void
Deprecated.Use SLF4J Logger.debug instead.Create a warning.
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
matchers
-
reporter
-
registry
-
-
Constructor Details
-
DefaultURLConnectionHandler
public DefaultURLConnectionHandler()
-
-
Method Details
-
handle
Not doing anything is perfect ok- Specified by:
handle
in interfaceURLConnectionHandler
- Parameters:
connection
- The connection to modify- Throws:
Exception
-
matches
Verify if the URL matches one of our globs. If there are no globs, we always return true.- Specified by:
matches
in interfaceURLConnectionHandler
- Parameters:
url
- the url to match- Returns:
- true if matched, false if not.
-
matches
Convenience method to make it easier to verify connections- Parameters:
connection
- The connection to match- Returns:
- true if this connection should be handled.
-
setRegistry
We are a @linkRegistryPlugin
for convenience to our subclasses.- Specified by:
setRegistry
in interfaceRegistryPlugin
-
setProperties
Set the properties for this plugin. Subclasses should call this method before they handle their own properties.- Specified by:
setProperties
in interfacePlugin
- Parameters:
map
- attributes and directives for this plugin's clause- Throws:
Exception
-
setReporter
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 interfacePlugin
-
getWarnings
Description copied from interface:Report
Return the warnings. This list must not be changed and may be immutable.- Specified by:
getWarnings
in interfaceReport
- Returns:
- the warnings
-
getErrors
Description copied from interface:Report
Return the errors. This list must not be changed and may be immutable. -
getLocation
Description copied from interface:Report
Return the errors for the given error or warning. Can return null.- Specified by:
getLocation
in interfaceReport
- Parameters:
msg
- The message- Returns:
- null or the location of the message
-
isOk
public boolean isOk()Description copied from interface:Report
Check if this report has any relevant errors that should make the run associated with this report invalid. I.e. if this returns false then the run should be disregarded. -
error
Description copied from interface:Reporter
Create an error. Implementations must ensure that the given args are not prevented from garbage collecting. The args must have a proper toString method. -
warning
Description copied from interface:Reporter
Create a warning. Implementations must ensure that the given args are not prevented from garbage collecting. The args must have a proper toString method. -
trace
Deprecated.Use SLF4J Logger.debug instead.Description copied from interface:Reporter
Create a warning. Implementations must ensure that the given args are not prevented from garbage collecting. The args must have a proper toString method. -
progress
Deprecated.Use SLF4J Logger.info() instead.Description copied from interface:Reporter
Create a warning. Implementations must ensure that the given args are not prevented from garbage collecting. The args must have a proper toString method. -
exception
Description copied from interface:Reporter
Dedicated message for an exception. -
isPedantic
public boolean isPedantic()Description copied from interface:Reporter
The provider of the reporter wants pedantic reporting, meaning every possible warning should be reported.- Specified by:
isPedantic
in interfaceReporter
- Returns:
- if this is a pedantic reporter.
-
addMatcher
-