Oracle9iAS Portal Developer Kit
How to Build an Illustration 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 Illustration 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 implement changes to the default behavior. For example, to change the portlet body (show mode), simply create a new portlet, or alter an existing framework installed with the PDK- Java (JPDK).

This article describes how to build a basic Illustration URL Services Portlet.

ASSUMPTIONS

  1. You have already installed the samples downloaded with the most recent JPDK and 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 ASP's, JSP's and HTML through a URL.

CREATING A SHOW MODE IN ASP

This section describes how to create a show mode for your 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 aspportlet.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/aspportlet.asp

CREATING A HELP MODE IN JSP

This section describes how to create a show mode for your portlet using Java Server Pages. 

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

  2. Place this in a file and save it as help.jsp.

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

CREATING AN ABOUT MODE IN HTML

This section describes how to create a show mode for your portlet using HTML. 

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

  2. Place this in a file and save it as about.html

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

CREATING A SHOW DETAILS MODE IN ASP

This section describes how to create a Show Details mode for your portlet using ASP.

  1. The ASP that was created for the actual Portlet can be used for the Show Details mode.

 

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

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 Oracle9iAS Portal.

You must supply URLs 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>.

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

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'?>
<?providerDefinitionversion="2.0"?> 

<provider class="oracle.portal.provider.v1.http.DefaultURLProvider">

  <session>true</session>

  <proxyInfo class="oracle.portal.provider.v1.http.ProxyInfoNodeHandler">

    <proxyHost>www-proxy.us.oracle.com</proxyHost>

    <proxyPort>80</proxyPort>

  </proxyInfo>

  <httpsProxyInfo class="oracle.portal.provider.v1.http.HttpsProxyInfoNodeHandler">

    <proxyHost>www-proxy.us.oracle.com</proxyHost>

    <proxyPort>80</proxyPort>

  </httpsProxyInfo>

 

  <portlet class="oracle.portal.provider.v1.http.PortletNodeHandler">

    <id>1</id>

    <name>multi lingual portlet</name>

    <title>Illustration Portlet</title>

    <description>This is a sample Illustration 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>

    <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/aspportlet.asp/default.asp</pageUrl>

    <filterType>text/html</filterType>

    <filter class="oracle.portal.provider.v1.http.HtmlFilter">

      <headerTrimTag>HEAD</headerTrimTag>

      <footerTrimTag>/BODY</footerTrimTag>

      <convertTarget>true</convertTarget>

    </filter>

    </showPage>

 

    <helpPage class="oracle.portal.provider.v1.http.URLPageRenderer">

      <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.v1.http.HtmlFilter">

        <headerTrimTag>HEAD</headerTrimTag>

        <footerTrimTag>/BODY</footerTrimTag>

        <convertTarget>true</convertTarget>

      </filter>

    </helpPage>

 

    <aboutPage class="oracle.portal.provider.v1.http.URLPageRenderer">

      <contentType>text/html</contentType>

      

      <pageUrl>http://host.domain:port/htmldirectory/about.html</pageUrl>

      <filterType>text/html</filterType>

      <filter class="oracle.portal.provider.v1.http.HtmlFilter">

        <headerTrimTag>HEAD</headerTrimTag>

        <footerTrimTag>/BODY</footerTrimTag>

         <convertTarget>true</convertTarget>

       </filter>

     </aboutPage>

 

    <showDetailsPage class="oracle.portal.provider.v1.http.URLPageRenderer">

      <contentType>text/html</contentType>

      <pageUrl>http://host.domain:port/aspdirectory/aspportlet.asp/default.asp</pageUrl>

      <filterType>text/html</filterType>

      <filter class="oracle.portal.provider.v1.http.HtmlFilter">

        <headerTrimTag>HEAD</headerTrimTag>

         <footerTrimTag>/BODY</footerTrimTag>

          <convertTarget>true</convertTarget>

       </filter>

     </showDetailsPage>

 

    </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".  
  2. Place the file in any directory other than the location where the PDK-Java provider.xml resides.  Remember the location.  For example:  C:\myfirstportlet\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..

Updating zone.properties

  1. Stop the Oracle HTTP Server.

  2. Open zone.properties.

  3. Under the Servlet Aliases section add the following:
    servlet.illustration.code=oracle.portal.provider.v1.http.HttpProvider
  4. Under the Aliased Servlet Init Parameters section, add the following:
    servlet.illustration.initArgs=provider_root=C:\myfirstportlet,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/illustration
  8. You should receive a sample page.

VIEW 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:  IllustrationProvider

    2. Display Name:  Illustration Provider

    3. Timeout:  100

    4. Timeout Message:  My Illustration  Portlet Timed Out

    5. Implementation Style:  Web

    6. Provider Login Frequency:  Once per User Session

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

  3. Click on OK.

    Note: If the URL that renders your portlet exists on a different domain than Oracle9iAS Portal, go to the Global Settings page within Oracle9iAS Portal and set up 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 Illustration portlet using PDK-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 PDK-URL Services articles for detailed information about the architecture:


Revision History: