5 Replies Latest reply on Dec 10, 2009 11:20 AM by mwringe

    Nice/human-readable Urls inside a portlet

      Hello,

      is it possible to have nicer urls inside a portlet? The urls generated by <portlet:actionUrl> are rather long, e.g.:


      http://localhost:8080/portal/private/classic/home?portal:componentId=e141b805-42cd-4c10-963c-9d599cadb517&portal:type=render&portal:isSecure=null&portal:windowState=normal&portal:portletMode=view&navigationalstate=JBPNS_rO0ABXdVABNzdHJ1dHMucG9ydGxldC5tb2RlAAAAAQAEdmlldwAVc3RydXRzLnBvcnRs ZXQuYWN0aW9uAAAAAQAQL3ZpZXcvdmlldy9pbmRleAAHX19FT0ZfXw**


      I have the problem that the links to a specific page inside the portlet is too long to post in a forum or send to a friend. I think the exoPortal Forum has also the same problem:
      http://www.exoplatform.com/portal/public/website/community/forum
      When I want to get a link to a sub-forum or even to a specific post, then the link is very cryptic and long, instead of something like this:
      http://mycompany.com/forum/subforum/showPost?postId=4532

      What is that "navigationalstate" in the url? Can it be removed?
      This componentId seems to be a generated number. Could I set this componentId to something meaningful?


        • 1. Re: Nice/human-readable Urls inside a portlet
          mwringe

           


          What is that "navigationalstate" in the url? Can it be removed?


          It contains the various parameters set for the url as a string representation. If your url doesn't set any parameters, this value should not occur as part of the url.

          It is needed and should not be removed.


          This componentId seems to be a generated number. Could I set this componentId to something meaningful?


          The componentId is generated by the portal and needs to be unique. I don't see any option in the admin ui to set the componentId to a specific value.
          If anyone knows of a way to set this please reply.







          • 2. Re: Nice/human-readable Urls inside a portlet
            theute

            Matt,

            We should be able to remove:

            portal:type=render&portal:isSecure=null&portal:windowState=normal&portal:portletMode=view

            in most cases though as those are kind of 'defaults'

            wdyt ?

            • 3. Re: Nice/human-readable Urls inside a portlet
              mwringe

               

              "thomas.heute@jboss.com" wrote:

              We should be able to remove:

              portal:type=render&portal:isSecure=null&portal:windowState=normal&portal:portletMode=view

              in most cases though as those are kind of 'defaults'


              Hmm, yes, we could not specify the default values, which would make the urls a bit more manageable in the default case.

              We could also do what what done in JBoss Portal and compress the information down even further. Something like the PortalRequestEncoder and PortalRequestDecoder
              http://anonsvn.jboss.org/repos/portal/branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java


              • 4. Re: Nice/human-readable Urls inside a portlet

                 

                It is needed and should not be removed.

                Okay, then it is clear, why I got an exception, when removing the navigationstate in the browser url. Here is the exception from log file:

                10.12.2009 16:30:50 org.exoplatform.webui.core.UIApplication processAction
                FATAL: Error during the processAction phase
                java.lang.IllegalArgumentException
                at org.gatein.pc.api.StateString.create(StateString.java:104)
                at org.exoplatform.portal.webui.application.UIPortletActionListener$RenderActionListener.execute(UIPortletActionListener.java:603)
                at org.exoplatform.webui.event.Event.broadcast(Event.java:89)
                at org.exoplatform.portal.webui.application.UIPortletLifecycle.processAction(UIPortletLifecycle.java:131)
                at org.exoplatform.portal.webui.application.UIPortletLifecycle.processAction(UIPortletLifecycle.java:54)
                at org.exoplatform.webui.core.UIComponent.processAction(UIComponent.java:124)


                It contains the various parameters set for the url as a string representation.

                I thought that such information/parameters are stored inside the session, which itself is identified by the _jsessionid. And the sessionid should be transfered in the background and not in the url, or ?!
                BTW, in my case this is only a normal link, I set no GET parameters, so why there is this navigationState? The exoPlatform Forum has also normal links, e.g. to the subforum "Installation" and there is also no navigationState in the url:
                http://www.exoplatform.com/portal/public/website/community/forum?portal:componentId=forum&portal:type=action&portal:isSecure=false&uicomponent=UIBreadcumbs&op=ChangePath&objectId=forumab6f150ec0a8020100e60e7b621fb68a


                The componentId is generated by the portal and needs to be unique. I don't see any option in the admin ui to set the componentId to a specific value.

                There must be a way to specify the componentId, because as you can see from the link above (copy from exoPlatform Forum) the componentId is "forum".

                @thomas: I have tried to remove these values which you mentioned in the browser url and hit . And it seems to work. A character decrease of 90 characters.

                • 5. Re: Nice/human-readable Urls inside a portlet
                  mwringe

                   


                  I thought that such information/parameters are stored inside the session, which itself is identified by the _jsessionid. And the sessionid should be transfered in the background and not in the url, or ?!


                  You can also set them as part of the url. See javax.portlet.BaseURL.setParameter