Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS-118500 Liferay unable to load Javascript resources when using a custom root context. | master #207

Closed

Conversation

samanzanedo
Copy link

Description:

Steps to reproduce:

  1. Change root context from '/' to another value. For example, changing it to 'myportal' in Tomcat would be:
  • Change the ROOT folder name (under LIFERAY_HOME/TOMCAT_HOME/webapps/ROOT) to 'myportal'.
  • Change the ROOT.xml file name (under LIFERAY_HOME/TOMCAT_HOME/conf/Catalina/localhost/) to 'myportal.xml'.
  • Clear temp and work directories under TOMCAT_HOME.
  1. On master: Enable JQuery. Thus, in osgi/configs/ directory create the file:
    com.liferay.frontend.js.jquery.web.internal.configuration.JSJQueryConfiguration.config
    with following content:
    enableJQuery="true"

  2. On 7.2: JQuery is enabled by default.

  3. Enter this URL in the browser http://localhost:8080/myportal/web/guest/home?p_p_id=com_liferay_login_web_portlet_LoginPortlet&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&saveLastPath=false&_com_liferay_login_web_portlet_LoginPortlet_mvcRenderCommandName=%2Flogin%2Flogin&js_fast_load=1

  4. Check in the browser, under developer tools, the request URL generated:

http://localhost:8080/myportal/myportal/combo?browserId=other&minifierType=js&languageId=es_ES&b=7210&t=1596526812119&/myportal/o/frontend-js-jquery-web/jquery/jquery.min.js&/myportal/o/frontend-js-jquery-web/jquery/bootstrap.bundle.min.js&/myportal/o/frontend-js-jquery-web/jquery/collapsible_search.js&/myportal/o/frontend-js-jquery-web/jquery/fm.js&/myportal/o/frontend-js-jquery-web/jquery/form.js&/myportal/o/frontend-js-jquery-web/jquery/popper.min.js&/myportal/o/frontend-js-jquery-web/jquery/side_navigation.js

Please, note that context 'myportal' appears twice in the URL.

Solution proposed:
Analysis from debugging shows that in
modules/apps/frontend-js/frontend-js-jquery-web/src/main/java/com/liferay/frontend/js/jquery/web/internal/servlet/taglib/JQueryTopHeadDynamicInclude.java, include() method, combo servlet URL is built using root context.
But next, absolutePortalURLBuilder object appends again root context -> and then we have the double context.

So, I consider the initial combo servlet URL should avoid to add the root context.

Best.
Sergio.

@liferay-continuous-integration
Copy link
Collaborator

To conserve resources, the PR Tester does not automatically run for every pull.

If your code changes were already tested in another pull, reference that pull in this pull so the test results can be analyzed.

If your pull was never tested, comment "ci:test" to run the PR Tester for this pull.

@jbalsas
Copy link

jbalsas commented Aug 5, 2020

ci:test:sf

@jbalsas
Copy link

jbalsas commented Aug 5, 2020

ci:test:relevant

@liferay-continuous-integration
Copy link
Collaborator

✔️ ci:test:sf - 1 out of 1 jobs passed in 3 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: 9b5ee1b6d26d88144f66ffc69789f81671914d14

Sender Branch:

Branch Name: LPS-118500-master
Branch GIT ID: 304b52d2e166f768d816b7627938de80730d8707

1 out of 1jobs PASSED
1 Successful Jobs:
For more details click here.

@liferay-continuous-integration
Copy link
Collaborator

@liferay-continuous-integration
Copy link
Collaborator

✔️ ci:test:stable - 21 out of 21 jobs passed

✔️ ci:test:relevant - 52 out of 52 jobs passed in 1 hour 57 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: 9b5ee1b6d26d88144f66ffc69789f81671914d14

Copied in Private Modules Branch:

Branch Name: master-private
Branch GIT ID: a4eb9471e502819c1cfc9d16ef0eea0078d40a10

ci:test:stable - 21 out of 21 jobs PASSED
21 Successful Jobs:
ci:test:relevant - 52 out of 52 jobs PASSED
52 Successful Jobs:
For more details click here.

@liferay-continuous-integration
Copy link
Collaborator

Copy link

@brunobasto brunobasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - Indeed AbsolutePortalURLBuilderImpl seems to already take into account the context path

@brunobasto
Copy link

ci:forward

@liferay-continuous-integration
Copy link
Collaborator

CI is automatically triggering the following test suites:

  •     ci:test:relevant
  •     ci:test:sf

The pull request will automatically be forwarded to the user brianchandotcom if the following test suites pass:

  •     ci:test:relevant
  •     ci:test:sf
  •     ci:test:stable

@liferay-continuous-integration
Copy link
Collaborator

Skipping previously passed test suites:
ci:test:relevant
ci:test:sf

@liferay-continuous-integration
Copy link
Collaborator

All required test suite(s) passed.
Forwarding pullrequest to brianchandotcom.

@liferay-continuous-integration
Copy link
Collaborator

Pull request has been successfully forwarded to brianchandotcom#92300

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants