Foros de discusión

Virtual hosting breaks URLs in feeds

Bret Dawson, modificado hace 15 años.

Virtual hosting breaks URLs in feeds

New Member Mensajes: 8 Fecha de incorporación: 28/04/08 Mensajes recientes
Virtual hosting breaks URLs in feeds


Hi everybody. I'm using Liferay 4.4.2.

I've just enabled virtual hosting for the guest community, pointing it to the same domain as the overall web server host value. So things look like this in portal.properties:

web.server.host=www.example.com


...and in Manage top public pages for Guest :: Virtual Host, the field settings are like this:

Public Virtual Host : www.example.com

Private Virtual Host: [blank]

Friendly URL: /guest


Mostly this works great. the /web/guest string has disappeared just about everywhere.

But articles no longer work with the friendly URLs generated by feeds. Here are three cases.

------
1. If I make a new feed and give it the following values:

Target Page Friendly URL: /article
Target Portlet ID: 56_INSTANCE_ZsEY (This is the instance ID of the Journal Content portlet on /article)

...The feed appears to save correctly, but I cannot edit it. After a save, I get an empty portlet box labeled "Journal" at the top, with a "return to full page" link. It appears in the list of feeds, and I can delete it, but there's no way to edit it or discover its URL.

------
2. If I make a new feed using these values instead:

Target Page Friendly URL: /web/guest/article
Target Portlet ID: 56_INSTANCE_ZsEY

...The feed saves correctly, and I can edit it. The URLs it generates to link to articles all have this format:

/article/journal_content/56_INSTANCE_ZsEY/[[[groupID]]]/[[[articleID]]]

These URLs do not show the desired article. Instead they show the page with either an empty Journal Content portlet, or the article that's been manually inserted into that portlet, depending on whether one has been inserted. Changing the URL to add the /web/guest causes the correct article to appear in the correct portlet.

------
3. If I edit the feed to use these values:

Target Page Friendly URL: /web/guest/article
Target Portlet ID: [blank]

...The feed saves correctly, and generates URLs like this:

/article/journal_content/56/[[[groupID]]]/[[[articleID]]]

These URLs do show the desired article, but they do so with the Journal Content portlet maximized, so you can't see any of the other portlets on the page.


Now, I have two main goals here:

1. I want URLs for articles that do not contain '/web/guest'.
2. I want the articles to show up in a regular portlet, not a maximized one.


Can anybody help?


Thanks,

Bret
Bret Dawson, modificado hace 15 años.

More details about request parameters

New Member Mensajes: 8 Fecha de incorporación: 28/04/08 Mensajes recientes
Hi everybody. I'm beginning to suspect the problem has something to do with pieces of friendly URLs being forced to lowercase before they're turned into request parameters.

Here are four URLs, along with a description of the behaviour, along with a dump of request parameters for each one. Note that the only difference between the one that works and the one that doesn't is that the portlet instance is being forced to lowercase for the ones that don't work.

Any idea how I might change this?

Thanks,

Bret



------
/article/journal_content/56_INSTANCE_ZsEY/10102/14456
SHOWS WRONG (DEFAULT) ARTICLE ON REGULAR PAGE

p_l_id: 16400
_56_instance_zsey_struts_action: /journal_content/view
_56_instance_zsey_articleId: 14456
p_p_mode: view
p_p_state: normal
p_p_id: 56_instance_zsey
_56_instance_zsey_groupId: 10102
p_p_action: 0


------
/web/guest/article/journal_content/56_INSTANCE_ZsEY/10102/14456
WORKS!

p_l_id: 16400
_56_INSTANCE_ZsEY_struts_action: /journal_content/view
p_p_mode: view
_56_INSTANCE_ZsEY_articleId: 14456
p_p_state: normal
p_p_id: 56_INSTANCE_ZsEY
_56_INSTANCE_ZsEY_groupId: 10102
p_p_action: 0

------
/article/journal_content/56/10102/14456
SHOWS CORRECT ARTICLE MAXIMIZED

p_l_id: 16400
p_p_mode: view
_56_INSTANCE_0000_groupId: 10102
_56_INSTANCE_0000_struts_action: /journal_content/view
p_p_state: maximized
p_p_id: 56_INSTANCE_0000
p_p_action: 0
_56_INSTANCE_0000_articleId: 14456


------
/article/journal_content/56_INSTANCE_0000/10102/14456
SHOWS WRONG (DEFAULT) ARTICLE on regular page

_56_instance_0000_groupId: 10102
p_l_id: 16400
_56_instance_0000_struts_action: /journal_content/view
_56_instance_0000_articleId: 14456
p_p_mode: view
p_p_state: normal
p_p_id: 56_instance_0000
p_p_action: 0
José Agustín Martínez de la Mata, modificado hace 15 años.

RE: More details about request parameters

Junior Member Mensajes: 37 Fecha de incorporación: 29/01/09 Mensajes recientes
Bret Dawson:
Hi everybody. I'm beginning to suspect the problem has something to do with pieces of friendly URLs being forced to lowercase before they're turned into request parameters.

