com.creamtec.ajaxswing

## Interface RouterRequestFilter

- All Known Implementing Classes:
    RouterRequestFilterExample

      public interface RouterRequestFilter

  This interface must be implemented by classes in order to do pre- and post-processing of HTTP requests on the servlet level. AjaxSwing uses a router servlet (AjaxSwingRouter) to receive the requests. The actual processing of the request is delegated to the client agent. AjaxSwing uses POST method to submit the form. When a request is received, the router first calls preProcessRequest. Then, a client agent is located and the data is extraced from HTTP servlet request and placed into AjaxSwing's HttpRequestData. After that the router calls postProcessRequest and if the processing is not cancelled, calls processHttpRequest method of the client agent. When the client agent method returns, processReponse method of the request filter is called.
  See Also:
    `for sample implementation`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `postProcessRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, AppDesc appDesc, ClientAgentRemote agent, HttpRequestData requestData)` Called when a new HTTP request is received by the router after the AjaxSwing related information has been extracted from the request and the appropriate client agent located.
    `boolean` | `preProcessRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Called when a new HTTP request is received by the router before any processing has been done.
    `boolean` | `processResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, AppDesc appDesc, ClientAgentRemote agent, HttpRequestData requestData, HttpResponseData responseData)` Called when the client agent has finished processing the request and has returned a page.

- - ### Method Detail

    - #### preProcessRequest

          boolean preProcessRequest(javax.servlet.http.HttpServletRequest request,
                                  javax.servlet.http.HttpServletResponse response)

      Called when a new HTTP request is received by the router before any processing has been done. If false is returned by this method, the request filter is responsible for creating the HTML output and writing it to the response.
      Parameters:
        `request` - HttpServletRequest
        `response` - HttpServletResponse
      Returns:
        true to continue processing the request, false to stop processing and return

    - #### postProcessRequest

          boolean postProcessRequest(javax.servlet.http.HttpServletRequest request,
                                   javax.servlet.http.HttpServletResponse response,
                                   AppDesc appDesc,
                                   ClientAgentRemote agent,
                                   HttpRequestData requestData)
                                     throws java.lang.Exception

      Called when a new HTTP request is received by the router after the AjaxSwing related information has been extracted from the request and the appropriate client agent located. If false is returned by this method, the request filter is responsible for creating the HTML output and writing it to the response.
      Parameters:
        `request` - HttpServletRequest
        `response` - HttpServletResponse
        `appDesc` - Application descriptor used by AjaxSwing to maintain the application information
        `agent` - Client agent associated with the request. Can be in the same JVM or in a different JVM.
        `requestData` - Request data that is going to be sent to the client agent.
      Returns:
        true to continue processing the request, false to stop processing and return
      Throws:
        `java.lang.Exception` - on error

    - #### processResponse

          boolean processResponse(javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response,
                                AppDesc appDesc,
                                ClientAgentRemote agent,
                                HttpRequestData requestData,
                                HttpResponseData responseData)
                                  throws java.lang.Exception

      Called when the client agent has finished processing the request and has returned a page. Can be used to change the generated page, replace or page or send a redirect using servlet API. If the method returns false, it is responsible for writing the output to HttpServletResponse
      Parameters:
        `request` - HttpServletRequest
        `response` - HttpServletResponse
        `appDesc` - AppDesc
        `agent` - ClientAgentRemote
        `requestData` - HttpRequestData
        `responseData` - HttpResponseData
      Returns:
        boolean true to continue processing, false to return
      Throws:
        `java.lang.Exception` - on error

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