BEA Logo BEA WebLogic Portal Release 4.0

  BEA Home  |  Events  |  Solutions  |  Partners  |  Products  |  Services  |  Download  |  Developer Center  |  WebSUPPORT

 

   WebLogic Portal Documentation   |   Building Personalized Applications   |   Previous Topic   |   Next Topic   |   Contents   |   Index

Foundation Classes and Utilities

 

The Foundation is a set of miscellaneous utilities to aid JSP and Java developers in the development of personalized applications using the WebLogic Personalization Server. Its utilities include JSP files and Java classes that JSP developers can use to gain access to functions provided by the server, and helpers for gaining access to the Advisor services.

This topic includes the following sections:

 


Webflow

The Webflow mechanism externalizes a site's page flow and separates back-end processing activities from presentation. Both the flow of pages and the underlying business processing are configured in centralized XML files, making it easier than ever to maintain or modify the behavior of your Web site. Out-of-the-box, the Webflow mechanism comes with a number of components to get you started, but the Webflow can also be customized or extended to meet your specific objectives. For more information about the Webflow implementation in the WebLogic Portal and WebLogic Personalization Server, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline documentation.

 


HTTP Handling

Both the <pz:div> and <pz:contentselector> tag implementations send HttpRequest and Session information to the Advisor.

The tags utilize helper classes that transform an HttpRequest and Session into serializable personalization surrogates for their HTTP counterparts. These surrogates are compatible with the Rules Engine which uses these objects to execute classifier and content selector rules.

 


Personalization Request Object

In order to use HttpRequest parameters in requests to the rules service, they must be wrapped in a Personalization Request object (com.bea.p13n.http.Request) before they can be set on the appropriate AdviceRequest. (See the Javadoc API documentation.) While the HttpRequest object can be wrapped by directly calling the Personalization Request constructor, it is recommend that developers use the createP13NRequest helper method on Request for this purpose. See the Javadoc API documentation for more information.

Caution: The tag implementations for the <pz:div> and <pz:contentSelector> tags create the Personalization Request surrogate for the HttpRequest before calling the Advisor bean, so JSP developers need not worry about the details of the Request object. Only developers accessing the Advisor bean directly need to wrap the HttpRequest object explicitly.

In order to avoid confusing results on getProperty method calls, developers need to know the algorithm used in the getProperty method implementation for determining the value of the property requested. When the Request's getProperty method is called (for example, by a rules engine), the system uses the following algorithm to find the property:

  1. The getProperty method first looks in the HttpRequest's attributes for the property.

  2. If not found, getProperty looks for the property in the HttpRequest parameters.

  3. If not found, getProperty looks in the HTTP headers.

  4. If not found, getProperty looks in the Request methods (getContentType, getLocale, etc.).

  5. If not found, getProperty uses the propertySet parameter to find a property set for a Request property set name and, if the property set is found, uses the default value in the schema.

  6. If not found, getProperty uses the default value passed into the method call.

Default Request Property Set

For Rules developers to write rules for classifier rules that contain conditions based on an HttpRequest, there must be a property set defined for the HttpRequest. By default, WebLogic Personalization Server ships with a default request property set for the standard HttpRequest properties. Developers adding properties to the request programmatically will need to add those properties to the default property set in order for them to be available to the E-Business Control Center and the Rules Manager.

The default Request properties include the following:

Request Property Name

Associated Request Method

Request Method

request.getMethod()

Request URI

request.getRequestURI()

Request Protocol

request.getProtocol()

Servlet Path

request.getServletPath()

Path Info

request.getPathInfo()

Path Translated

request.getPathTranslated()

Locale

request.getLocale()

Query String

request.getQueryString()

Content Length

request.getContentLength()

Content Type

request.getContentType()

Server Name

request.getServerName()

Server Port

request.getServerPort()

Remote User

request.getRemoteUser()

Remote Address

request.getRemoteAddr()

Remote Host

request.getRemoteHost()

Scheme

request.getAuthType()

Authorization Scheme

request.getScheme()

Context Path

request.getContextPath()

Character Encoding

request.getCharacterEncoding()

 


Personalization Session Object

In order to use HTTP Session parameters in requests to the rules service, they must be wrapped in a Personalization Session object (com.bea.p13n.http.Session) before they can be set on the appropriate AdviceRequest. (See the Javadoc API documentation). While the HttpSession object can be wrapped by directly calling the Personalization Session constructor, using the createP13NSession helper method on Session is recommended. See the Javadoc API documentation for more information.

The tag implementations for the <pz:div> and <pz:contentselector> tags create the Personalization Session surrogate for the HTTP Session before calling the Advisor bean, so JSP developers need not worry about the details of the HttpSession object. Only developers accessing the PersonalizationAdvisor bean directly need to wrap the HttpSession object explicitly.

Default Session Property Set

For Rules developers to write rules that contain conditions based on an HTTP session, there must be a property set defined for the HTTP session. WebLogic Personalization Server ships with a default session property that contains no values set as a placeholder. There are no default Session property set values. Developers adding properties to the session programmatically will need to add those properties to the default property set in order for them to be available to the E-Business Control Center and the Rules Manager.

The Personalization Session uses the following algorithm to find a property:

  1. It first looks in its own cloned HTTP Session properties.

  2. If it does not find the property, it locates the property set for the Personalization Session for the propertySet method parameter.

  3. If it still does not find the property, it uses the propertySet parameter to find a property set for the Session property set name and, if the property set is found, uses the default value in the property set.

  4. If it still does not find the property, it uses the default value passed into the getProperty method call.

 


Utilities

You can see more detailed documentation for the utilities listed here in the Javadoc API documentation.

ContentHelper

ContentHelper simplifies the life of the developer using the Content Management component. Methods are provided to get an array of content given a search object, to get the length of a piece of content. Constants for the default Content and Document homes are also provided.

ExpressionHelper handles dealing with Expression, Criteria, and Logical objects. It contains methods for parsing query strings into Expressions, joining Expressions into Logicals, normalizing Expressions, changing Expressions, Logicals, and Criteria into Strings, and turning Expressions into String trees for debugging purposes.

TagSupportHelper

TagSupportHelper(com.bea.p13n.servlets.jsp) provides utility methods for working with the Advisor. It includes methods for creating AdviceRequests and for retrieving instances of the Advisor Service.

ProfileFactory

The ProfileFactory (com.bea.p13n.usermgmt.profile.ProfileFactory) utility is used to retrieve user and group profile information. The method getProfile(String username, String groupname) will return a ProfileWrapper object, which can then be queried for profile properties. If getProfile is called with only a username, a ProfileWrapper representing that user's profile will be returned. If it is called with only a groupname, a ProfileWrapper representing that group's profile will be returned. If it is called with both a user and group name, the returned ProfileWrapper will represent the user's profile, with the group's profile acting as an explicit successor. Each call to getProperty on the ProfileWrapper will use the group as an explicit successor unless a different successor is provided.

SessionHelper

SessionHelper(com.bea.p13n.usermgmt.SessionHelper) is used as a single access point to store and retrieve profiles in an HTTP Request or Session. It provides methods to put a ProfileWrapper in either a request or session using a well-known variable name, and a method to retrieve a ProfileWrapper from a request or session.

When retrieving the ProfileWrapper it will first look in the request, and then in the session. This utility can be used by different parts of an application to make sure that each component is dealing with the same profile. For example, a login component can use it to retrieve a profile and put it in the session; and later on a pipeline component can use it to access that same profile.

 

back to top previous page next page