Creating a custom Information Console web application : Customizing an Information Console web application : Obtaining information about the user and the session

Obtaining information about the user and the session

Typically, new Actuate Information Console web pages need access to session information. Your application server and Information Console store information about the session that you can use in your web pages. Obtain the serverURL, volume, and other information from your application server using the JSP request variable, as shown in the following example.

String volume = request.getParameter("volume");
String serverURL = request.getParameter("serverurl");
String userId = request.getParameter("userid");
String roxReport = request.getParameter("report");

You can also obtain the context root path from your application server, as shown in the following code:

String contextRoot = request.getContextPath();

Additionally, Actuate Information Console stores a wide variety of information about the session in UserInfoBean. To access UserInfoBean, place the following line of code near the top of your JSP:

<jsp:useBean id="userinfobean" class="com.actuate.activeportal.beans.UserInfoBean"scope="session"/>

After this line, you can access information in the JavaBean by the appropriate get method. The most important method for new pages is the getIportalid( ) method. This method retrieves the user’s authentication ID with the server. This ID is based on the server, volume, and user name information that the user supplied on the login page.

To write generic code, you need to determine whether your application is running. Information Console includes a utility class, iPortalRepository, that provides this information. To access this class in your JSP, place the following code at the head of your JSP:

<%@ page
  import="com.actuate.iportal.session.iPortalRepository" %>

Then use code similar to the following line to check the repository type:

boolean isEnterprise =iPortalRepository.REPOSITORY_ENCYCLOPEDIA.equalsIgnoreCase(userinfobean.getRepositoryType());

Use the authentication ID and the repository type to access the server with JSP custom Actuate tags and calls to Information Console beans, as shown in the following examples:

String authenticationID = userinfobean.getIportalid();
String folderPath = userinfobean.getCurrentfolder();
jobDetailURL += StaticFuncs.encode(userinfobean.getUserid());
com.actuate.reportcast.utils.AcLocale acLocale =userinfobean.getAcLocale();
TimeZone timeZone = userinfobean.getTimezone();
boolean isEnterprise =iPortalRepository.REPOSITORY_ENCYCLOPEDIA.equalsIgnoreCase(userinfobean.getRepositoryType());
String serverURL = ( isEnterprise | userinfobean.getServerurl() | "" );
String userVolume = ( isEnterprise | userinfobean.getVolume() | "" );

(c) Copyright Actuate Corporation 2011