How to get Liferay current url that is being displayed in browser? - liferay

I have two portlets on a page "Portlet A" and "Portlet B".
The page has url http://localhost:8080/web/guest/page?p_p_id="Portlet A"...
Then I submit a form in "Portlet B" and try to get current url from PortalUtil like
PortalUtil.getCurrentURL(myRequest);//p_p_id="Portlet B"...
themeDisplay.getURLCurrent(myRequest);p_p_id="Portlet B"...
But in browser before submission I see url with p_p_id="Portlet A"...
Is there a way to get url that is being shown to user?

The link I was looking for is called Referer and points to the page where the request comes from.
Thanks to Tobias Liefke
In Liferay you can find it using portlerRequest.getHttpRequest().getHeader("Referer")

Related

Link to external URL from Modx Revolution Menu

I'm attempting to link to another site from the main navigation on my Modx Revolution 2.2.13-pl site.
I tried to create a weblink resource, but it simply loads up a page with the URL in the content of the page, then redirects to the homepage as if you had hit a page that did not exist.
Can anyone chime in on how to properly create a weblink in Modx?
Thanks.
Update: I am using a fully qualified URL to an external website.
Weblink setup:
HTML Output:
I tried to get a SS of what happens when you click the link, but it redirects too fast. It's basically my template with the resource title in H4, then the URL in the weblink field on the page as a link in the content area. Then it redirects to the homepage (which is our default 404 action)
This is works as expected. Compare with what you got.
Page:
Wayfinder output:

Pass a query string from the parent URL to a page viewer web part

This may be a simple question for SP2010, I am trying to get the query string from a page url and pass it to the url of a page viewer web part.
https://mysite.com/subsite/default.aspx?TeamID=X
The content in the page viewer webpart comes from a different site, but needs the TeamID.
https://othersite.com/page.htm?TeamID=X
I can set the query string manually in the page viewer url, but this is something that will be replicated many times, and I really want to find a way to set up the page viewer and not have to edit it each time I replicate the page.
Thanks in advance,
KB
You can do it by JS. There are some libraries for URL parsing to get value from URL. Then you can append that value to IFRAME's SRC attribute in your page. IFRAME is generated by page view webpart.

Detect if a page is a variation page (done using Visual Website Optimizer's (VWO) "Split URL test")

How can we detect if a page is a redirected page (variation page of VWO's split url test) or not?
Thank You!
You can check for the cookie set by the VWO. In case it is a Split URL test, you can check for the cookie named _vis_opt_exp_TESTID_split which tells that the page was redirected by VWO. The cookie would be created first time you are being sent to the variation URL.

How to get the URL history after redirecting to different databases?

I have a viewPanel on an xpage that links to documents in different databases. I am able to click links to open the documents.After submit the document, i want to redirect the url to the previous viewPanel. Now the problem is that i can't open the viewPanel again and the url history(context.getHistoryUrl) is blank for redirecting to different databases. Any tips on how to get the URL history?
If you are executing a context.redirecttopage to redirect the user you could change this code so that when you're update has finished the oncomplete is being executed and does a redirect clientside to the correct url. To compute the correct url you can use the code you gave in the answer to my comment.
more info here: http://xpag.es/?192E

Incorrect URL in browser using JSF 2.0

I'm creating login form using JSF 2.0. Below is the detailed description.
When I run the form, I get the login.xhtml
Once I get successfully logged in, I get page as temp1.xhtml and when I click the link (that I have created on temp1.xhtml page) I get temp2.xhtml page.
All is working perfectly... but the problem of URL which is described below...
When I successfully logged in, the browser still shows URL as login.xhtml instead if temp1.xhtml
when I click on the link that is on temp1.xhtml, I get temp2.xhtml page but the URL says temp1.xhtml instead of temp2.xhtml
Could any one help me to show the correct URL as I have to filter these pages and as URL is INCORRECT my filter is useless...
Please note that I am not using configuration file for directing the pages...
You have to add:
?faces-redirect=true in the end of the view that you are directing.
e.g:
return "mypage?faces-redirect=true"
you can also directly use it in the .xhtml files for example on page temp1.xhtml page in link use action="temp2?faces-redirect=true"

Resources