|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cometway.props.Props
com.cometway.ak.Agent
com.cometway.ak.ServiceAgent
com.cometway.ak.RequestAgent
com.cometway.httpd.HTTPFileDownloadAgent
public class HTTPFileDownloadAgent
This agent is used to throttle specific content to web browsers. It can be used to limit maximum connections downloading content and the amount of bandwidth each connection is using.
| Field Summary | |
|---|---|
protected int |
currentSessions
|
protected java.lang.String |
html_directory
|
protected java.io.FileWriter |
logOut
|
protected java.lang.Object |
sync
|
| 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 | |
|---|---|
HTTPFileDownloadAgent()
|
|
| Method Summary | |
|---|---|
protected boolean |
addSession()
This method is used to internally track the number of active sessions. |
void |
handleRequest(AgentRequest agentRequest)
This method handles the download request. |
void |
initProps()
Initializes this agent's properties by providing default values for each of the following missing properties: "service_name" is used to register this agent with the ServiceManager (default: download.agent) "html_directory" points to the root directory where HTML files are served (default: public_html) "max_sessions" denotes the maximum amount of concurrent connections downloading content at a single time (default: 4) "max_bandwidth" denotes the amount of bytes per second allowed for each connection (default: 5000) "log_file" denotes the file which bandwidth usage is to be logged (default: downloads.log) |
protected void |
printLog(java.lang.String logString,
HTTPAgentRequest request)
This method is used by this Agent to log bandwidth related information to the log file. |
protected void |
removeSession()
This method is used to internally track the number of active sessions. |
void |
start()
Registers this agent and initializes the log file. |
void |
stop()
Unregisters this instance with the service manager using the service_name property. |
| 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 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String html_directory
protected int currentSessions
protected java.lang.Object sync
protected java.io.FileWriter logOut
| Constructor Detail |
|---|
public HTTPFileDownloadAgent()
| Method Detail |
|---|
public void initProps()
initProps in interface AgentInterfaceinitProps in class Agentpublic void start()
start in interface AgentInterfacestart in class ServiceAgentpublic void stop()
ServiceAgent
stop in interface AgentInterfacestop in class ServiceAgentprotected boolean addSession()
protected void removeSession()
public void handleRequest(AgentRequest agentRequest)
protected void printLog(java.lang.String logString,
HTTPAgentRequest request)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||