com.creamtec.ajaxswing.examples

## Class AgentRequestFilterExample

- java.lang.Object
- - com.creamtec.ajaxswing.examples.AgentRequestFilterExample

- All Implemented Interfaces:
    AgentRequestFilter

      public class AgentRequestFilterExample
      extends java.lang.Object
      implements AgentRequestFilter

  Demonstrates the usage of AgentRequestFilter interface to intercept standard AjaxSwing "resize" action and to modify the generated HTML pages.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AgentRequestFilterExample()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `postEmulateAction(ClientAgent agent, ActionData data)` Called after the action emulation is complete.
    `void` | `postProcessRequest(ClientAgent agent, HttpResponseData responseData)` Overridden to modify the generated HTML page by adding the user IP address.
    `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)` Overridden to intercept "resize" action.
    `void` | `preRenderWindows(ClientAgent agent, java.util.List windows)` Called before the given window is rendered as HTML page

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AgentRequestFilterExample

          public AgentRequestFilterExample()

  - ### Method Detail

    - #### preProcessRequest

          public HttpResponseData preProcessRequest(ClientAgent agent)

      Overridden to intercept "resize" action.
      Specified by:
        `preProcessRequest` in interface `AgentRequestFilter`
      Parameters:
        `agent` - ClientAgent
      Returns:
        HttpResponseData

    - #### postProcessRequest

          public void postProcessRequest(ClientAgent agent,
                                HttpResponseData responseData)

      Overridden to modify the generated HTML page by adding the user IP address.
      Specified by:
        `postProcessRequest` in interface `AgentRequestFilter`
      Parameters:
        `agent` - ClientAgent
        `responseData` - HttpResponseData

    - #### preEmulateAction

          public 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.
      Specified by:
        `preEmulateAction` in interface `AgentRequestFilter`
      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

          public void postEmulateAction(ClientAgent agent,
                               ActionData data)

      Called after the action emulation is complete. (even if preEmulateAction returned false).
      Specified by:
        `postEmulateAction` in interface `AgentRequestFilter`
      Parameters:
        `agent` - client agent
        `data` - contains the information about the action to be emulated

    - #### preRenderWindows

          public void preRenderWindows(ClientAgent agent,
                              java.util.List windows)

      Called before the given window is rendered as HTML page
      Specified by:
        `preRenderWindows` in interface `AgentRequestFilter`
      Parameters:
        `agent` - client agent
        `windows` - Window to be rendered

    - #### postRenderWindows

          public java.lang.String postRenderWindows(ClientAgent agent,
                                           java.util.List windows,
                                           java.lang.String htmlCode)

      Called after the given window is rendered as HTML page
      Specified by:
        `postRenderWindows` in interface `AgentRequestFilter`
      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, or

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