«Copyright © 2011, Oracle and/or its affiliates. All rights reserved. The goal of this module is to teach you about functionality introduced in ...»
Creating and Consuming Pagelets with the
Oracle WebCenter Pagelet Producer
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
The goal of this module is to teach you about functionality
introduced in Oracle WebCenter 11g R1 (18.104.22.168), commonly
referred to as PS3. The product will be rebranded as Oracle
WebCenter Portal in PS5 (22.214.171.124).
For more information, visit Oracle WebCenter Portal
(http://www.oracle.com/us/products/middleware/webcenter/index.html) on the Oracle Technology Network (OTN).
1-2 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
After completing this module, you should be able to:
• Use the Pagelet Producer to create, edit, delete, and deploy resources and pagelets
• Add pagelets to web applications in a variety of scenarios, including standard web pages, portal pages, Oracle JDeveloper and Oracle WebCenter Spaces 1-3 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
The Oracle WebCenter Pagelet Producer 1-4 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
What Is the Oracle WebCenter Pagelet Producer?
The Oracle WebCenter Pagelet Producer brokers transactions between client computers and external resources. This
configuration allows you to:
• Proxy internal web applications to external addresses
• Manage authentication
• Expose functionality from internal applications that are on a private network or not readily accessible via web technology
• Transform proxied web applications, including URL-rewriting
• Add, remove and modify functionality from the external resource at runtime
• Consume WSRP portlets in Oracle WebCenter applications Benefits to this configuration include dynamic functionality and personalization, security and performance.
1-5 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
What Is the Oracle WebCenter Pagelet Producer?
The Oracle WebCenter Pagelet Producer allows you to publish content from back-end applications via pagelets.
A pagelet is a reusable UI component that can run on any web page or web application.
Using the Pagelet Producer, you can:
• Add content and functionality from existing back-end applications to any web page on any platform
• Integrate external content into any portal 1-6 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
2. Using the Pagelet Producer Console:
Creating and Configuring Resources, Pagelets, Injectors and Parsers 1-7 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Pagelet Producer Console The Pagelet Producer Console is a browser-based administration UI used to register resources and pagelets, manage proxy and transformation settings, and more.
To launch the Pagelet Producer Console, navigate to http://host_name:port_number/pageletadmin/ in your browser.
The console allows you to configure the Pagelet Producer and
create the following objects:
• Parser 1-8 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Configuring Pagelet Producer Settings The Settings section in the Pagelet Producer Console includes important options that affect all resources and pagelets.
• Logging: Set logging levels for individual Pagelet Producer components.
• Proxy: Configure HTTP proxy access (URL, user name and password) and define a semicolon-separated list of URLs that will not be proxied.
• Transform: Define the path to the credential vault provider and configure secure and insecure ports.
1-9 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Creating a Resource To create a new resource, select Resources from the dropdown list, choose any existing resource in the navigation pane, and click the Create icon (“+”) in the toolbar.
Destination URL: A relative URL that defines the endpoint in the Pagelet Producer proxy URL space where the proxied content will be presented.
URL Rewriting: The Pagelet Producer will rewrite all URLs in the proxied application that begin with the source URL prefix to point to the destination URL prefix.
1 - 11 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Oracle WebCenter Pagelet Producer Proxy Warnings and Best Practices
• Configure the proxy carefully so users are not given direct access to unprotected private content.
• The Pagelet Producer transforms any URLs that use the Internal URL prefix configured for the resource unless URL Rewriting is deselected in the Resource editor.
• Static images and other binary data should be stored on a separate server so they are not proxied.
• To prevent unintentional transformation, encode all headers that are URLs.
– In JSP, use response.encodeURL() – In.NET, use HttpUtility.URLEncode 1 - 12 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Resource Settings: Policy Policy settings limit access to the proxied resource to specific roles within Oracle WebCenter, configured in Oracle WebLogic Server.
• Enter the roles that should be allowed unauthenticated access to the resource. All other users will be prompted for credentials.
• If no roles are entered on this page, the resource will allow unauthenticated (“anonymous”) access to all users.
You can customize which headers are passed to the back-end application and from the back-end site to the browser.
To block Request or Response header elements, click Create and specify the header name.
Once you have configured a resource, you can create pagelets within the resource.
To create a pagelet, select the Pagelets section under the resource and click the Create icon (“+”) in the toolbar.
URL Suffix: The relative path to the pagelet. Do not include the Source URL prefix entered for the resource.
Refresh Inline enables refreshing the pagelet without reloading the page that hosts the pagelet.
On the Preferences page, enter relative URLs to any preference pages required by the pagelet.
Choose the preference level for the preference page:
• Global preferences apply to all instances of the pagelet in all pages.
• Customize preferences apply to a single instance of the pagelet in all users‟ pages.
• Personalize preferences apply to a single instance of the pagelet in a single user‟s page.
1 - 19 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Pagelet Settings: Preferences and Parameters On the Parameters page, enter the Payload Schema or Parameters that should be passed to the pagelet.
For parameters, specify the name, whether or not the
parameter is required, the data type, and the transport type:
• Request Parameters are added to the HTTP request and apply to all instances of a pagelet.
• Administrative, Community and Pagelet Preferences are used in Oracle WebCenter Interaction.
1 - 20 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Pagelet Settings: Clipper The Clipper allows you to create a pagelet by clipping a portion of a web page in a proxied application. Clipping is done at runtime, so clipped content is retrieved each time the pagelet is displayed.
The Graphical Clipper allows you to select page content using a mouse-driven graphical tool. The Advanced Clipper allows you to define HTML tag names and attributes to describe the clipped.
1 - 22 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Injectors modify content at runtime, and insert content into a specified location in a proxied resource page.
To create an injector, select Injectors under the appropriate resource and click the Create icon (“+”) in the toolbar.
MIME Filter: Restricts the injector to specific types of content (text/HTML, text/CSS).
- Top inserts the content first in the page.
- Bottom inserts the content last in the page.
- Before/After/Replace: Inserts the content into the page relative to the entry specified in the provided field.
Custom Parsers allow you to supplement or change built-in logic for parsing content and finding URLs.
To create a parser, select Parsers under the appropriate resource and click the Create icon in the toolbar.
Parsers are implemented at runtime, allowing you to modify content dynamically for consumption in a pagelet.
1 - 28 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
3. Consuming WSRP Portlets
The Pagelet Producer can expose WSRP portlets as pagelets for use in WebCenter Portal applications, WebCenter Spaces, and third-party portals.
Note: To use this feature in the PS3 version of Oracle WebCenter, install patch 11809215.
When you register a WSRP producer in the Pagelet Producer Console, the new resource will be populated automatically with pagelets to represent the portlets associated with the WSRP endpoint.
1 - 30 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Consuming WSRP Portlets Register WSRP Endpoint (WSDL) In the Pagelet Producer Console, choose Producers from the dropdown menu.
The new producer is displayed with a list of the imported pagelets based on the WSRP portlets from the WSDL.
1 - 33 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Consuming WSRP Portlets When a producer is registered, a new resource is automatically created, and the imported WSRP portlets are imported into the associated Pagelets collection.
1 - 34 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
4. Adding Pagelets to Pages and Applications
Once you have deployed a pagelet, you can insert it into any
proxied or non-proxied web page using:
• REST The code to insert a pagelet into a page is provided on the Documentation page for the pagelet in the Pagelet Producer Console.
You can also drag and drop pagelets onto WebCenter Portal pages using Oracle JDeveloper and in Oracle WebCenter Spaces using Oracle Composer.
1 - 36 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
The injectpagelet interface includes the following attributes:
• iframe_options: Optional. Specifies whether to use an IFRAME.
To enable automatic resizing, set ifheight and ifwidth to „auto‟.
• payload: Optional. The XML payload to send with the request.
• params: The pagelet parameters in query string format.
• context_id: Optional. The external identifier of the pagelet instance. It must be an integer.
• element_id: Optional. The HTML element ID in which the pagelet content is injected.
• is_in_community: Optional. Specifies whether the pagelet is on a community (WebCenter Interaction) or group page.
1 - 37 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Adding a Pagelet to a Portal Page: REST http://proxy:port/inject/v2/pagelet/libraryname/pageletname?
The following parameters are defined for the pagelet inject URL:
• instanceid: Optional. The instance ID of the pagelet.
• content-type: The return type:
– html: Returns pagelet markup with PTPortlet object.
– iframe: Returns an iframe filled with the pagelet content.
• csapi: Whether the CSAPI will be included with the pagelet response.
• onhttperror: How error codes will be displayed:
– comment: Replaces pagelet with HTML comment error code.
– inline: Replaces pagelet with error code and server error page.
– fullpage: Replaces entire page with HTTP error information.
1 - 38 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Adding a Pagelet to a JSF Page in JDeveloper Register the Pagelet Producer Before you can add a pagelet to a JSF page, you must register the Pagelet Producer with your WebCenter Portal application using the Resource Palette.
In the Application Resources panel, right-click Connections, choose New Connection and then choose Pagelet Producer.
Enter a name for the producer and the URL to the Pagelet Producer (in the format http://hostname:portnumber) 1 - 39 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Adding a Pagelet to a JSF Page in JDeveloper Adding the Pagelet to the Page In JDeveloper Design View, you can drag and drop pagelets onto a JSF page. In the Application Resources of the Application Navigator, expand the Pagelet Producer to display its contents.