Tuesday, October 30, 2012

Validate Existing OAF Session in JSP/Servlet

One way to validate OAF session in custom jsp/servlet in Oracle applications. Method will return "INVALID" if the current session is invalid, "EXPIRED" if current session is expired and "VALID" if current session is valid.
You can also create new session if current session is invalid, wiill post detail in some other post. But, usually if Functionality is part of existing oracle application module, then you will just want to validate if current session is valid or not. If not, you may want to redirect to /OA_HTML/AppsLocalLogin.jsp page.

public static String validateOAFSession(HttpServletRequest request, HttpServletResponse response) {
    WebAppsContext appsContext = null;
    try {
        appsContext = WebRequestUtil.createWebAppsContext(request, response);
        if (appsContext != null) {
            String sessionCookie = WebRequestUtil.getSessionCookie(request, response, appsContext);
            if (sessionCookie == null) {
                return "INVALID";
            }
            if (!appsContext.validateSession(sessionCookie, true)) {
                return "EXPIRED";
            }
        }
    } catch (IOException ioe) {
        return "INVALID";
    } finally {
        if (appsContext != null) {
            appsContext.freeWebAppsContext();
        }
    }
    return "VALID";
}

5 comments:

  1. This applies not only during the IQ, OQ and PQ validation phases, but far earlier,
    beginning with the first meeting, and continuing through analysis of your process.
    Software validation is a part of the design validation for a finished device,
    but is not separately defined in the Quality System regulation.

    software validation

    ReplyDelete