9 Replies Latest reply on Aug 26, 2007 6:06 AM by bvogt

    UserFriendly URLs: Can we have an '_' instead of '+' in port

    explorer

      Envi:
      2.6, 4.2, Oracle, Alfresco.

      I am trying to define user friendly URLs for portal pages.

      When i name a Portal page which gets added into the tab which has a space in it say something like "About Us"

      The value on the tab displays fine... But the url accessing it has the space replaced by '+', how can i replace that '+' say with an '_'

      Scenario in detail

      Page name under default portal, as defined in *-object.xml : About Us
      Page access url - current : /portal/defualt/About+Us
      Page access url - expecting : /portal/defualt/About_Us

      Please advice.
      Thanks in advance.

        • 1. Re: UserFriendly URLs: Can we have an '_' instead of '+' in
          soshah

          The 'Space' character being encoded as '+' is part of standard URL encoding rules set forth by the RFC 1738. see here for details: http://tools.ietf.org/html/rfc1738

          If you need your URL to have an '_' instead of '+', make sure the value being encoded is About_Us and not About Us


          btw- I am just curious why the '+' sign in the URL matters when the title itself shows the 'Space' character as you would expect. The '+' does get decoded back into 'Space' character when your server receives the request

          Hope this helps.

          Thanks

          • 2. Re: UserFriendly URLs: Can we have an '_' instead of '+' in
            theute

            Just to add to Sohil answer. You can name your page About_Us and localize it as "About Us" (see the doc)

            • 3. Re: UserFriendly URLs: Can we have an '_' instead of '+' in
              explorer

              Guys Thanks for the replies,

              But, my problem here is.

              1) the URLs should be user friendly. Precisely, users should be able to type in the URLs in the browser and go to a page.

              www.MySite.com/About_Us

              where if we find that its www.MySite.com/About+Us .. then thats not UserFriendly.

              2) Using Localization according to doc.
              If i had inferred correct, This would not hold good for pages being defined from Portal Admin interface.

              Apart from this there is one more issue....
              How can i set the title of a portal page/Portlet as html title.

              • 4. Re: UserFriendly URLs: Can we have an '_' instead of '+' in
                theute

                2) yes that's not possible from the admin interface.
                Then you need to write your own command mapper. The portal has to know on which page to go base on the URL.

                • 5. Re: UserFriendly URLs: Can we have an '_' instead of '+' in
                  bvogt

                  what is nesessary to integrate an own command mapper?

                  Do I have to re-compile the portal sources for this?

                  Thanks.

                  • 6. Re: UserFriendly URLs: Can we have an '_' instead of '+' in
                    explorer

                    Thanks guys... Well coming to command mapper is it a patter that we need to implement or is it hidden some where in the sources of the portal...

                    Also please advice me of how i can get to set the html title name either from a portlet or a portal page.

                    • 7. Re: UserFriendly URLs: Can we have an '_' instead of '+' in
                      bvogt

                      we have a solution based on portal 2.4 / AS 4.0.5...
                      ...luckily live, since yesterday evening...

                      In portal 2.4.1 (and hopefully in 2.6 too) you have to differentiate between page localization and page identification.
                      The name you edit in the management portlet is used for building the portal URLs.

                      With this kept in mind we did:

                      1. decided, that page names are treated as keys to be looked up in property files - all localization is done within this set of locaization files
                      2. provided a custom navigation portlet which retrieves the page name and localizes it
                      3. due to the lack of knowledge how to define a page interceptor for page related tasks... we set the localized page name into the portlet session with APPLICATION_SCOPE
                      4. in the theme's index.jsp we retrieve the localized page name out of the session and set it within the title tag.

                      Yes, you're right, 3. and 4. are somewhat like a hack, but it works...

                      • 8. Re: UserFriendly URLs: Can we have an '_' instead of '+' in
                        explorer

                        Thanks for the reply.

                        Well can you please advice me of how you were accessing the portlet session in the theme's index.jsp. A code snippet would greatly help.

                        • 9. Re: UserFriendly URLs: Can we have an '_' instead of '+' in
                          bvogt

                          Since your in a jsp, you cannot access the portlet session - in the meaning of the portlets individual session.

                          We do it the other way around:
                          The object is written to the session with visibility PortletSession.APPLICATION_SCOPE, which means that not only other porlets can access that attribute, servlets and JSPs can do that too.

                          In a jsp you do that by using the implicitly available object: 'session'
                          like:

                          <TITLE><%= session.getAttribute("localzedPageTitle"); %></TITLE>
                          


                          May be the following link is helpful:
                          http://java.sun.com/products/jsp/syntax/2.0/card20.pdf