com.creamtec.ajaxswing.core
Interface AgentRequestFilter

All Known Implementing Classes:
AbstractAgentRequestFilter, AgentRequestFilterExample, AjaxSwingAgentRequestFilter

public interface AgentRequestFilter

Used to do pre- and post-processing of requests received by the client agent. The requests are usually a resut of received HTTP requests, but because the client agent may execute in a different JVM the servlet API is not accessible (see RouterRequestFilter interface for HTTP request filtering). The sequence of method execution is always the same, although depending on the request some methods may not be called. The first callback method is preProcessRequest. It is called after a request is received by the client agent and the agent is initialized. Then the GUI elements are updated with the data and if there is an action to be emulated such as a button click, preEmulateAction is called. After that the action is emulated and postEmulateAction is called. If there were no errors during the processing, preRenderWindow is called, the current window is rendered and postRenderWindow is called. Finally, postProcessRequest is called and the data is returned to the router servlet.

See Also:
for sample implementation

Method Summary
 void postEmulateAction(ClientAgent agent, ActionData data)
          Called after the action emulation is complete.
 void postProcessRequest(ClientAgent agent, HttpResponseData responseData)
          Called when a request is processed and about to be returned to the router servlet.
 java.lang.String postRenderWindows(ClientAgent agent, java.util.List windows, java.lang.String htmlCode)
          Called after the given window is rendered as HTML page
 boolean preEmulateAction(ClientAgent agent, ActionData data)
          Called after the controls have been updated with the data but before the action is emulated.
 HttpResponseData preProcessRequest(ClientAgent agent)
          Called when a request is received and the agent is initialized.
 void preRenderWindows(ClientAgent agent, java.util.List windows)
          Called before the given window is rendered as HTML page
 

Method Detail

preProcessRequest

HttpResponseData preProcessRequest(ClientAgent agent)
Called when a request is received and the agent is initialized. Returning a null from this method indicates that the processing should continue. Returning a non-null value indicates that the request is processed and the response can be returned to the router servlet.

Parameters:
agent - client agent
Returns:
null or initialized HttpResponseData

postProcessRequest

void postProcessRequest(ClientAgent agent,
                        HttpResponseData responseData)
Called when a request is processed and about to be returned to the router servlet.

Parameters:
agent - client agent
responseData - containing the generated page

preEmulateAction

boolean preEmulateAction(ClientAgent agent,
                         ActionData data)
Called after the controls have been updated with the data but before the action is emulated. If there is no action to be emulated (for instance, if "update" was submitted, this method will not be called.

Parameters:
agent - client agent
data - contains the information about the action to be emulated
Returns:
true to emulate the action, false to not emulate

postEmulateAction

void postEmulateAction(ClientAgent agent,
                       ActionData data)
Called after the action emulation is complete. (even if preEmulateAction returned false).

Parameters:
agent - client agent
data - contains the information about the action to be emulated

preRenderWindows

void preRenderWindows(ClientAgent agent,
                      java.util.List windows)
Called before the given window is rendered as HTML page

Parameters:
agent - client agent
windows - Window to be rendered

postRenderWindows

java.lang.String postRenderWindows(ClientAgent agent,
                                   java.util.List windows,
                                   java.lang.String htmlCode)
Called after the given window is rendered as HTML page

Parameters:
agent - client agent
windows - Window that was rendered
htmlCode - The HTML code for the page produced by AjaxSwing engine. Modifications to the HTMLPage object associated with the client agent will not be reflected in the generated HTML code
Returns:
HTML code of the page that will be returned to the browser. The filter has to return the HTML code whether it modified it or not


Copyright © 2000-2012 CreamTec LLC. All Rights Reserved.