Package org.silverpeas.processmanager.servlets

## Class SessionSafeFunctionHandler

- java.lang.Object
- - org.silverpeas.processmanager.servlets.SessionSafeFunctionHandler

- All Implemented Interfaces:
    `FunctionHandler`

      public abstract class SessionSafeFunctionHandler
      extends Object
      implements FunctionHandler

  A SessionSafeFunctionHandler must be used to prevent conflicts in HTTP Session when user navigate using several windows sharing the same session.
  Author:
    Ludovic Bertin

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SessionSafeFunctionHandler()` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected abstract String` | `computeDestination​(String function, ProcessManagerSessionController session, javax.servlet.http.HttpServletRequest request, List<org.apache.commons.fileupload.FileItem> items)` | Main scenario to be implemented by handler.
    `protected void` | `generateTokenId​(ProcessManagerSessionController session, javax.servlet.http.HttpServletRequest request)` | Generate random UUID and store it in request as attribute and in process manager session controller
    `String` | `getDestination​(String function, ProcessManagerSessionController session, javax.servlet.http.HttpServletRequest req)` | Process the request and returns the response url.
    `protected void` | `resetTokenId​(ProcessManagerSessionController session, javax.servlet.http.HttpServletRequest request)` | Reset token Id.

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

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

- - ### Constructor Detail

    - #### SessionSafeFunctionHandler

          public SessionSafeFunctionHandler()

  - ### Method Detail

    - #### getDestination

          public final String getDestination​(String function,
                                             ProcessManagerSessionController session,
                                             javax.servlet.http.HttpServletRequest req)
                                      throws ProcessManagerException

      Description copied from interface: `FunctionHandler`
      Process the request and returns the response url.
      Specified by:
        `getDestination` in interface `FunctionHandler`
      Parameters:
        `function` - the user request name
        `session` - the user request context
        `req` - the user request params
      Throws:
        `ProcessManagerException`

    - #### generateTokenId

          protected void generateTokenId​(ProcessManagerSessionController session,
                                         javax.servlet.http.HttpServletRequest request)

      Generate random UUID and store it in request as attribute and in process manager session controller
      Parameters:
        `session` - the process manager session controller
        `request` - the http servlet request

    - #### resetTokenId

          protected void resetTokenId​(ProcessManagerSessionController session,
                                      javax.servlet.http.HttpServletRequest request)

      Reset token Id.
      Parameters:
        `session` - the process manager session controller
        `request` - the http servlet request

    - #### computeDestination

          protected abstract String computeDestination​(String function,
                                                       ProcessManagerSessionController session,
                                                       javax.servlet.http.HttpServletRequest request,
                                                       List<org.apache.commons.fileupload.FileItem> items)
                                                throws ProcessManagerException

      Main scenario to be implemented by handler.
      Parameters:
        `function` - the name of use case to realize
        `session` - the process manager session controller
        `request` - the http servlet request
        `items` - eventual submitted items
      Returns:
        the JSP servlet to be forwarded to.
      Throws:
        `ProcessManagerException`