Oracle9iAS Portal Developer Kit
How to Build an ASP Portlet Using PDK-URL Services

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.  

ASSUMPTIONS

  1. 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.

  2. You have already installed  Internet Information server (IIS) and are able to display ASP pages using  IIS.

  3. You are able to access your ASPs through a URL.

CREATING A PORTLET

This section describes how to create a URL Services portlet using Active Server Pages. 

  1. 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>

  2. Place this in a file and save it as myfirstaspportlet.asp. 

  3. 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

UPDATING FRAMEWORK

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.

Creating a provider.xml

  1. 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.

    1. Open a text editor.

    2. 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>

 

 

  1. Save and close the file.  Make sure to name the file "provider.xml".  
  1. Place the file in any directory other than the location where the JPDK provider.xml resides.  Remember the location.  For example:  C:\myfirstportletasp\provider.xml

Updating the zone.properties

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.

  1. Stop the Oracle HTTP Server.

  2. Open zone.properties.

  3. Under the Servlet Aliases section add the following:
    servlet.myfirstasp.code=oracle.portal.provider.v1.http.HttpProvider
  4. Under the Aliased Servlet Init Parameters section, add the following:
    servlet.myfirstasp.initArgs=provider_root=C:\myfirstportletasp,sessiontimeout=1800000
  5. Save and close the file.

  6. Start the Oracle HTTP Server.

  7. Now, test that you can execute the Adapter by calling the newly added alias. For example, type in the URL:
    http://host.domain:port/servlet/myfirstasp
  8. You should receive a sample page.

VIEWING PORTLET

  1. Now that you have successfully tested your new alias.  You will need to register a new provider that calls this alias.

  2. Register your new Provider.

    1. Name:  MyFirstASPProvider

    2. Display Name:  My First ASP Provider

    3. Timeout:  100

    4. Timeout Message:  My First ASP Portlet Timed Out

    5. Implementation Style:  Web

    6. Provider Login Frequency:  Once per User Session

    7. URL:  http://host.domain:port/servlet/myfirstasp

  3. 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.

  4. Now add your new portlet to a page.  Take note to view the title and description.

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: