com.cometway.httpd
Class SecureWebServer

java.lang.Object
  extended by com.cometway.props.Props
      extended by com.cometway.ak.Agent
          extended by com.cometway.httpd.WebServer
              extended by com.cometway.httpd.SecureWebServer
All Implemented Interfaces:
AgentInterface, HasStateMachineModel, java.lang.Runnable

public class SecureWebServer
extends WebServer

Routes HTTPS Requests from a server socket


Field Summary
static java.lang.String VERSION_STR
           
 
Fields inherited from class com.cometway.httpd.WebServer
ACCEPT_NOT_ALLOWED, BAD_GATEWAY, BAD_REQUEST, CANNOT_SATISFY_REQUEST_RANGE, counter, dateFormat_ANSI, dateFormat_RFC822, dateFormat_RFC850, EXPECTATION_FAILED, extensions, FORBIDDEN, GATEWAY_TIMEOUT, GONE, LENGTH_REQUIRED, logger, METHOD_NOT_ALLOWED, mimeTypes, MOVED, MOVED_PERMANENTLY, multihome, NO_CONTENT, NOT_IMPLEMENTED, NOT_MODIFIED, numConnections, PRECONDITION_FAILED, PROXY_AUTHENTICATION_REQUIRED, REQUEST_CONFLICT, REQUEST_ENTITY_TOO_LARGE, REQUEST_TIMED_OUT, REQUEST_URI_TOO_LONG, RESET_CONTENT, responseAgent, runThread, SERVER_ERROR, SERVICE_UNAVAILABLE, TEMPORARY_REDIRECT, threadPool, UNAUTHORIZED, undefinedDomains, UNSUPPORTED_MEDIA_TYPE, URL_NOT_FOUND, USE_GET, USE_PROXY, VERSION_NOT_SUPPORTED
 
Fields inherited from class com.cometway.ak.Agent
agent_id, agentController, CREATING_STATE, debugReporter, DESTROYED_STATE, DESTROYING_STATE, errorReporter, FAILED_STATE, printlnReporter, props, RUNNING_STATE, STARTING_STATE, STOPPED_STATE, STOPPING_STATE, warningReporter
 
Constructor Summary
SecureWebServer()
           
 
Method Summary
protected  java.net.ServerSocket getServerSocket(java.lang.String bind_address, int port)
          This method uses the server key and certificate to create an SSLServerSocket.
 void initProps()
          Initializes this agent's properties by providing default values for each of the following missing properties: 'bind_port' (default: 443) 'certificate1' (default: testcert.pem) This must be a non-passphrased X509 certificate in PEM format 'server_key' (default: testkey.key) This must be a non-passphrased PKCS8 encoded private key associated with the certificate in PEM format The certificate and key properties are pathnames to a certificate and private key.
protected  byte[] readBinaryFile(java.io.File file)
           
 
Methods inherited from class com.cometway.httpd.WebServer
addExtension, clearExtensionsCache, getExtensions, getHTMLByCode, getHTMLByCode, getHTMLByCode, getMimeType, getRequestAgent, loadDefaultMimeTypes, loadMimeTypes, printThreads, run, start, stop
 
Methods inherited from class com.cometway.ak.Agent
currentStateEquals, debug, destroy, error, error, getAgentController, getDateTimeStr, getProps, getServiceImpl, getStateMachineModel, println, register, registerService, setAgentController, setProps, toString, unregister, unregisterService, warning, warning
 
Methods inherited from class com.cometway.props.Props
addListener, append, copy, copyFrom, copyTo, decrementInteger, dump, enableListeners, enumerateKeys, format, getBoolean, getByteArray, getCharacter, getDate, getDate, getDateString, getDouble, getFloat, getHexString, getInteger, getKeys, getLong, getNextKey, getProperty, getProperty, getPropsContainer, getSize, getString, getString, getTokens, getTokens, getTrimmedString, getVector, hasProperty, incrementInteger, insertProps, loadProps, notifyPropsChanged, notifyPropsChangedIgnore, notifyPropsChangedIgnore, parse, propertyMatchesRegEx, readFromFile, regExPropertyMatches, removeAll, removeListener, removeProperty, resumeNotify, saveProps, set, setBoolean, setCharacter, setDefault, setDouble, setFloat, setInteger, setLong, setProperty, setProperty, setProperty, setPropsContainer, suspendNotify, writeToFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION_STR

public static final java.lang.String VERSION_STR
See Also:
Constant Field Values
Constructor Detail

SecureWebServer

public SecureWebServer()
Method Detail

initProps

public void initProps()
Initializes this agent's properties by providing default values for each of the following missing properties: 'bind_port' (default: 443) 'certificate1' (default: testcert.pem) This must be a non-passphrased X509 certificate in PEM format 'server_key' (default: testkey.key) This must be a non-passphrased PKCS8 encoded private key associated with the certificate in PEM format The certificate and key properties are pathnames to a certificate and private key. If there is no path, the current directory will be used.

Specified by:
initProps in interface AgentInterface
Overrides:
initProps in class WebServer
See Also:
for the rest of the properties

getServerSocket

protected java.net.ServerSocket getServerSocket(java.lang.String bind_address,
                                                int port)
                                         throws java.io.IOException
This method uses the server key and certificate to create an SSLServerSocket.

Overrides:
getServerSocket in class WebServer
Throws:
java.io.IOException

readBinaryFile

protected byte[] readBinaryFile(java.io.File file)