|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.foray.common.url.ProtocolRegistrationBroker
public final class ProtocolRegistrationBroker
Manages which ProtocolRegistrationStrategy
is used to register new
custom URL protocol handlers.
Only one strategy can be used within a session.
Java provides two methods for registering these protocol handlers, one found
in URLStreamHandlerFactory
(the Factory scheme), and the other
using the "java.protocol.handler.pkgs" Java property (the Property scheme).
Each of these schemes has drawbacks.
This class can register the following implementations using its
setStandardRegistrationStrategy(int)
method:
In addition to the standard strategies described above, custom strategies
can be registered using
setRegistrationStrategy(ProtocolRegistrationStrategy)
.
This may be useful in cases where a URLStreamHandlerFactory
has been
registered by some third-party and the developer wishes to use it to get
URL handlers registered.
AbstractProtocolRegistration
is an abstract implementation of
ProtocolRegistrationStrategy
which may be a useful starting place for
custom implementations.
Field Summary | |
---|---|
static byte |
FACTORY_REGISTRATION_STRATEGY
Constant indicating that the "factory" method should be used for URL handler registration. |
static byte |
PROPERTY_REGISTRATION_STRATEGY
Constant indicating that the "property" method should be used for URL handler registration. |
static byte |
UNIVERSAL_REGISTRATION_STRATEGY
Constant indicating that any URL handler registration strategy is acceptable. |
Method Summary | |
---|---|
static ProtocolRegistrationStrategy |
getRegistrationStrategy()
Provides access to the chosen protocol registration strategy, or to a default one if none has been set. |
static URLStreamHandler |
getURLStreamHandler(String protocol)
Convenience method making registered protocol handler available in a static way. |
static void |
setRegistrationStrategy(ProtocolRegistrationStrategy strategy)
Sets the strategy which will be used within the application for registering custom URL protocol handlers. |
static void |
setStandardRegistrationStrategy(int strategy)
Factory method that knows how to create any of the standard URL Protocol Registration strategies. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte UNIVERSAL_REGISTRATION_STRATEGY
public static final byte PROPERTY_REGISTRATION_STRATEGY
public static final byte FACTORY_REGISTRATION_STRATEGY
Method Detail |
---|
public static void setStandardRegistrationStrategy(int strategy)
strategy
- One of UNIVERSAL_REGISTRATION_STRATEGY
,
PROPERTY_REGISTRATION_STRATEGY
, or
FACTORY_REGISTRATION_STRATEGY
.public static void setRegistrationStrategy(ProtocolRegistrationStrategy strategy)
UniversalProtocolRegistration
, and it
will be selected automatically unless this method is used to set a
different strategy before the first call to the
getRegistrationStrategy()
method.
strategy
- the registry used to record custom URL protocol handlerspublic static ProtocolRegistrationStrategy getRegistrationStrategy()
ProtocolRegistrationStrategy
to be used for custom
URL handler registration for this session.public static URLStreamHandler getURLStreamHandler(String protocol)
protocol
- The protocol for which a Handler is sought.
protocol
, or null if it has not
been registered.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |