Oracle9iAS Portal Developer Kit
How to Build a URL-Based SSL Portlet

In the article, How to Build a URL-Based Portlet, you learned how to create a portlet that displayed the content of a URL-based application. The example used in that article was Google.com. The PDK-URL Services also enables you to create URL-based portlets that display the content of URLs secured by SSL (Secure Sockets Layer protocol).

This article shows you how to create a URL-based SSL portlet. The example used in this article is the United Airlines website (https://www.ual.com).

### ASSUMPTIONS

1. You have successfully installed the PDK-Java runtime and samples by following the article Installing the PDK-Java Framework and Samples.

2. You have successfully installed the PDK-URL Services runtime and samples by following the article Installing the PDK-URL Services Samples.

### PRE-INSTALLATION

Make sure the following jar files are in the classpath for the file jserv.properties:

- http_client.jar
- javax-ssl-1_2.jar
- jssl-1_2.jar

For example, the jssl-1_2.jar file should be included in a line such as:

> wrapper.classpath=C:\9iAS\jlib\jssl-1_2.jar

The location of this jar file on your file system may be different.

Note: http_client.jar, javax-ssl-1_2.jar, and jssl-1_2.jar are installed by default with Oracle9iAS Portal.

You must also make sure that the appropriate SSL library is configured in the operating system path.

- For Windows NT/2000:

  Add njssl8.dll to the OS path. For example,

      set path=%path%;$ORACLE_HOME/bin/njssl8.dll

- For Solaris:

  Add libnjssl8.so to the LD_LIBRARY_PATH. For example,

      setenv LD_LIBRARY_PATH ${ORACLE_HOME}/bin:${LD_LIBRARY_PATH}

      export LD_LIBRARY_PATH

### CREATING AN XML PROVIDER DEFINITION

This section explains how to create an XML provider definition for your URL-based portlet provider. You can configure provider-specific information like portlet title and portlet description in the XML file. This XML file is also where you specify the URL that gets displayed in your portlet.

1. Using a text editor, create a new XML provider definition.

   You may use the sample below (you must change the httpProxyHost, httpProxyPort, httpsProxyHost and httpsProxyPort values to your own proxy server and port; if you do not need a proxy server then remove those tags). Note that the pageUrl tag specifies the URL that gets displayed in the portlet. Please refer to the article Understanding the provider.xml for PDK-URL Services for an explanation of the required XML tags and their functions.

       <?xml version = '1.0' encoding = 'UTF-8'?>
       <?providerDefinition version="2.0"?>
       <provider class="oracle.portal.provider.v1.http.URLProvider">
          <session>true</session>
          <proxyInfo class="oracle.portal.provider.v1.http.ProxyInformation">
             <httpProxyHost>www-proxy.us.oracle.com</httpProxyHost>
             <httpProxyPort>80</httpProxyPort>
          </proxyInfo>
          <httpsProxyInfo class="oracle.portal.provider.v1.http.ProxyInformation">
             <httpsProxyHost>www-proxy.us.oracle.com</httpsProxyHost>
             <httpsProxyPort>80</httpsProxyPort>
          </httpsProxyInfo>
          <portlet class="oracle.portal.provider.v1.http.URLPortlet">
             <id>1</id>
             <name>UAL Home Page</name>
             <title>UAL Travel Web Site</title>
             <description>This portlet is to test Integration services using Secure UAL site</description>
             <timeout>100</timeout>
             <timeoutMessage>UAL timed out</timeoutMessage>
             <showEdit>false</showEdit>
             <showEditDefault>false</showEditDefault>
             <showPreview>false</showPreview>
             <showDetails>false</showDetails>
             <hasHelp>false</hasHelp>
             <hasAbout>false</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.URLRenderer">
                   <contentType>text/html</contentType>
                   <pageUrl>https://www.ual.com/</pageUrl>
                   <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>

2. Save the file as "provider.xml", making sure not to overwrite one of the PDK-Java or PDK-URL Services sample files of the same name.

   Remember the name of the directory where the file is saved as you will need this later. For example: C:\ssl\provider.xml

### CONFIGURING YOUR WEBSERVER

These steps describe how to configure the Oracle HTTP Server only. If you are using a third party listener, please take the appropriate steps.

1. Stop the Oracle HTTP Server.

2. Open the configuration file zone.properties

3. Under the Servlet Aliases section, register an alias, ual, for a new instance of the Provider Adapter servlet. This servlet will use the XML provider definition you have just created.

   For example, add the line:

       servlet.ual.code=oracle.portal.provider.v1.http.HttpProvider

4. Under the Aliased Servlet Init Parameters section, add settings for the provider_root and sessiontimeout parameters, making sure that provider_root points to the directory where you saved your provider.xml file.

   For example, add the line:

       servlet.ual.initArgs=provider_root=C:\ssl,sessiontimeout=1800000,debuglevel=1

   Note: If the debuglevel parameter is set to 1, you will activate a special "test page" feature which allows you to ensure that your provider is configured properly before you try and register it with a portal.

5. Save zone.properties.

6. Start the Oracle HTTP Server.

7. Access your provider's test page by entering into a browser the URL for the aliased servlet you just set up. For example:

       http://host.domain:port/servlet/ual

   Note: You will use this URL later when you register the provider on a portal.

8. Review the test page which displays information about your provider. If the test page is not displayed, carefully review the previous configuration steps.

### REGISTERING THE PROVIDER

Now that you have successfully tested your new alias. You will need to register a new provider that calls this alias. To perform these steps, go to the Oralce9iAS Portal Administrator tab, then click Add a Portlet Provider.

1. Register your new Provider:

   1. Name: MySSLProvider

   2. Display Name: My PDK-URL SSL Provider

   3. Timeout: 100

   4. Timeout Message: My PDK-URL SSL Portlet Timed Out

   5. Implementation Style: Web

   6. Provider Login Frequency: Never

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

2. Click on OK.

### ADDING THE PORTLET TO A PAGE

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

Now that you have successfully built your own SSL portlet using URL services, please look for future articles that will guide you through adding services to your portlet such as XML and HTML filtering, inline rendering of links, parameter passing, etc.

Here are some reference articles to help you better understand the architecture and technical details of PDK-URL Services:

> - A Primer on PDK-URL Services
> - Understanding PDK-URL Services Runtime
> - Understanding provider.xml for PDK-URL Services

Revision History:

- November 2001