Package org.apache.nutch.protocol
Class ProtocolFactory
java.lang.Object
org.apache.nutch.protocol.ProtocolFactory
Creates and caches
Protocol plugins. Protocol plugins should define
the attribute "protocolName" with the name of the protocol that they
implement. Configuration object is used for caching. Cache key is constructed
from appending protocol name (eg. http) to constant
Protocol.X_POINT_ID.-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetProtocol(String urlString) Returns the appropriateProtocolimplementation for a url.getProtocol(URL url) Returns the appropriateProtocolimplementation for a url.
-
Field Details
-
defaultProtocolImplMapping
-
hostProtocolMapping
-
-
Constructor Details
-
ProtocolFactory
-
-
Method Details
-
getProtocol
Returns the appropriateProtocolimplementation for a url.- Parameters:
urlString- Url String- Returns:
- The appropriate
Protocolimplementation for a givenURL. - Throws:
ProtocolNotFound- when Protocol can not be found for urlString or urlString is not a valid URL
-
getProtocol
Returns the appropriateProtocolimplementation for a url.- Parameters:
url- URL to be fetched by returnedProtocolimplementation- Returns:
- The appropriate
Protocolimplementation for a givenURL. - Throws:
ProtocolNotFound- when Protocol can not be found for url
-
getProtocolById
- Parameters:
id- protocol plugin ID, e.g.,org.apache.nutch.protocol.http- Returns:
- protocol instance for the given ID
- Throws:
PluginRuntimeException- if plugin not found or failed to instantiate
-