public class HttpPlugin extends AbstractTcpPlugin
This class is designed to be used by the capabilities daemon to test for the existance of an HTTP server on remote interfaces. The class implements the Plugin interface that allows it to be used along with other plugins by the daemon. This plugin generates a HTTP GET request and checks the return code returned by the remote host to determine if it supports the protocol. The remote host's response will be deemed valid if the return code falls in the 100 to 599 range (inclusive). This is based on the following information from RFC 1945 (HTTP 1.0) HTTP 1.0 GET return codes: 1xx: Informational - Not used, future use 2xx: Success 3xx: Redirection 4xx: Client error 5xx: Server error
This plugin generates a HTTP GET request and checks the return code returned by the remote host to determine if it supports the protocol. The remote host's response will be deemed valid if the return code falls in the 100 to 599 range (inclusive). This is based on the following information from RFC 1945 (HTTP 1.0) HTTP 1.0 GET return codes: 1xx: Informational - Not used, future use 2xx: Success 3xx: Redirection 4xx: Client error 5xx: Server error This plugin generates a HTTP GET request and checks the return code returned by the remote host to determine if it supports the protocol. The remote host's response will be deemed valid if the return code falls in the 100 to 599 range (inclusive). This is based on the following information from RFC 1945 (HTTP 1.0) HTTP 1.0 GET return codes: 1xx: Informational - Not used, future use 2xx: Success 3xx: Redirection 4xx: Client error 5xx: Server errorModifier and Type | Field and Description |
---|---|
static boolean |
CHECK_RETURN_CODE
Boolean indicating whether to check for a return code
|
static String |
DEFAULT_URL
The query to send to the HTTP server
|
protected static String |
PROPERTY_NAME_MAX_RET_CODE
Constant
PROPERTY_NAME_MAX_RET_CODE="max-ret-code" |
protected static String |
PROPERTY_NAME_PORT
Constant
PROPERTY_NAME_PORT="port" |
protected static String |
PROPERTY_NAME_RESPONSE_TEXT
Constant
PROPERTY_NAME_RESPONSE_TEXT="response-text" |
protected static String |
PROPERTY_NAME_RETURN_CODE
Constant
PROPERTY_NAME_RETURN_CODE="check-return-code" |
protected static String |
PROPERTY_NAME_URL
Constant
PROPERTY_NAME_URL="url" |
static String |
PROTOCOL_NAME
Constant
PROTOCOL_NAME="HTTP" |
static String |
QUERY_STRING
The query to send to the HTTP server
|
static String |
RESPONSE_STRING
A string to look for in the response from the server
|
Modifier | Constructor and Description |
---|---|
|
HttpPlugin()
Constructor for HttpPlugin.
|
protected |
HttpPlugin(String protocolName,
boolean checkReturnCode,
String queryString,
String responseString)
Constructor for HttpPlugin.
|
protected |
HttpPlugin(String protocolName,
boolean checkReturnCode,
String queryString,
String responseString,
int[] defaultPorts)
Constructor for HttpPlugin.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkProtocol(Socket socket,
ConnectionConfig config)
checkProtocol
|
protected boolean |
checkResponseBody(ConnectionConfig config,
String response)
Checks the response body as a substring or regular expression match
according to the leading-tilde convention
|
protected List<ConnectionConfig> |
getConnectionConfigList(Map<String,Object> qualifiers,
InetAddress address)
getConnectionConfigList
|
checkConnection, closeSocket, createConnectionConfig, getKeyedInteger, getKeyedIntegerArray, getPluginName, getProtocolName, getSocketWrapper, isProtocolSupported, isProtocolSupported, populateConnectionConfig, preconnectCheck, saveConfig, saveKeyedInteger, setPluginName
protected static final String PROPERTY_NAME_PORT
PROPERTY_NAME_PORT="port"
protected static final String PROPERTY_NAME_MAX_RET_CODE
PROPERTY_NAME_MAX_RET_CODE="max-ret-code"
protected static final String PROPERTY_NAME_RETURN_CODE
PROPERTY_NAME_RETURN_CODE="check-return-code"
protected static final String PROPERTY_NAME_URL
PROPERTY_NAME_URL="url"
protected static final String PROPERTY_NAME_RESPONSE_TEXT
PROPERTY_NAME_RESPONSE_TEXT="response-text"
public static final boolean CHECK_RETURN_CODE
public static final String PROTOCOL_NAME
PROTOCOL_NAME="HTTP"
public static final String QUERY_STRING
public static final String DEFAULT_URL
public static final String RESPONSE_STRING
public HttpPlugin()
Constructor for HttpPlugin.
protected HttpPlugin(String protocolName, boolean checkReturnCode, String queryString, String responseString)
Constructor for HttpPlugin.
protected boolean checkProtocol(Socket socket, ConnectionConfig config) throws IOException
checkProtocol
checkProtocol
in class AbstractTcpPlugin
socket
- a Socket
object.config
- a ConnectionConfig
object.IOException
protected List<ConnectionConfig> getConnectionConfigList(Map<String,Object> qualifiers, InetAddress address)
getConnectionConfigList
getConnectionConfigList
in class AbstractTcpPlugin
qualifiers
- a Map
object.address
- a InetAddress
object.List
object.protected boolean checkResponseBody(ConnectionConfig config, String response)
config
- ConnectionConfig object from which response-text property is extractedresponse
- Body of HTTP response to checkCopyright © 2015. All rights reserved.