We didn't alter any of the original GWY.jsp code. Instead we added a piece to capture the value of the current EBS session cookie and rewrite it to another cookie that APEX will expect. By using the GWY.jsp, in the case where someone has bookmarked the urls within EBS to launch APEX, we can lean on the session checking already included. Anyone without a valid session will be sent to the Oracle login page.
Where does LaunchApex.jsp go on the server?
$OA_HTML should point to the running file system.
For example:
<some path>/fs1/FMW_Home/Oracle_EBS-app1/applications/oacore/html
For production you would only place in the non-running or Patch file system, then compile and wait for a patch cycle to commit to the running file system. But in our test environment we place in both file systems
For example:
<some path>/fs1/FMW_Home/Oracle_EBS-app1/applications/oacore/html
<some path>/fs2/FMW_Home/Oracle_EBS-app1/applications/oacore/html
How is LaunchApex.jsp used?
LaunchApex.jsp will be set in the function call within EBS and we will see this in another post.
But first we have to compile the jsp and restart Weblogic so the new jsps are ready for use.
For Example:
cd <some path>/fs1/FMW_Home/Oracle_EBS-app1/applications/oacore/html
$FND_TOP/patch/115/bin/ojspCompile.pl --compile -s 'ZEUS_LaunchApex.jsp' –flush
cd <some path>/fs2/FMW_Home/Oracle_EBS-app1/applications/oacore/html
$FND_TOP/patch/115/bin/ojspCompile.pl --compile -s 'ZEUS_LaunchApex.jsp' --flush
Restarting Weblogic Server
admanagedsrvctl.sh stop oacore_server1
admanagedsrvctl.sh start oacore_server1
The Cookie Variables explained:
String ebsCookieName = "VIS"; - this is the name of the EBS cookie, there are several articles on the internet that show you how to locate this value either in your browser or in your database.
String apexCookieName = "VISAPEX"; - this is the name of the cookie for which APEX will be looking in the browser. In the APEX application this is a substitution string setting (don't forget to set it)
String apexDomain = ".YOURDOMAIN.com"; - the SHARED domain between apex and ebs. Not setting this could cause an issue if you have any custom code that uses a default domain that isn't correct. Maybe a bad clone from another instance kept an older value or something to that effect.The leading "." isn't strictly required but some browsers may forget to add it, so explicitly setting is a good idea.
String apexPath = "/"; - another parameter that isn't required but could be set to an undesirable value by your webserver due to any number of ways defaults/non set values are handled, so explicitly setting is a good idea.
boolean isCookieSecure = false; - If both servers are using SSL, change this to true. Otherwise leave alone.
Full listing for our LaunchApex.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%--
/*===========================================================================+
| Copyright (c) 2009 Oracle Corporation, Redwood Shores, CA, USA |
| All rights reserved. |
+===========================================================================+
| FILENAME |
| GWY.jsp |
| |
| DESCRIPTION |
| GWY.jsp handles external application URL embedding within |
| E-Business Suite. GWY expects to be invoked only from RF as |
| standard function invocation. |
| |
| DEPENDENCIES |
| |
| HISTORY |
| 01-AUG-2009 raghosh created |
+===========================================================================*/
--%>
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.HashMap"%>
<%@ page import="java.util.Enumeration"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="oracle.apps.fnd.common.VersionInfo"%>
<%@ page import="oracle.apps.fnd.services.gwy.ExternalAppManager"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Oracle Applications External Gateway - Custom Launch Apex 20140801 - 5</title>
</head>
<body>
<%! public static final String RCS_ID = "$Header: GWY.jsp 120.3.12020000.1 2012/06/30 05:28:11 appldev ship $"; %>
<%! public static final boolean RCS_ID_RECORDED = VersionInfo.recordClassVersion(RCS_ID,"oa_html"); %>
<%
Enumeration<String> paramNames = request.getParameterNames();
Map<String, String> params = new HashMap<String, String>();
while(paramNames.hasMoreElements()) {
String param = paramNames.nextElement();
String paramVal = request.getParameter(param);
if (!(paramVal == null || "".equals(paramVal)))
paramVal = paramVal.trim();
params.put(param, paramVal);
}
//boolean debugMode = "Y".equalsIgnoreCase(params.get("debug")) ? true : false;
//if (debugMode) {
// Iterator iter = params.entrySet().iterator();
// while (iter.hasNext()) {
// Map.Entry aPair = (Map.Entry) iter.next();
// out.println(String.valueOf(aPair.getKey()) + "=" + String.valueOf(aPair.getValue()) + "<br>");
// }
//}
String targetType = params.get(ExternalAppManager.EXTERNAL_APP_TYPE_PARAM);
if (targetType == null || "".equals(targetType))
targetType = (String) request.getAttribute(ExternalAppManager.EXTERNAL_APP_TYPE_PARAM);
String handlerClass = params.get(ExternalAppManager.EXTERNAL_APP_HANDLER_PARAM);
if (handlerClass == null || "".equals(handlerClass))
handlerClass = (String) request.getAttribute(ExternalAppManager.EXTERNAL_APP_HANDLER_PARAM);
//String authFunction = params.get(ExternalAppManager.EXTERNAL_APP_AUTH_FUNCTION);
ExternalAppManager manager = new ExternalAppManager(request, response, targetType, handlerClass);
manager.logParams(params);
/** COOKIE REWRITE BEGIN **/
// COOKIE VARIABLES
String ebsCookieName = "VIS";
String apexCookieName = "VISAPEX";
String apexDomain = ".YOURDOMAIN.com";
String apexPath = "/";
boolean isCookieSecure = false;
// RETRIEVE EBS COOKIE
Cookie[] cookies = request.getCookies();
Cookie ebsCookie = null;
if (cookies != null) {
for (int i = 0; i < cookies.length; i++) {
if (cookies [i].getName().equals (ebsCookieName)) {
ebsCookie = cookies[i];
break;
}
}
}
// CREATE APEX COOKIE USING EBS COOKIE VALUE
Cookie apexCookie = new Cookie(apexCookieName, ebsCookie.getValue());
apexCookie.setDomain(apexDomain);
apexCookie.setPath(apexPath);
apexCookie.setSecure(isCookieSecure);
// ADD COOKIE INTO RESPONSE
response.addCookie(apexCookie);
/** COOKIE REWRITE END **/
manager.doForward(params, false);
manager.releaseResources();
%>
</body>
</html>