com.bea.portlet.transformation
Class PageHierarchyUrlTransformation

java.lang.Object
  extended by UrlCompression
      extended by com.bea.portlet.transformation.UrlTransformation
          extended by com.bea.portlet.transformation.PageHierarchyUrlTransformation

public class PageHierarchyUrlTransformation
extends UrlTransformation

Sample implementation of UrlTransformation. This particular implementation grabs the terminal page label, shown in the wlp url as _pageLabel=foo, and then climbing the page hierarchy to create a '/' separated path. For example, a url such as http://localhost:7001/urlTransformation/simple.portal?_nfpb=true&_pageLabel=Dime would get turned into: http://localhost:7001/urlTransformation/TheGreatestBookStore/Books/Pulp/Dime?_pageId=fa1


Constructor Summary
PageHierarchyUrlTransformation()
          Default constructor.
 
Method Summary
protected  void generateHierarchyRecursive(PagePresentationContext ppc, ArrayDeque<String> list)
          Climb the page tree recursively to the root page (book).
protected  String generatePageHierarchy(DesktopPresentationContext dpc, String terminalPageLabel)
          Create a string representing the page hierarchy, starting with the terminal page and then walking up the tree to the root book/page.
protected  Map<String,String> parseQueryString(String queryString)
          Parse the query string into name value pairs.
 String transformUrl(javax.servlet.http.HttpServletRequest request, String url)
          Transform a fully qualified wlp url into a format similar to the following.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageHierarchyUrlTransformation

public PageHierarchyUrlTransformation()
Default constructor. Initialize the cache. The cache is used so that the portal hierarchy does not need to be walked on every request.

Method Detail

transformUrl

public String transformUrl(javax.servlet.http.HttpServletRequest request,
                           String url)
                    throws UrlTransformationException
Transform a fully qualified wlp url into a format similar to the following. A url such as http://localhost:7001/urlTransformation/simple.portal?_nfpb=true&_pageLabel=Dime would get turned into: http://localhost:7001/urlTransformation/TheGreatestBookStore/Books/Pulp/Dime?_pageId=fa1

Specified by:
transformUrl in class UrlTransformation
Parameters
request - object that contains the request the client made of the servlet
url - the fully qualified wlp url.
Returns
the transformed url. It would similar to '/books/horror/stephen_king'.
Throws
com.bea.portlet.transformation.UrlTransformationException - wrapper exception for any exception that is raised.
UrlTransformationException - wrapper exception for any exception that is raised.

generatePageHierarchy

protected String generatePageHierarchy(DesktopPresentationContext dpc,
                                       String terminalPageLabel)
Create a string representing the page hierarchy, starting with the terminal page and then walking up the tree to the root book/page.

Parameters
dpc - The desktop presentation context for the portal.
terminalPageLabel - the page label that is referenced in the url.
Returns
a string representing the page hiearchy.

generateHierarchyRecursive

protected void generateHierarchyRecursive(PagePresentationContext ppc,
                                          ArrayDeque<String> list)
Climb the page tree recursively to the root page (book).

Parameters
ppc - The PagePresentationContext for the current page in the hierarchy.
list - the list to prepend the parent page definition

parseQueryString

protected Map<String,String> parseQueryString(String queryString)
Parse the query string into name value pairs.

Parameters
queryString - standard url query string.
Returns
Map - where the key is the request parameter and the value is the parameter value.


Copyright © 2011, Oracle. All rights reserved.