com.foxsmart.ic.net
Interface HttpProtocolHandler

All Superinterfaces:
ProtocolHandler
All Known Implementing Classes:
DefaultHttpProtocolHandler

public interface HttpProtocolHandler
extends ProtocolHandler

The HttpProtocolHandler handles the communications for the HTTP protocol.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.foxsmart.ic.net.ProtocolHandler
ProtocolHandler.Protocol
 
Field Summary
 
Fields inherited from interface com.foxsmart.ic.net.ProtocolHandler
CR, DEFAULT_PROTOCOL_TIMEOUT_SECONDS
 
Method Summary
 void connect(java.lang.String hostname, java.lang.Integer port, java.lang.String username, java.lang.String password, java.lang.Integer timeout)
          Connects to the hostname at the specified port number and authenticates with the remote device.
 void disconnect()
          Disconnects the socket connection.
 java.lang.Integer getDefaultProtocolTimeout()
          Gets the default operation timeout value.
 boolean getPasswordUsed()
          Gets whether the password was used for authentication.
 boolean getUsernameUsed()
          Gets whether the username was used for authentication.
 boolean isConnected()
          Returns true if the client is currently connected to a server.
 java.lang.String sendCommandWithResults(java.lang.String command)
          Sends a command to the router and returns the results of the command being executed.
 java.lang.String sendConfigCommandWithResults(java.lang.String command, boolean parent)
          Sends a configuration command to the router and returns the results of the command being executed.
 void setDefaultProtocolTimeout(java.lang.Integer timeout)
          Modifies the default operation protocol timeout value.
 void setPasswordUsed(boolean passwordUsed)
          Sets whether the password was used for authentication.
 void setUsernameUsed(boolean usernameUsed)
          Sets whether the username was used for authentication.
 
Methods inherited from interface com.foxsmart.ic.net.ProtocolHandler
getAvailable, getProtocol
 

Method Detail

connect

void connect(java.lang.String hostname,
             java.lang.Integer port,
             java.lang.String username,
             java.lang.String password,
             java.lang.Integer timeout)
             throws java.lang.Exception
Connects to the hostname at the specified port number and authenticates with the remote device. A socket connection will be established when this call is complete.

Parameters:
hostname - The name of the remote host.
port - The port to connect to on the remote host. If null is passed in, a default port will be used.
username - The username to connect with. Null should be passed in if no username is required.
password - The password to connect with. Null should be passed in if no password is required.
timeout - The timeout in seconds. If null is passed in, a default timeout will be used.
Throws:
AuthenticationFailedException - when a successful connection could not be made
java.io.IOException - if the URL stream could not be opened to the URL
java.net.UnknownServiceException - if the URL protocol does not support input
ThreadTimeoutException - if a timeout occurred while connecting to the router.
java.net.UnknownHostException - If the hostname cannot be resolved.
java.lang.Exception - if any other problems were encountered.

isConnected

boolean isConnected()
Returns true if the client is currently connected to a server.

Returns:
True if the client is currently connected to a server, false otherwise.

disconnect

void disconnect()
                throws java.io.IOException
Disconnects the socket connection.

Throws:
java.io.IOException - If there is an error closing the socket.

setUsernameUsed

void setUsernameUsed(boolean usernameUsed)
Sets whether the username was used for authentication.

Parameters:
usernameUsed - True if the username was used or false if not.

getUsernameUsed

boolean getUsernameUsed()
Gets whether the username was used for authentication.

Returns:
True if the username was used or false if not.

setPasswordUsed

void setPasswordUsed(boolean passwordUsed)
Sets whether the password was used for authentication.

Parameters:
passwordUsed - True if the password was used or false if not.

getPasswordUsed

boolean getPasswordUsed()
Gets whether the password was used for authentication.

Returns:
True if the password was used or false if not.

sendCommandWithResults

java.lang.String sendCommandWithResults(java.lang.String command)
                                        throws java.lang.Exception
Sends a command to the router and returns the results of the command being executed.

Parameters:
command - The command to send to the device.
Returns:
the results of the command.
Throws:
java.io.IOException - if there was a problem sending the command.
java.lang.Exception - if any other problems were encountered.

sendConfigCommandWithResults

java.lang.String sendConfigCommandWithResults(java.lang.String command,
                                              boolean parent)
                                              throws java.lang.Exception
Sends a configuration command to the router and returns the results of the command being executed.

Parameters:
command - The command to send to the device.
parent - True if the configuration command is a parent element or false if not.
Returns:
the results of the command.
Throws:
java.lang.Exception - if any problems were encountered.

setDefaultProtocolTimeout

void setDefaultProtocolTimeout(java.lang.Integer timeout)
Modifies the default operation protocol timeout value.

Specified by:
setDefaultProtocolTimeout in interface ProtocolHandler
Parameters:
timeout - The default timeout value in seconds to wait for the data to be returned. If null is passed, no timeout will be used. Beware that if an expected match string is not found or if the device doesn't respond, the expect method will not return.

getDefaultProtocolTimeout

java.lang.Integer getDefaultProtocolTimeout()
Gets the default operation timeout value.

Specified by:
getDefaultProtocolTimeout in interface ProtocolHandler
Returns:
the timeout in seconds.


Copyright © 2005-2008 Fox Smart, Inc. All Rights Reserved.