Once you have successfully installed and deployed the URL Services, you may want to begin building URL Services portlets of your own. When creating your own ASP portlet, it will access the same provider framework already used by the URL samples. This feature limits the amount of code required by you to create your portlet. What this means is that you only write code when you need to implement changes to the default behavior. For example, to change the portlet body (show mode), simply create a new portlet, or alter an existing portlet and use the existing framework installed with the PDK-Java (JPDK).
This article describes how to build a basic URL Services portlet in an ASP implementation.
You have already installed the samples downloaded with the most recent JPDK and understand the steps required to display a URL Services portlet on a portal page. For more information on installing the sample, please review the Installing the PDK-Java 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 ASPs through a URL.
This section describes how to create a URL Services 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 myfirstaspportlet.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/myfirstaspportlet.asp
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 to add new portlets without affecting Web Providers already registered with Oracle9iAS Portal.
Open a text editor.
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.
Note: Make sure to update the page URL (proxy settings) with your own correct information. The information supplied in the page URL is for example only. The page URL is displayed in bold.
<?xml version = '1.0' encoding = 'UTF-8'?>
<?providerDefinition version="2.0"?>
<provider class="oracle.portal.provider.v1.http.DefaultURLProvider">
<session>true</session>
<proxyInfo class="oracle.portal.provider.v1.http.CommonNodeHandler">
<httpProxyHost>www-proxy.us.oracle.com</httpProxyHost>
<httpProxyPort>80</httpProxyPort>
</proxyInfo>
<httpsProxyInfo class="oracle.portal.provider.v1.http.CommonNodeHandler">
<httpsProxyHost>www-proxy.us.oracle.com</httpsProxyHost>
<httpsProxyPort>80</httpsProxyPort>
</httpsProxyInfo>
<portlet class="oracle.portal.provider.v1.http.PortletNodeHandler">
<id>1</id>
<name>HelloASP</name>
<title>HelloASP Portlet</title>
<description>This is a sample ASP portlet using URLServices.</description>
<timeout>10</timeout>
<timeoutMessage>ASP Portlet timed out</timeoutMessage>
<acceptContentType>text/html</acceptContentType>
<registrationPortlet>false</registrationPortlet>
<accessControl>public</accessControl>
<renderer class="oracle.portal.provider.v1.RenderManager">
<showPage class="oracle.portal.provider.v1.http.URLPageRenderer">
<contentType>text/html</contentType>
<pageUrl>http://host.domain:port/aspdirectory/myfirstaspportlet.asp</pageUrl>
<filterType>text/html</filterType>
<filter class= "oracle.portal.provider.v1.http.HtmlFilter">
<headerTrimTag>/HEAD</headerTrimTag>
<footerTrimTag>/BODY</footerTrimTag>
</filter>
</showPage>
</renderer>
<securityManager class="oracle.portal.provider.v1.http.URLSecurityManager">
<authorizType>public</authorizType>
</securityManager>
</portlet>
</provider>
- Save and close the file. Make sure to name the file "provider.xml".
Currently the zone.properties has an argument called provider_root that points the Adapter to the directory where the provider.xml for the JPDK resides. We will add a new entry to point to our new provider.xml in addition to the previous one.
Stop the Oracle HTTP Server.
Open zone.properties.
servlet.myfirstasp.code=oracle.portal.provider.v1.http.HttpProvider
servlet.myfirstasp.initArgs=provider_root=C:\myfirstportletasp,sessiontimeout=1800000
Save and close the file.
Start the Oracle HTTP Server.
http://host.domain:port/servlet/myfirstasp
Now that you have successfully tested your new alias. You will need to register a new provider that calls this alias.
Register your new Provider.
Name: MyFirstASPProvider
Display Name: My First ASP Provider
Timeout: 100
Timeout Message: My First ASP Portlet Timed Out
Implementation Style: Web
Provider Login Frequency: Once per User Session
URL: http://host.domain:port/servlet/myfirstasp
Click OK.
Note: If the URL that renders your ASP portlet exists on a different domain that Oracle9iAS Portal, go to the Global Setting page within Oracle9iAS Portal and setup your proxy server information. Please review the Oracle9iAS Portal documentation for more information about setting up a proxy server.
Now that you have successfully built your own ASP portlet using URL services, please look for future articles that will guide you through adding services to your portlet such as session storage, nls handling, customization etc. Review the following URL services articles for detailed information about the URL services architecture:
Revision History:
June 25, 2001.