Here are four URLs, along with a description of the behaviour, along with a dump of request parameters for each one. Note that the only difference between the one that works and the one that doesn't is that the portlet instance is being forced to lowercase for the ones that don't work.

Any idea how I might change this?

Thanks,

Bret



------
/article/journal_content/56_INSTANCE_ZsEY/10102/14456
SHOWS WRONG (DEFAULT) ARTICLE ON REGULAR PAGE

p_l_id: 16400
_56_instance_zsey_struts_action: /journal_content/view
_56_instance_zsey_articleId: 14456
p_p_mode: view
p_p_state: normal
p_p_id: 56_instance_zsey
_56_instance_zsey_groupId: 10102
p_p_action: 0


------
/web/guest/article/journal_content/56_INSTANCE_ZsEY/10102/14456
WORKS!

p_l_id: 16400
_56_INSTANCE_ZsEY_struts_action: /journal_content/view
p_p_mode: view
_56_INSTANCE_ZsEY_articleId: 14456
p_p_state: normal
p_p_id: 56_INSTANCE_ZsEY
_56_INSTANCE_ZsEY_groupId: 10102
p_p_action: 0

------
/article/journal_content/56/10102/14456
SHOWS CORRECT ARTICLE MAXIMIZED

p_l_id: 16400
p_p_mode: view
_56_INSTANCE_0000_groupId: 10102
_56_INSTANCE_0000_struts_action: /journal_content/view
p_p_state: maximized
p_p_id: 56_INSTANCE_0000
p_p_action: 0
_56_INSTANCE_0000_articleId: 14456


------
/article/journal_content/56_INSTANCE_0000/10102/14456
SHOWS WRONG (DEFAULT) ARTICLE on regular page

_56_instance_0000_groupId: 10102
p_l_id: 16400
_56_instance_0000_struts_action: /journal_content/view
_56_instance_0000_articleId: 14456
p_p_mode: view
p_p_state: normal
p_p_id: 56_instance_0000
p_p_action: 0


Hi all,

related to this post, although not exactly the same, we are trying to reuse a WEB page to show different Web contents depending on the parameters used to call it.

This page is composed of several portels, one of them being a Web Content Portlet. We do not want to pre-define the associated Web content in design time, but to dinamically change it, in order to use the same and only page to show different contents depending on the circumstances.

The specific data is:
- Target page: instalaciones_dinamica
- Web content portlet instance in this page: 56_INSTANCE_vxL4
- Id of a content to be shown (for example): 27329

We are constructing this string to call the page:
http://192.168.1.172:8080/web/guest/instalaciones_dinamica?_56_INSTANCE_vxL4_articleId=27329&p_p_mode=view&p_p_state=normal&p_p_id=56_INSTANCE_vxL4&p_p_action=0&_56_INSTANCE_vxL4_struts_action=%2Fjournal_content%2Fview

The page is shown, but the Web Content portlet remains empty. What's wrong (or missing) in the previous call? Or simply this way of working is not possible in LifeRay?

Thanks in advance for your help.
Regards.
Bret Dawson, modificado hace 15 años.

Got it to work!

New Member Mensajes: 8 Fecha de incorporación: 28/04/08 Mensajes recientes
Hi once again.

OK, so I've made a tiny change to one of the source files in our extension environment, and now it works for us. Just so I'm clear, was this forcing URLs to lowercase just meant to correct for sloppy typing in hand-entered addresses?

Here's the change I made before saving the file to ext-impl/com/liferay/portal/servlet/filters/virtualhost/VirtualHostFilter.java

(Line 156)
// String friendlyURL = httpReq.getRequestURI().toLowerCase();

String friendlyURL = httpReq.getRequestURI();


Could somebody let me know if this is a bad idea?

Thanks,

Bret
José Agustín Martínez de la Mata, modificado hace 15 años.

RE: Got it to work!

Junior Member Mensajes: 37 Fecha de incorporación: 29/01/09 Mensajes recientes
Hi all,

related to this thread, although not exactly the same, we are trying to reuse a WEB page to show different Web contents depending on the parameters used to call it.

This page is composed of several portels, one of them being a Web Content Portlet. We do not want to pre-define the associated Web content in design time, but to dinamically change it, in order to use the same and only page to show different contents depending on the circumstances.

The specific data is:
- Target page: instalaciones_dinamica
- Web content portlet instance in this page: 56_INSTANCE_vxL4
- Id of a content to be shown (for example): 27329

We are constructing this string to call the page:
http://192.168.1.172:8080/web/guest/instalaciones_dinamica?_56_INSTANCE_vxL4_articleId=27329&p_p_mode=view&p_p_state=normal&p_p_id=56_INSTANCE_vxL4&p_p_action=0&_56_INSTANCE_vxL4_struts_action=%2Fjournal_content%2Fview

The page is shown, but the Web Content portlet remains empty. What's wrong (or missing) in the previous call? Or simply this way of working is not possible in LifeRay?

Thanks in advance for your help.
Regards.