I see that when we extend this GenericPortlet class, there are methods like doHelp, doEdit, doView and processAction.
When I had gone through the tutorials on internet, I see that people using GenericPortlet don't bother to override the two methods doEdit and doHelp.
Please tell me, when and in which scenarios do we need to override these two methods (doEdit and doHelp), Is there any website that allows users to have these behaviours ??
Thank you for reading.
These 3 methods are part of the Portlet API (JSR168) .
The 'doHelp' method is conceptualized to show the user helpful information about how to use the portlet and it is render method implemented for HELP mode.
The 'doEdit' method is conceptualized for portlet configuration to personalize the portlet i.e. to specify user preferences and it is render method implemented for EDIT mode.
In real production this proposal isn't really optimal, hence portlet container's like Liferay have made their own concept for these things and don't use 'doHelp' and 'doEdit' methods.
For portlet configuration as used in liferay see this wiki.
Related
Fairly new to Liferay. I learned it is possible to create plugins UI with different frameworks including JSF. Also I learned I can extend functionality of an existing plugin with hooks. Now I am curious if it is possible to add new JSF pages to an existing plugin which interface is build with JSP using hooks?
Suppose I want to extend dynamic data list portlet, add some new functionality and for this I need to add new pages.
Is it possible to add new pages in general?
Can I create a new plugin with JSF as a front end framework, implement the logic I want to add within JSF pages, would it be possible to redirect a user from an original JSP to those JSF pages, let user do something there and then return the user back to original dynamic_data_list JPSs?
If it is possible, how can I do this with Liferay 6.2?
Thanks
The mechanics are documented in the developer guide or the Wiki. It's not exactly a hook that you deploy to the running system, rather a development option to inject custom changes into existing plugins, and you deploy the modified version instead of the original one.
With this, you can do everything that you can add as extra feature this way (see the build process). Technically the answer to the first two bulletpoints is "yes". If the linked documentation doesn't help answering your third bulletpoint, please ask more specifically what actually doesn't work. But keep in mind that only core liferay is customizable with hooks, plugins are customizable at compile time - and not with hooks.
Both files seem very similar, subsequently I'm struggling to understand their purposes.
I have seen faces-config referred to as a plain JSF controller, while adfc-config is an extended ADF controller.
Some clarification would be good, as right now I can't see why you would have both in an ADF application if that is the case, so I must be missing something.
adfc-config is different from faces-config
Faces Config is the controller of your application, it's what make JSF based frameworks work effectively, and it's where you will need to define your own customization like view handlers, converters, validators, etc...
adfc-config is just the main application unbounded Task Flow, which make it a little easier for developers to define their pages and main navigation root inside of it instead of doing it the JSF way and define them in faces config, it also provide additional functionality like defining managed beans which will have much more scopes than the original JSF given the ADF Framework additions, but still at the end it's just an Unbounded Task Flow. Here is the documentation reference about adfc-config.xml
adfc-config is used by the ADF Faces framework, when task flows are in the picture.
More information at: http://docs.oracle.com/cd/E23943_01/web.1111/b31974/taskflows.htm
Yes, you are right when you say that the functionality looks similar. Things like pageFlowScope / backingBeanScope / task flows / etc. are extensions to the standard JSF framework and require a custom configuration file.
So, if you create a project based on the Fusion WebApplication template, then you will see a default adfc-config.xml file entry.
Hope that helps.
In IBM Websphere for IPC, we have something called as Wiring which allows us to switch to the receiving portlet page in case you have your event receiving portlet to be on different page than that of source portlet.
I am wondering if there is any way to achieve this in Liferay.
I have also followed the link: Using JSR-268 IPC for portlets on different pages in Liferay but not clear about application-context.xml as I have created a simple Liferay plugin-portlet-project from Eclipse.
Yes it is possible. You just need to pass the Layout id, portlet id along with your parameters.
<liferay-renderURL var="varLink" plId="layout-id" portletName="portletName_WAR_WarName"/>
Wiring is Websphere Portal's concept.
Liferay is not supporting Wiring, but you can do Inter-portlet communication using public render parameters & portlet events ( in case of ACTION->View IPC).
In case when you need (VIEW->VIEW) IPC, you can use liferay's session sharing mechanism.
More details on my blog https://rutvijshah.wordpress.com/2009/12/13/liferay-session-sharing-made-easy/
I've been asked by a freelancer friend of mine to join him on a JSF 2.0 project, and I'm slowly picking up speed and putting the pieces together. Coming from a Windows Forms .NET world, I have a lot to learn to say the least.
My major concern is with the lack of apparent consensus on how to protect a JSF application.
Some methods have been proposed here on SO, including using Spring security, Seam security, custom phase listeners, or simply using the rendered="#{...}" attribute to show/hide components based on user authentication.
I have tried to implement some of these methods, for example Spring security, only to find out that it gets easily defeated by the JSF navigation mechanism that forwards to views instead of redirecting. In other words, Spring security will work fine if the user types in the url of a secured page directly, but not if a h:commandButton's action takes him there.
In view of this, some have suggested to force a redirect by using "faces-redirect=true", but we feel that this could become a performance issue as this causes 2 requests from the browser each time.
On the other hand, I gave up trying to implement Seam security after getting so many missing dependencies errors.
The best solution I have found so far is a custom phase listener from Duncan Mills - Effective Page Authorization In JavaServer Faces, but I'm not 100% convinced this should be used on public facing JSF applications.
So finally, what does this leave us with ? I know this is a pretty wide open ended question, but I honestly have no clue where to go next. I'm pretty sure I have followed the different tutorials to the letter, for example Spring tutorials, but I'm still not satisfied with the way it works.
Could anyone at least confirm/infirm the fact that Spring security is supposed to work across JSF forwards, as I've seen many posts by others having the same issue ? That would at least give me a direction to keep going.
Thank you.
Combination of servlet filter for page validation (applied to the faces servlet), identity session bean (storing user attributes e.g. Role, login id) and a few methods for entitlement checks (e.g. isAdmin(), canViewRecord(recordID)) well ised throughout your page.
You see, when it comes to security I opt for not leaving it in anybody else's hand. also, I validate in several places (hiding a component won't keep folks from forging the right POST request to trigger specific bean methods so watch out).
When I work with JSF I use spring-security.
About the behavior that you comment that spring security allows redirections done with commands button, is weird you must have a wrong configuration because it seams working fine in my project (I just tested).
In any case you can also use the spring security tags to render or not components according to the user's role.
This is a project that can help you to implement the tags.
http://www.dominikdorn.com/facelets/
Hope this helps..
I am trying to develop a portlet that has a domain class and database mapping for it done with ServiceBuider. Classes and numerous config files get generated fine, but deploying fails to exception (don't have them available right now).
Is ServiceBuilder supposed to work in liferay sdk 6.0.5 for ordinary Liferay portlets, or is it usable only for ext-plugins/hook-plugins/ liferay Internals? Am I missing some other undocumented restrictions/dependencies.
yup, ServiceBuilder is supposed to work from portlet plugins (and it definitely does). It's deprecated (but works) in ext plugin. See the KnowledgeBase Portlet from the plugins (svn-username: "guest", password is empty)
To find a solution for your problems it would really help to get the exact steps you do as well as the exact exception.