Uploaded image for project: 'PUBLIC - Liferay Faces'
  1. PUBLIC - Liferay Faces
  2. FACES-245

Refactor the way in which Liferay portlet URLs are built



      The design followed in version 2.0.0 of the bridge was basically the following:
      1) Ask Liferay to create a URL via MimeResponse#createActionURL, #createRenderURL, or #createResourceURL
      2) Invoke the toString() method in order to let the Liferay PortalURLImpl#toString() method build up a string representation of the URL
      3) Perform a tremendous amount of processing in LiferayURLUtil.java in order to guarantee that URLs created during Liferay's RENDER_PHASE were the same as during the Liferay RESOURCE_PHASE.
      4) Return the resulting URL
      The amount of code in #3 was getting out of control, and FACES-244 was the straw that broke the camel's back. The number of special cases became too onerous and the code became impossible to maintain.
      Therefore it was necessary to take a different approach. Instead of doing #3 above, the bridge will now take creation of Liferay URLs into its own hands. This introduces some risk to the Liferay upgrade path, but the code in Liferay's PortletURLImpl.java class is quite mature and I don't expect it to change much. This new approach provides an opportunity for a great optimization too – Liferay's MimeResponse#createActionURL, #createRenderURL, and #createResourceURL will each be called only once during the JSF lifecycle, and the pertinent parts of the resulting toString() will be cached. For example, the http://hostname:port/context-path part will always be the same for every call. Information like that, the PortletMode, and WindowState can be cached for increased performance. And of course the last benefit is that the code will become maintainable again IMO.




            • Assignee:
              neil.griffin Neil Griffin
              neil.griffin Neil Griffin
              Participants of an Issue:
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created:


                Version Package