A clipper portlet is a portlet that renders content from another web site. A clipper portlet can include all or a subset of another web site’s content using a process called “web clipping.” This chapter explains how to create and configure clipper portlets.
This chapter includes these topics:
Clipping is an easy technique for including content in your portal. You can clip all or part of another web site. Users can effectively view and interact with content from another web site without leaving the portal.
Note that another WLP feature, the browser portlet, also lets you include remote web page contents in a portal. For information on browser portlets, see Browser Portlets. A clipper portlet differs from a browser portlet in the following ways:
You create a clipper portlet using the Portlet Wizard. The steps are similar to those of creating other types of portlets.
Note: | No post-processing is performed on the text of a clipped web page, unless a clipCustomClass preference is specified as described in Modifying the Appearance of a Clipper Portlet. Clipped text is written verbatim to the response. If the original web page contains syntax errors, the errors may also appear in the consumer browser when the clipper portlet is rendered. |
Note: | By default, the entire web site is included in the clipper portlet’s contents, including the <HEAD> element of the remote site. |
By setting certain portlet properties, you can change the appearance of a clipper portlet, subset the content of a web page that appears in a clipper portlet, and provide authentication. There are two primary ways to modify a clipper portlet’s properties: through the Properties editor and manually.
This section includes these topics:
You can use the Properties editor to edit the common set of portlet properties, such as the title bar and presentation properties. Clipper portlets share most of these properties with other types of portlets, and the procedure for changing them is the same. See Portlet Properties for detailed information on editing portlet properties through the Properties editor.
Clipper portlets also include a set of properties that do not appear in the Properties editor and which must be set manually. The easiest way to modify clipper portlet properties manually is to add and set them as portlet preferences.
Tip: | WLP provides preferences for controlling the extent of a clipped page and for authentication. See Modifying the Appearance of a Clipper Portlet and Authenticating a Clipper Portlet for specific information on those tasks. |
To set portlet preferences, do the following:
For more information on setting portlet preferences, see Portlet Preferences
You can set portlet preferences to specify which portion of a web page to clip. You can also modify the text that is clipped by implementing a Java class and specifying it as a portlet preference. Table 6-1 lists and describes the set of clipper portlet preferences that you may set manually to accomplish these tasks. For details on how to set preferences, see Modifying Clipper Portlet Properties.
Note: | The preferences clipXPath, clipStartText/clipEndText, and clipCustomClass (listed in Table 6-1) are exclusive. The system looks for clipCustomClass first. If that class is not present, the system looks for clipXPath. If clipXPath is not present, the system looks for clipStartText/clipEndText. |
This section explains how to configure authentication for a clipper portlet. Once configured, clipper portlet authentication is automatic. WebLogic Portal supports two kinds of clipper portlet authentication:
Both of these methods are described in this section.
Form-based authentication is performed through a server-side form request on the remote site. You configure this type of authentication by setting preferences on the portlet. The procedure for setting preferences is described in Modifying Clipper Portlet Properties.
Note: | There are current security limitations associated with form-based authentication. See Clipper Portlet Limitations. |
To set up form-based authentication:
The following preferences are used to provide the authentication credentials.
Listing 6-1 shows example preferences for form-based authentication.
<netuix:preference name="remoteUrl" value="http://some.site.com" modifiable="false"/>
<netuix:preference name="loginFormUrl" value="http://some.site.com/login.action" modifiable="false"/>
<netuix:preference name="authenticationType" value="Form" modifiable="false"/>
<netuix:preference name="loginFormMethod" value="POST" modifiable="false"/>
<netuix:preference name="loginFormUserParam" value="os_username" modifiable="false"/>
<netuix:preference name="loginFormPasswordParam" value="os_password" modifiable="false"/>
<netuix:preference name="loginFormExtraParams" value="os_destination=abc" modifiable="false"/>
<netuix:preference name="groupUsername" value="your_username" modifiable="false"/>
<netuix:preference name="groupPassword" value="your_password" modifiable="false"/>
To set up basic HTTP authentication:
Listing 6-2 shows example basic HTTP authentication preferences.
<netuix:preference name="authenticationType" value="BasicHTTP" modifiable="false"/>
<netuix:preference name="groupUsername" value="your_username" modifiable="false"/>
<netuix:preference name="groupPassword" value="your_password" modifiable="false"/>
This section explains how to configure the way clipper portlets rewrite navigable links and resource URLs.
This section includes these topics:
Navigable links, such as anchor links, can be configured as follows:
See URL Rewriting Configuration Techniques for more information.
Resource URLs point to images, stylesheets, scripts, and so on. You can configure a clipper portlet so that it either does or does not rewrite resource links so that they are proxied through the WLP server.
By default, resources are proxied, because cookies for clipped pages are stored on the WLP server. For example, if you clip a page behind a firewall, your browser will not have access to resources on the remote page. In this case, it is necessary to route resource requests through the WLP server. However, this proxying can affect WLP server performance; therefore, you have the option to turn proxying off if you don’t need it.
See URL Rewriting Configuration Techniques for more information.
You can configure the way URLs are rewritten by implementing a Java class called IClipperUrlFilter or by setting portlet preferences.
The SPI interface com.bea.netuix.clipper.IClipperUrlFilter is available for you to define your link rewriting rules. This interface has three methods, listed in Listing 6-3. Your implementation must have a no-argument constructor. You register your implementation with the portlet by using the urlFilter portlet preference. For example:
<netuix:preference name="urlFilter" value="my.package.MyUrlFilterImpl" modifiable="false"/>
For more information on setting portlet preferences, see Setting Clipper Properties Manually as Preferences and see Portlet Preferences in the Portlet Development Guide.
/** Should the url be reachable from the clipper portlet?
* If this method returns false, rewritten links containing this url will have
* empty values (for example, a link <a href="forbidden.site.com">
* would be rewritten to <a href="" >, and a request to clip this url would
* receive a 404 response.
*/
boolean allowUrl(String url);
/**
* Should the url be rewritten to stay within portal context? If this methods
* returns false, clicking on a link
* to this url will take the user straight to the target url, which will render
* the new page in the full browser, and not inside the clipper portlet.
*
* This method applies to navigable urls only: links in anchors, form actions,
* etc.
*/
boolean rewriteClickableUrl(String url);
/**
* For resource urls only, e.g. image, script, and style tags.
*
* Should the resource be proxied through the wlp server, or should the resource
* link point
* directly to the original resource in the remote page?
*/
boolean rewriteResourceUrl(String url);
If you don’t want to define your own class to control link rewriting, you can use these portlet preferences. For more information on setting portlet preferences, see Setting Clipper Properties Manually as Preferences and see Portlet Preferences in the Portlet Development Guide.
Note: | <netuix:preference name="allowedUrlRegex" value=".*allowedlink.*" modifiable="false"/> |
<netuix:preference name="proxyResourceUrls" value="false*" modifiable="false"/>
Suppose the clipped page has an image tag <img src="abc.com/myImage.gif"/>. If the proxyResourceUrls preference value is false, then the clipper page will have the exact same image link:
<img src="abc.com/myImage.gif"/>
But if the value is set to true, the link will look like this:
<img src="myportal.com?[BEA internal link representation]" />
This section discusses how to handle clipper portlets with HTTPS URLs.
When an HTTPS link is clipped, the link shows up as an HTTPS link in the portal page.
If you click on a clipped link that causes a redirect on the remote site from an HTTP URL to an HTTPS URL, the portal request is redirected from an HTTP URL to an HTTPS URL, as expected. However, note the following exception to this case: the initial request to the portal for a given browser session is never redirected to HTTPS. The following cases illustrate this exception:
The page www.xyz.com
has a link to xyz.com/mail
. This link points to http://mail.google.com/mail
, and clicking that link redirects you to https://www.google.com/accounts/ServiceLogin
.
If you clip http://www.xyz.com
into your portal at http://myportal.com
, start your browser, and click the mail link in your clipped portal, the portal request will be redirected to https://myportal.com
. The clipped page will be redirected to, for example, https://www.xyz.com/accounts/ServiceLogin
, and you will see that page.
If you clip http://mail.xyz.com/mail
, and you start your browser and open the portal, then you will not be redirected to HTTPS. The clipped page will still follow the redirect to, for example, https://www.zyz.com/accounts/ServiceLogin
, so the page contents will look fine, but the route from the browser to the WLP server will not use HTTPS. Note that the “Sign In” form on that page has an HTTPS action URL, so the action for the clipped form will point to https://myportal.com
.
Likewise, if you clip https://www.xyz.com/accounts/ServiceLogin
, and you start your browser and go to http://myportal.com
, then you will not be redirected to HTTPS on that initial request.
For WLS to make an HTTPS request to a site, it must have a certificate for that site in its keystore. If the certificate is not available, you will see exceptions such as:
[Security:090477]Certificate chain received from aaa.bbb.com - 10.123.45.67 was not trusted causing SSL handshake failure.
For detailed information on configuring SSL in WLS, see the WLS document Configuring Identity and Trust on e-docs. The basic steps to configure a clipper portlet to use HTTPS correctly are:
Tip: | One way to obtain the certificate is to use the Firefox plugin called “Cert Viewer Plus.” This plugin lets you view and save the security certificate. |
keytool -import -file my_certificate_file -keystore DemoTrust.jks -alias some_unique_alias
The alias value is an alias unique to that .jks file. You can view the aliases with the command:
If you click on links in a clipped web page, the only way to restore the original clipped URL is to restart your browser.
The clipper portlet comes with its own backing file. For detailed information on backing files, see Backing Files in the Portlet Development Guide.
To add your own backing file to a clipper portlet, do the following:
If you change the preferences for a clipper portlet in the .portlet
file, the changes are not picked up at runtime unless you set the following attribute in the WEB-INF/netuix-config.xml
file:
<propagate-preferences-on-deploy propagate-to-instances='true' master='file'/>
Preference changes that are made in the Administration Console are picked up automatically.
The following are known limitations on the clipper portlet feature. These limitations may or may not apply to future releases.