Contents Implementation & Administration Guide 1.1 Previous Next

webEISTM JSP Coding Example

Before you can access a webEIS document in the portal, you must make the following changes to the Java Server Page (JSP) files that comprise the document:

The examples shown below are taken from the sample webEIS document that is delivered with the SAS Information Delivery Portal. If you follow the installation instructions supplied with the portal, this sample webEIS document is installed as part of the demonstration portal. You can find it on your Web server in a folder called "WebEisDoc."

Edit URLS that Point to Secondary JSPs

Generally, a webEIS document consists of a main JSP and one or more secondary JSPs. Path information stored on the enterprise directory provides the location of the main JSP. URLs in the main JSP then point to any secondary JSPs that are needed for the webEIS document. You must change these URLs so that they point to the secondary JSPs' new locations on the Web server. You must also change the mechanism used to display the secondary JSPs so that they will be displayed correctly when a Web browser has cookies disabled.

For example, suppose the webEIS document's main JSP originally contained a URL to the secondary JSP (called DemoSection1.jsp), as shown below:

   <html>
      <head>
         <title>WebEIS Document Demo</title>
         <meta Http-equiv="refresh" Content="0; Url=DemoSection1.jsp">
      </head>
   </html>

To enable the portal to access the secondary JSP, you must modify the URL to point to the JSP's new location on the Web server and to handle Web browsers with cookies disabled. The modifications are shown below:

   <%@ page import="java.net.URL" %>
   <%
      URL url = new URL("http", request.getServerName(), request.getServerPort(),
         application.getAttribute("DocBase") +
         "/jsp/html/samples/WebEisDoc/DemoSection1.jsp");
      response.sendRedirect(response.encodeRedirectURL(url.toString()));
   %>

Note: In this example, the URL uses path information from the DocBase parameter of the Portal.properties file. The portal's install process builds this file using information that you provide in the Install.properties file. In addition, note that the sendDirect method is used in this example to ensure that the session ID will be encoded in the URL.

Edit Server Connection Information in Each JSP

Any of the JSPs that comprise a webEIS document can contain a definition for a connection to a SAS server. When you add the webEIS document to the portal, you must update these JSPs to use the IOM server and to refer to the appropriate SAS server definition on the Portal's enterprise directory.

To find connection information in a webEIS JSP, look for the following comments:

  // Start connection definition
         {

         }
  // End connection definition

In each JSP that contains a connection definition, you must add code similar to the following immediately before the closing bracket:

  logicalName = "Portal Demo Logical";  
  com.sas.edir.webapp.portal.util.WebEisDocumentUtil.setConnection(request,                                                                                               
  connectionInstance1xConnection,logicalName);

The setConnection method sets the connection to use IOM. The credentials of the portal user are set in the connection and will be used to create a workspace on the SAS server. The method includes the following parameters:

Request
The predefined HttpServletRequest variable.

connectionInstance1xConnection
The com.sas.rmi.Connection instance. The name of this variable will differ among JSPs and is based on the name of the webEIS document.

logicalName
The logical name that identifies the server and login definitions to be used when creating the connection to the server

When the webEIS document is invoked, an IOM connection is created and the portal renders the webEIS document in a separate browser window. The resources (including the connection) that are associated with the webEIS document are not cleaned up when the user closes this window. The Object Server terminates when the user logs off from the portal or the portal session times out.


Contents Implementation & Administration Guide 1.1 Previous Next