Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-16548

Clicking on "Add ... as a Search Provider" button in the search portlet does not add OpenSearch functionality to browser

    Details

      Description

      See forum posting http://www.liferay.com/community/forums/-/message_boards/message/8192264 for more details.

      The search portlet results displays a button "Add ... as a Search Provider" (where the ... represents the company web ID) that allows for OpenSearch functionality. Clicking on this button in Firefox gives me an error: "Firefox could not download the search plugin from ...", where ... is my domain name. Clicking on this button in Chrome does not do anything.

      To debug this, I look at the page source generated by calling the open_search_description.jsp jsp page directly and I notice there are 261 empty lines before the XML prolog (<?xml version="1.0" encoding="UTF-8"?>) in the XML results returned to the browser. However, placing empty lines before the XML prolog is a no-no because the XML prolog must be the first line of the XML document.

      Digging deeper, I then look at the Java source code file that is generated from the open_search_description.jsp file (again, this is on JBoss and deep under the work/ directory) and notice there are many out.write("\n") statements interspersed among the code, especially one sequence where over 200+ lines of out.write("\n") calls. Looking at the code, this seems to emanate from the portal-web/docroot/html/common/init.jsp file - from the jsp import page directives that are turned into out.write("\n"). This seems to cause the situation above.

      As a workaround, I tried setting the trimSpaces init-param value to true in $JBOSS_HOME/server/

      {configuration_name}

      /deployers/jbossweb.deployer/web.xml. I add the following in the jsp servlet section of the web.xml file among the other init-param elements:

      <init-param>
      <param-name>trimSpaces</param-name>
      <param-value>true</param-value>
      </init-param>

      This allowed me to add my site as an OpenSearch provider when I clicked on "Add ... as a Search Provider". However, there were two issues resulting from this:
      1. The OpenSearch functionality still did not seem to work - when I selected my site in Firefox as the OpenSearch provider, typed in a keyword and hit enter, no results were returned - actually, the browser just sent me to the guest home page. I looked into this and it seems as though there is no authentication token (p_p_id) in the URL generated - and that seemed to account for the no results. Is this a second, separate issue?
      2. Adding the trimSpaces option in the web.xml file introduced some issues in the pages. I've seen some weird looking page rendering - due to the trimSpaces affecting the generated Java from the compiled JSP. For example, the each portlet's configuration icon would be replaced with an options button instead.

      To replicate this issue, you can just use the sample 7 cogs website, search for a term, then click on "Add ... as a Search Provider".

        Attachments

          Activity

            People

            Assignee:
            support-lep@liferay.com SE Support
            Reporter:
            zzzz8 zzzz8 (Inactive)
            Participants of an Issue:
            Recent user:
            Esther Sanz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              9 years, 47 weeks ago

                Packages

                Version Package
                6.1.0 CE RC1