WebSphere Portal - Retain friendly URL after Portlet Action/Render call - friendly-url

I have implemented friendly URL in WebSphere Portal 7.0. So lets say I have page with friendly URL "test" and a portlet added to the page. When I hit Portal URL /wps/myportal/test, the page is loaded with no junk characters(no state information). But as soon as I click on any button inside portlet(any action call to Portlet) I see that the junk characters comes back.
Is there a way to keep URL friendly all the time? How can we avoid generating junk characters on portlet action/render calls?
Note:- We have different portlets for different pages and they were developed based on different framework (Spring, Struts, JSR 286 etc)..

in 7.0 by default no, the action url is needed to tell portal what portlet to target. What you could do is use the resourceAction and do everything rest based and avoid the action url, or set up a servlet to handle actions for the portlet and handle urls through that as well in a rest manner.
You could also redirect after the action url back to a friendly url in your portlet code

Related

How to always show the same URL in JSF 2.0?

I'm making my term paper and I have some doubts in my way.
Now my main question is: how to always shoe the same URL to users using JSF 2.0 (Apache Tomcat 7, JSF 2.0, Java 6)?
I have dozens of pages, one of login, others with the features of my website, but I want that just one URL be showed to users. What I want is:
If user go to login page, the url will be:
mypage.com/
If user login with succesfull, the url will be:
mypage.com/
If user do any thing inside system, the url will be:
mypage.com/
Note that I always want "render" (this is the right meaning?) a different page, but show the same URL to user.
How I can do that? Page Forward?
Doesn't necessarily mean it's a bad thing to maintain your url static.
If you use page forward, you're currently in other url, even browser's address bar doesn't reflect that. With page redirect (POST-REDIRECT-GET pattern) you get the new url on it, however it requires one step more from http protocol point of view, so it's a bit slower. Both of them allow you going to an specific view with its url (bookmarkable app) and also are considered into JSF navigation case based system.
What actually could be considered a pitfall, but could be used depending on the case, is to have your application's main frame (could be the main template from JSF's point of view) in an url and just rerender some of its content via ajax. That doesn't allow you to have bookmarkable pages, however it could be even faster than performing a page forward if you're interested in maintaining many parts of your view with the same content.

Integerate JSP into Joomla as iframe

I have a Joomla (nginx + mysql) site running as UI and some JSP (tomcat + mysql) handling calculation logic.
I want to integrate JSP pages in to Joomla as iframe. I succeeded doing that, but the question is:
How do I make JSP pages NOT visitable to public but only visitable via Joomla site?
For example,
Joomla site is under mydomain.com/Joomla
JSP pages are under mydomain.com/JSP
When a user visit mydomain.com/JSP in the browser, the user cannot see the JSP page(see error or empty page instead).
But when the user open mydomain.com/Joomla in the browser and go to the page that contains the JSP site within an iframe, the user can see the JSP page there.
I am thinking about changing folder/file owner and permission. Am I on the right track? How should I approach exactly?
Thanks,
Milo
You need to change the way you're currently workin on.
1) Use composent JUMI to create virtual Joomla component based on your scripts.
2) On each page add this code at the very beginning of each of your scripts:
<?php
defined( '_JEXEC' ) or die ('Restricted Access');
?>
It'll prevent users for loading directly your scripts without any active Joomla session.

How to create addressable pages using JSF

Using the currrent version of Java EE, how do you create addressable web pages using Java Server Faces (JSF). That is, creating JSF pages that have a clean URL, so the page for the person entity with ID 1234 might be http://www.example.com/person/1234? It's clear enough to me how to service a clean URL using the Java API for RESTful web services (JAX-RS), but not how to do so for a JSF page, or how to combine the two.
A previous question I found suggests that doing so is not actually possible. Is that really so?
Use a URL rewriting solution like PrettyFaces. It uses basically a simple Filter under the covers which forwards the request from pretty to ugly URL and redirects the request from ugly to pretty URL based on some XML mapping file.
Related questions:
Bookmarkable URL in JSF application - Trying to use Spring Webflow and JSF . Any suggestions?
How to rewrite the URL
How do I configure JSF url mappings without file extensions?

Programmatically get the url of a page in liferay

I want to create a link in a portlet so that I can navigate to a different page in the liferay portal. I order to do that I am looking for an API (can be liferay specific) that given a page name, would return it's url (it can be the friendlyURL as well).
Portal pages in Liferay are indeed called Layouts in APIs and DB tables. They're identified by plid field, can be obtained using LayoutLocalServiceUtil and related APIs, and also from some other calls like themeDisplay.getLayout().
However in order to build String containing URL to a page you'll have to concatenate friendly URL of portal, group and layout itself (i.e. /web/guest/home - web is portal URL for public pages, guest is friendly URL of guest group by default and home is friendly URL of home page/layout by default). This can be tricky, as you have to check whether this is a public or private page, etc.
And once you start using virtual hosts with friendly URLs for groups, things change. So this is not a good way.
To avoid manually creating URLs and have URLs that are guaranteed to be correct you should use com.liferay.portal.util.PortalUtil.getLayoutFriendlyURL(Layout layout, ThemeDisplay themeDisplay) a static method of PortalUtil - it'll do all the necessary work for you. Though you also need to provide ThemeDisplay and not only Layout.
The API to access pages in Liferay is the LayoutService. However, page names are not unique in Liferay and furthermore they are internationalized. So you need some unique property for a page to retrieve its url, besides its name.
If you really only have the page name, you can use LayoutLocalServiceUtil.getLayouts(...) to loop over all Layouts and check for some property (in this case its name).
At least in Liferay 6.1.20 one can use 'Link Portlet URLs to Page' to make links proceed to antoher page in your portal. It is under ´look and feel´ menu item of your portlet. For me this works fine.
cheers
try this one for current url
${themeDisplay.getURLCurrent()}
try this one for portal url
${themeDisplay.getPortalURL()}

Liferay error page if at least one portlet is unavailable

I'm trying to setup a custom error page in Liferay portal if at least one portlet fails.
The portal always forwards to portlet_error.jsp and display a red zone in the portlet position.
How can I set a redirect or a forward to a page that fills the complete page layout?
Regards
Inside your JSP you can redirect to a page in Liferay, which can have just one portlet or the way you want it.
Or write your own servlet which in case of error redirects to page in liferay instead of a JSP
If the response is 404 then you can use this property in portal-ext.properties for add your custom page
layout.friendly.url.page.not.found=/html/portal/page_not_found.html

Resources