|
|||||||||
| 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.httpd.WebServerExtension
com.cometway.httpd.HTTPPathRewrite
public class HTTPPathRewrite
This WebServerExtension reads in a file of match and replace pairs, separated by a space. These can be regular expressions similar to the s/match/replace/ used by sed or perl. These pairs are applied to the 'path' property of the HTTPAgentRequest but not the 'request' property. This WebServerExtension will always pass through, regardless of whether the path has been altered or not. The pairs are applied in the order they were read from the file, and stops when one of the match/replace pairs changes the path. Example match file: ^/images/(.*) /specials/all_images/$1 .*confidential.* /access_denied.html The first line will change '/images/wallpapers/1.jpg' to '/specials/all_images/wallpapers/1.jpg' The second will change '/1/2/confidential_20071031.pdf' to '/access_denied.html'
| Field Summary |
|---|
| 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 | |
|---|---|
HTTPPathRewrite()
|
|
| Method Summary | |
|---|---|
boolean |
handleRequest(HTTPAgentRequest request)
This will be called by the WebServer (specifically the ConnectionKMethod) to handle an HTTPAgentRequest. |
void |
initProps()
Override this method to initialize this agent's properties before it is started. |
void |
readMatchFile()
|
void |
start()
This method inherited from com.cometway.ak.ServiceAgent includes functionality to register itself with the WebServer (temporary). |
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 |
| Constructor Detail |
|---|
public HTTPPathRewrite()
| Method Detail |
|---|
public void initProps()
Agent
initProps in interface AgentInterfaceinitProps in class Agentpublic void start()
WebServerExtension
start in interface AgentInterfacestart in class WebServerExtensionpublic void stop()
ServiceAgent
stop in interface AgentInterfacestop in class ServiceAgentpublic void readMatchFile()
public boolean handleRequest(HTTPAgentRequest request)
WebServerExtension
handleRequest in class WebServerExtension
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||