Issue Details (XML | Word | Printable)

Key: JS2-149
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Ate Douma
Reporter: Ate Douma
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Jetspeed 2

Implementing PLT.7.1 PortletURL request parameter name and value encoding

Created: 15/Oct/04 09:07 PM   Updated: 17/Oct/04 11:48 PM
Return to search
Component/s: Container
Affects Version/s: 2.0-M1
Fix Version/s: 2.0-M1

Time Tracking:
Not Specified

Resolution Date: 17/Oct/04 11:48 PM


 Description  « Hide
Several weeks ago I started a discussion on the developers list concerning
"Handling encoding requirements for the Portal URL":
   http://nagoya.apache.org/eyebrowse/ReadMsg?listId=22&msgNo=17318

I proposed an initial solution which, after a good discussion, resulted in a radical new proposal from Raphaël Luta:
   http://nagoya.apache.org/eyebrowse/ReadMsg?listId=22&msgNo=17320

This, I have been working on for the last month bit by bit.

The resulting new URL encoding is a complete replacement of the current one which is based on the original Pluto code base.
The problem with the current version is, for the most part, the strong coupling between the several components involved,
making it very difficult to extend and maintain.
So, I rewrote it from scratch and have now a new Portlet URL encoding which is much smaller and easily extendable.

Furthermore it has several, partly new, configurable features:
- Choice where the state is maintained and to which extend:
  - all in the url (like Pluto does):
      o.a.j.container.state.impl.PathNavigationalState
  - windowstate and portletmode in the session (as the current J2 default):
      o.a.j.container.state.impl.SessionNavigationalState
  - all the state in the session, including last used request parameters (new):
      o.a.j.container.state.impl.SessionFullNavigationalState
- Choice where the state is encoded in the url:
  - as a single path info parameter (somewhat like the current encoding):
      o.a.j.container.url.impl.PathInfoEncodingPortalURL
  - as a single query string parameter (new):
      o.a.j.container.url.impl.QueryStringEncodingPortalURL
- Choice how the state is encoded (new):
  - currently one supplied implementation using Base64 encoding (thereby solving the specs requirements in one go):
      o.a.j.container.state.impl.JetspeedNavigationalStateCodec

All the above implementations can easily be replaced or enhanced as needed.
So, other portals embedding Jetspeed 2 can supply their own if needed, like J1/Fusion or Jahia.
Because the new default encoding reduces the navigational state to only one parameter, this is now a much easier and clearer task.

For J1/Fusion this *still* has to be done and will be worked on next week.

Configuring the new implementation is done in two locations:
- jetspeed-spring.xml:

  <!-- Navigational State component -->
  <bean id="org.apache.jetspeed.container.state.NavigationalStateComponent"
     class="org.apache.jetspeed.container.state.impl.JetspeedNavigationalStateComponent">
    <constructor-arg index="0"><value>org.apache.jetspeed.container.state.impl.SessionFullNavigationalState</value></constructor-arg>
    <constructor-arg index="1"><value>org.apache.jetspeed.container.url.impl.PathInfoEncodingPortalURL</value></constructor-arg>
    <constructor-arg index="2"><value>org.apache.jetspeed.container.state.impl.JetspeedNavigationalStateCodec</value></constructor-arg>
  </bean>

- jetspeed.properties:

  #----------------------------------------------------------------------------------
  # Portal URL NavigationalState Parameter Name (default: _ns)
  #----------------------------------------------------------------------------------
  portalurl.navigationalstate.parameter.name=_ns

Not implemented feature: gzipping the navigational state parameter before encoding in with Base64.
In his proposal, Raphaël suggested further optimizing the encoding of the navigational state using gzip.
I actually did implement that but it turned out that in almost no (or very unlikely situation like one letter repeated a 100x)
this resulted in an improvement/shorter url. So, I dropped this!

Restrictions now truly enforced:
In the current J2 code base there were a few PortletURL usages which won't work now anymore.
These are *not* restrictions of the implementation but of the Portlet Specification!
- Manipulating the created PortletURL:
  In a few instances, portlet request parameter values were modified *after* the PortletURL was created.
  This seemed a smart thing to do because the url could be reused that way.
  But, the Portlet Specification explicitly says NO on that:
    "Portlet developers should be aware that the string representation of a PortletURL may not be a well formed URL
     but a special token at the time the portlet is generating its content." (PLT.7.1)
  Because the whole navigational state (including request parameters) are now encoded in one Base64 encoded parameter,
  it is NOT possible anymore to modify a created url anymore.

- Using HTTP GET as form method when using QueryStringEncodingPortalURL:
  The Portlet specification is explicit on HTTP GET usage:
    "Because some portal/portlet-containers implementations may encode internal state as part of the URL query string,
     portlet developers should not code forms using the HTTP GET method." (PLT.7.1)
  When using the QueryStringEncodingPortalURL, HTTP GET forms will break a created PortletURL because the encoded
  navigational state (as stored as query string parameter) will be lost when using HTTP GET forms.




 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Ate Douma added a comment - 15/Oct/04 10:33 PM
Feature implemented.

Ate Douma added a comment - 17/Oct/04 01:57 PM
character encoding isn't handled properly yet.
Because the correct character encoding is determined in the CapabilityValveImpl, instantiating the PortalURL cannot be done yet from within the JetspeedRequestContext constructor.
A new Valve, PortalURLValveImpl is needed doing that, which thus must be invoked after the CapabilityValveImpl and at least before the ContainerValve.

The dependency of the AbstractPortalURL on RequestContext also poses problems with the integration in Fusion, so this dependency must be removed.

Ate Douma added a comment - 17/Oct/04 02:10 PM
Implemented needed changes with the help from Shinsuke Sugaya.

I'm leaving this issue open waiting for (his) confirmation it now works.

Ate Douma added a comment - 17/Oct/04 11:48 PM
I've got confirmation from Shinsuke that it now works (after one more small fix).