Oracle Portal
Development Kit
How to Build a Multi-Programming
Language Portlet
Using the PDK
PDK Release 2 (9.0.2 and later)
Once you have successfully installed and deployed the PDK, you may want to begin building URL-based portlets of your own. The PDK enables you to create URL-based portlets that use multiple programming languages to implement the various portlet modes.
This article describes how to build a basic multi-programming language URL-based portlet.
You have already installed the samples downloaded with the most recent PDK and and understand the steps required to display a URL-based portlet on a portal page. For more information on installing the sample, please review the Installing the PDK Framework and Samples article.
You have already installed Internet Information Server (IIS) and are able to display ASP pages using IIS.
You are able to access your ASP's, JSP's and HTML through a URL.
This section describes how to create a show mode for your portlet using Active Server Pages.
Write a simple ASP that displays a welcome greeting along with the time. You may write your own or use the sample provided.
<%@ Language=VBScript %>
<html>
<head>
<title>SAMPLE ASP</title>
</head>
<body>
<center><B><U><font size="5" font color= black>
<%FirstVar = "Welcome to the PDK Integration ASP Portlet!"%>
<%=FirstVar%></U></B></FONT>
</center><br>
<CENTER><blink><b><%IF Hour(time)>18 OR Hour(time)<4 THEN%>
Good Night Everyone.
<%ELSE%>
Good Morning Everyone.
<%END IF%></blink></b></CENTER>
<%
FirstVar = "Hello world!"
%><br>
<CENTER><b>The time is: <%=time%></b></CENTER><BR><BR>
</body>
</html>
Place this in a file and save it as aspportlet.asp.
Move the File to your ASP directory for Internet Information Server. Make sure it is possible to display the ASP in the browser. For example: http://host.domain:port/aspdirectory/aspportlet.asp
This section describes how to create a show mode for your portlet using Java Server Pages.
Write a simple JSP that displays simple help information. You may write your own or use the sample provided.
<%@ page language = "java" info="a hello world example" import = "oracle.portal.provider.v1.http.*" session = "false" %>
<html>
<center>
<b>This is the help show mode created in JSP to interact with an ASP portlet.</b><br><br>
<hr width = 100%>
To view the portlet in full screen mode click on the portlet title in the left corner of the title banner.
<hr width = 100%>
</center>
</html>
Place this in a file and save it as help.jsp.
Move the File to your JSP directory. Make sure it is possible to display the JSP in the browser. For example: http://host.domain:port/jspdirectory/help.jsp
This section describes how to create a show mode for your portlet using HTML.
Write a simple HTML page that displays simple information about the portlet. You may write your own or use the sample provided.
</html>
<html>
<center>
<hr width=75%>
<table width="50%">
<tr><td align="center">
<b>Hello Multi Show Mode ASP Portlet - Displays a portlet created using ASP, that has show modes created using ASP, JSP and HTML.
</b></td></tr>
</table>
</center>
</html>
Place this in a file and save it as about.html
Move the File to your HTML directory. Make sure it is possible to display the JSP in the browser. For example: http://host.domain:port/htmldirectory/about.html
This section describes how to create a Show Details mode for your portlet using ASP.
The ASP that was created for the actual Portlet can be used for the Show Details mode.
This section explains how to create a provider.xml to describe and list your new portlet. It then explains how to update the Oracle HTTP Server to view the new provider.xml.
In this section you will create a new provider.xml. Creating a new provider.xml will allow you add new portlets without affecting Web Providers already registered with Oracle 9iAS Portal.
You must supply a URL's for the portlets that you created. The URL is added in the showPage, helpPage and aboutPage between the <pageurl> tags. doing this will Provide the actual Portlet.
There are two steps when adding different show modes to a portlet. First, you must activate the Show Mode by the setting a value of true to the <hasHelp>, <hasAbout> and<showDetails>tags. For example: <hasHelp>true</hasHelp>. Second, within the show mode rendering section, you must specify the correct URL for the show mode in question between the <pageURL> tags. For example <helpPage>.
Add the following entry to the file. Note: If you plan to add additional portlets in the future, verify that your portlet ID is unique for this provider.
All the changes that need to be carried out are highlighted in bold. (replace with your own proxy/host/sample directory setting details.
Note: Make sure to update the page URL and Show Mode URL with your own correct information. The information supplied in the URL's is for example only. The changes are displayed in bold.
<?xml version="1.0" encoding="UTF-8"?>
<?providerDefinition version="3.1"?>
<provider class="oracle.portal.provider.v2.http.URLProviderDefinition">
<providerInstanceClass>oracle.portal.provider.v2.http.URLProviderInstance</providerInstanceClass>
<session>true</session>
<proxyInfo class="oracle.portal.provider.v2.ProxyInformation">
<httpProxyHost>www-proxy.us.oracle.com</httpProxyHost>
<httpProxyPort>80</httpProxyPort>
</proxyInfo>
<httpsProxyInfo class="oracle.portal.provider.v2.ProxyInformation">
<httpsProxyHost>www-proxy.us.oracle.com</httpsProxyHost>
<httpsProxyPort>80</httpsProxyPort>
</httpsProxyInfo>
<portlet class="oracle.portal.provider.v2.http.URLPortletDefinition">
<id>1</id>
<name>multiLingualPortlet</name>
<title>Multi Language Portlet</title>
<description>This is a sample multi language portlet to test Integration services </description>
<timeout>100</timeout>
<timeoutMessage>Portlet Timed Out</timeoutMessage>
<showEdit>false</showEdit>
<showEditDefault>false</showEditDefault>
<showPreview>false</showPreview>
<showDetails>true</showDetails>
<hasHelp>true</hasHelp>
<hasAbout>true</hasAbout>
<acceptContentType>text/html</acceptContentType>
<registrationPortlet>false</registrationPortlet>
<renderer class="oracle.portal.provider.v2.render.RenderManager">
<showPage class="oracle.portal.provider.v2.render.http.URLRenderer">
<contentType>text/html</contentType>
<accessControl>public</accessControl>
<pageUrl>http://host.domain:port/aspdirectory/aspportlet.asp/default.asp</pageUrl>
<filterType>text/html</filterType>
<filter class="oracle.portal.provider.v2.render.HtmlFilter">
<headerTrimTag><BODY</headerTrimTag>
<footerTrimTag>/BODY></footerTrimTag>
<convertTarget>true</convertTarget>
</filter>
</showPage>
<helpPage class="oracle.portal.provider.v2.render.http.URLRenderer">
<contentType>text/html</contentType>
<accessControl>public</accessControl>
<pageUrl>http://host.domain:port/jspdirectory/help.jsp</pageUrl>
<filterType>text/html</filterType>
<filter class="oracle.portal.provider.v2.render.HtmlFilter">
<headerTrimTag><BODY</headerTrimTag>
<footerTrimTag>/BODY></footerTrimTag>
<convertTarget>true</convertTarget>
</filter>
</helpPage>
<aboutPage class="oracle.portal.provider.v2.render.http.URLRenderer">
<contentType>text/html</contentType>
<accessControl>public</accessControl>
<pageUrl>http://host.domain:port/htmldirectory/about.html</pageUrl>
<filterType>text/html</filterType>
<filter class="oracle.portal.provider.v2.render.HtmlFilter">
<headerTrimTag><BODY</headerTrimTag>
<footerTrimTag>/BODY></footerTrimTag>
<convertTarget>true</convertTarget>
</filter>
</aboutPage>
<showDetailsPage class="oracle.portal.provider.v2.render.http.URLRenderer">
<contentType>text/html</contentType>
<accessControl>public</accessControl>
<pageUrl>http://host.domain:port/aspdirectory/aspportlet.asp/default.asp</pageUrl>
<filterType>text/html</filterType>
<filter class="oracle.portal.provider.v2.render.HtmlFilter">
<headerTrimTag><BODY</headerTrimTag>
<footerTrimTag>/BODY></footerTrimTag>
<convertTarget>true</convertTarget>
</filter>
</showDetailsPage>
</renderer>
<securityManager class="oracle.portal.provider.v2.security.URLSecurityManager">
<authorizType>public</authorizType>
</securityManager>
</portlet>
</provider>
- Save and close the file. Make sure to name the file "provider.xml".
Note: Once this new provider.xml has been created, it will replace all the previous versions of the provider.xml. This will cause all the other portlets created using an older version of the provider.xml to stop working. An XLS stylesheet will be provided in a future release to modify the older portlets..
To configure and deploy your provider on OC4J, please see the section called "Deploying Your Provider on OC4J" in the article, How to Build a URL-Based Portlet.
At this point, you are ready to register your provider and then add the multi-programming language portlet to a page. Please follow the appropriate steps for doing this as described in the Installing the URL-Based Portlet Samples article.Now that you have successfully created a multi-programming language portlet, please look for other portlet development articles that describe how to add extra features to your portlet, including single sign-on to external URL-based applications, HTML and XML filtering and more.
Here are some reference articles to help you better understand the architecture and technical details of URL-based portlets:
Revision History:
March 2002