The document discusses portlet resource serving in Liferay Portal using the Java Portlet Specification 2.0 (JSR 286). It provides an example of creating a JSP-based portlet that returns dynamic content via Ajax calls using the serveResource method. The portlet is configured to support resource serving and an Ajax script is included to make requests to the resource URL and display the response. Resource serving allows portlets to directly serve resources, interact via Ajax, and have access to portlet context and state information, addressing limitations of prior specifications.
Introduction to Portlets Using Liferay Portalrivetlogic
Rivet Logic's Costa Rica Developer's Forge presented this at a Costa Rica Java Users Group meeting. The presentation provides an introduction to portlets using Liferay Portal - including Portals and Portlets; Liferay Portal 6.0, Liferay SDK and Liferay IDE; Portlet 1.0 (JSR 168).
See what pitfalls companies are facing when running Liferay portal. In the previous year, our company has audited 5 real-life projects based on Liferay Portal which are now running in production mode and serving many users. The audits were focused on architecture, infrastructure, technical design and implementation. During the presentation, we will show you common anti-patterns we have found during the audits and their impacts and consequences on the portal.
Liferay Developer Best Practices for a Successful Deploymentrivetlogic
Liferay is one of the leading open source portals in today’s market. However, it’s more than just a portal, it’s also a framework. And with good frameworks, comes flexibility, and with flexibility comes the need to understand and follow best practices.
This webcast will share lessons learned and best practices gathered from some of our very own customer Liferay implementations. The presentation will cover the gamut of a Liferay implementation lifecycle.
Using Liferay Portal with LDAP and Single sign-onFirelay
During the 5th Liferay Netherlands user group meeting, Sander Bilo from the Firelay team (then Proteon) discussed during a lightning talk the benefits for a portal like Liferay, its users and administrators, to connect to a LDAP (like Active Directory) using a Single Sign-on server.
Introduction to Portlets Using Liferay Portalrivetlogic
Rivet Logic's Costa Rica Developer's Forge presented this at a Costa Rica Java Users Group meeting. The presentation provides an introduction to portlets using Liferay Portal - including Portals and Portlets; Liferay Portal 6.0, Liferay SDK and Liferay IDE; Portlet 1.0 (JSR 168).
See what pitfalls companies are facing when running Liferay portal. In the previous year, our company has audited 5 real-life projects based on Liferay Portal which are now running in production mode and serving many users. The audits were focused on architecture, infrastructure, technical design and implementation. During the presentation, we will show you common anti-patterns we have found during the audits and their impacts and consequences on the portal.
Liferay Developer Best Practices for a Successful Deploymentrivetlogic
Liferay is one of the leading open source portals in today’s market. However, it’s more than just a portal, it’s also a framework. And with good frameworks, comes flexibility, and with flexibility comes the need to understand and follow best practices.
This webcast will share lessons learned and best practices gathered from some of our very own customer Liferay implementations. The presentation will cover the gamut of a Liferay implementation lifecycle.
Using Liferay Portal with LDAP and Single sign-onFirelay
During the 5th Liferay Netherlands user group meeting, Sander Bilo from the Firelay team (then Proteon) discussed during a lightning talk the benefits for a portal like Liferay, its users and administrators, to connect to a LDAP (like Active Directory) using a Single Sign-on server.
An overview of liferay portal.
The outline is:
1.> Review Liferay Portal
– Enterprise Layer
– Extensions Framework
– Logical Architecture of Liferay
– Service layer
– Service Builder
– Web services
– Persistence Layer
– User Management: Organization, Site, User, Roles, Groups
2.> Out of the box features
– Document and Media Library
• Image Management
• Document Management
– Web Content Management
– Asset, Tagging, and Categorization
Liferay Italy Symposium 2015 Liferay Mobile SDK and Liferay ScreensDenis Signoretto
Liferay Italy Symposium 2015 Liferay Mobile SDK and Liferay Screens, Building and Android App with Liferay (Using Liferay as Mobile Backend and Screens for reusable mobile compoents)
Creating Better Customer and Employee Experiences with Liferay Portal and Cra...Crafter Software
Customer needs are ever increasing as they want information combined with the convenience of interacting with your brand when, where, and through whatever device they choose. Meanwhile, employees are demanding digital experiences that facilitate rapid information access, communication and enterprise collaboration.
To meet these demands, enterprises are turning to modern open source and cloud solutions like Crafter CMS to help deliver consistent and personalized experiences throughout the customer journey. And internally, they are adopting Liferay Portal to provide social intranet and collaboration solutions.
Rivet Logic and Crafter Software discuss:
* Business benefits of an integrated Liferay Portal and Crafter CMS solution along with common uses cases
* How Crafter CMS provides the foundation for your multi-channel digital experience approach
* Best practices to follow, and out of the box capabilities, for technology integration
* Customer success stories
* Live Demo
[DevDay2018] Liferay DXP – A powerful Enterprise Solution - By Vy Bui, Develo...DevDay.org
Liferay DXP is a Java-based open source Enterprise Portal Platform that is robust, flexible and easy to maintain. It is used around the world by governments, universities and other large enterprises such as Cisco and Rolex. In this session, you will learn what Liferay is and see step by step how to use some of the most popular and strongest Liferay features.
Liferay DevCon 2014: Lliferay Platform - A new and exciting visionJorge Ferrer
Liferay is very well known as a good platform for building portals. It provides a nice combination of out of the box features, extensibility and application development options to build almost any website, portal or complex application without starting from scratch every time. But is that all it can do?
For a few years the development world has been focusing more and more on developing for mobile and tablets, glasses and TVs or even provide public web APIs for any developers to build on top of a company’s services and content. And we have noticed “There isn’t a Liferay for those developers!”, most of that type development is started from scratch, “What if Liferay filled that gap?”
During this talk we will show how the most recent developments of the Liferay team are building a more versatile and modular platform than ever, an environment to leverage the most modern frontend development tools for enterprise needs, a set of tools to build mobile apps (for any device) with a powerful backend in a tenth of the time it typically takes. And all of it Open Source and fully standards based.
Moved to https://slidr.io/azzazzel/leveraging-osgi-to-create-extensible-plugi...Milen Dyankov
This slide deck will be removed from here in the future. It has been moved to : https://slidr.io/azzazzel/leveraging-osgi-to-create-extensible-plugins-for-liferay-6-2
Liferay DXP Presentation
As presented during the session, this is the compatibility matrix that you need to check before integrating Liferay
If you have any questions, feel free to contact me on :
My Linkedin Profile : https://www.linkedin.com/in/elyesmakhlouf
My Email Address : makhloufelyes@gmail.com
My Blog : elyesmakhlouf.blogspot.com
Delivering software in a certain quality and form is always essential for its success. Versioning, packaging, and environment-based deliveries are issues involved with every software project, and these issues are especially crucial when the software consists of multiple components.
In this session, we present our own build system based on Maven used for Liferay development. Using the right tools in software projects is essential for keeping certain standards of quality and efficiency, and it also decreases the risk connected with human factor. We introduce how you can leverage from the world's most popular build system, Maven, and use it for your Liferay projects.
Common problems like "work on my machine" code, dependency management, or versioning of components will no longer be an issue. A live demo is shown to demonstrate how this tool can be used to cover the whole project's life-cycle including development, testing, integrating Liferay patches, or migration to a higher version.
Often business stakeholders are confused about choosing the right Open source Portal and CMS. Not only that the confusion prevails on the actual understanding of a Portal and CMS. Liferay and Drupal are one of the most popular Portal and CMS platforms. This presentation helps business stakeholders choose the right Portal and CMS platform.
The Liferay 7 meetup organized by Azilen Technologies on 21st May, 2016 was undeniably a successful Meetup. Brief Overview given by Ravi Gupta & Hetal Prajapati on Liferay 7 Technology. Find here Presentation.
This blog is mainly fleshing the light over strengths and limitations of one of the most popular enterprise portal Liferay DXP. It caters in-depth information about Liferay DXP’s characteristics encompassing from architecture advantages to user experience.
An overview of liferay portal.
The outline is:
1.> Review Liferay Portal
– Enterprise Layer
– Extensions Framework
– Logical Architecture of Liferay
– Service layer
– Service Builder
– Web services
– Persistence Layer
– User Management: Organization, Site, User, Roles, Groups
2.> Out of the box features
– Document and Media Library
• Image Management
• Document Management
– Web Content Management
– Asset, Tagging, and Categorization
Liferay Italy Symposium 2015 Liferay Mobile SDK and Liferay ScreensDenis Signoretto
Liferay Italy Symposium 2015 Liferay Mobile SDK and Liferay Screens, Building and Android App with Liferay (Using Liferay as Mobile Backend and Screens for reusable mobile compoents)
Creating Better Customer and Employee Experiences with Liferay Portal and Cra...Crafter Software
Customer needs are ever increasing as they want information combined with the convenience of interacting with your brand when, where, and through whatever device they choose. Meanwhile, employees are demanding digital experiences that facilitate rapid information access, communication and enterprise collaboration.
To meet these demands, enterprises are turning to modern open source and cloud solutions like Crafter CMS to help deliver consistent and personalized experiences throughout the customer journey. And internally, they are adopting Liferay Portal to provide social intranet and collaboration solutions.
Rivet Logic and Crafter Software discuss:
* Business benefits of an integrated Liferay Portal and Crafter CMS solution along with common uses cases
* How Crafter CMS provides the foundation for your multi-channel digital experience approach
* Best practices to follow, and out of the box capabilities, for technology integration
* Customer success stories
* Live Demo
[DevDay2018] Liferay DXP – A powerful Enterprise Solution - By Vy Bui, Develo...DevDay.org
Liferay DXP is a Java-based open source Enterprise Portal Platform that is robust, flexible and easy to maintain. It is used around the world by governments, universities and other large enterprises such as Cisco and Rolex. In this session, you will learn what Liferay is and see step by step how to use some of the most popular and strongest Liferay features.
Liferay DevCon 2014: Lliferay Platform - A new and exciting visionJorge Ferrer
Liferay is very well known as a good platform for building portals. It provides a nice combination of out of the box features, extensibility and application development options to build almost any website, portal or complex application without starting from scratch every time. But is that all it can do?
For a few years the development world has been focusing more and more on developing for mobile and tablets, glasses and TVs or even provide public web APIs for any developers to build on top of a company’s services and content. And we have noticed “There isn’t a Liferay for those developers!”, most of that type development is started from scratch, “What if Liferay filled that gap?”
During this talk we will show how the most recent developments of the Liferay team are building a more versatile and modular platform than ever, an environment to leverage the most modern frontend development tools for enterprise needs, a set of tools to build mobile apps (for any device) with a powerful backend in a tenth of the time it typically takes. And all of it Open Source and fully standards based.
Moved to https://slidr.io/azzazzel/leveraging-osgi-to-create-extensible-plugi...Milen Dyankov
This slide deck will be removed from here in the future. It has been moved to : https://slidr.io/azzazzel/leveraging-osgi-to-create-extensible-plugins-for-liferay-6-2
Liferay DXP Presentation
As presented during the session, this is the compatibility matrix that you need to check before integrating Liferay
If you have any questions, feel free to contact me on :
My Linkedin Profile : https://www.linkedin.com/in/elyesmakhlouf
My Email Address : makhloufelyes@gmail.com
My Blog : elyesmakhlouf.blogspot.com
Delivering software in a certain quality and form is always essential for its success. Versioning, packaging, and environment-based deliveries are issues involved with every software project, and these issues are especially crucial when the software consists of multiple components.
In this session, we present our own build system based on Maven used for Liferay development. Using the right tools in software projects is essential for keeping certain standards of quality and efficiency, and it also decreases the risk connected with human factor. We introduce how you can leverage from the world's most popular build system, Maven, and use it for your Liferay projects.
Common problems like "work on my machine" code, dependency management, or versioning of components will no longer be an issue. A live demo is shown to demonstrate how this tool can be used to cover the whole project's life-cycle including development, testing, integrating Liferay patches, or migration to a higher version.
Often business stakeholders are confused about choosing the right Open source Portal and CMS. Not only that the confusion prevails on the actual understanding of a Portal and CMS. Liferay and Drupal are one of the most popular Portal and CMS platforms. This presentation helps business stakeholders choose the right Portal and CMS platform.
The Liferay 7 meetup organized by Azilen Technologies on 21st May, 2016 was undeniably a successful Meetup. Brief Overview given by Ravi Gupta & Hetal Prajapati on Liferay 7 Technology. Find here Presentation.
This blog is mainly fleshing the light over strengths and limitations of one of the most popular enterprise portal Liferay DXP. It caters in-depth information about Liferay DXP’s characteristics encompassing from architecture advantages to user experience.
mimacom & Liferay Roadshow : Introduction to Liferay platformJán Gregor
A talk from Joseph Shum, the General manager of Liferay Germany, focused on Introduction to Liferay platform on mimacom & Liferay Roadshow in Vienna on 6th June 2012
Compartilho com vocês uma rápida apresentação que utilizei recentemente em determinada ocasião para demonstrar em breves tópicos o que é o Liferay e alguns de seus benefícios. Sirvam-se. Não é nem um treinamento, nem uma apresentação de venda, apenas algumas idéias.
SATELLITE MULTISPECTRAL COMPOSITIONAL MAPPING OF LAKE CYANOBACTERIAL BLOOMS AND LAND CHEMICAL COMPOUNDS
Presented at the Ohio Academy of Sciences, 2012.
This presentation, given at the Alpes JUG in Grenoble France, talks about how to go from portlet development to composite applications development. Composite applications are a great way to speed up web application development.
Presentation by Ian de Villiers at ZaCon 1 in 2009.
The presentation begins by naming a few enterprise portal vendors followed by a brief overview of enterprise portals. Common shortcomings of EP's are discussed, which leads on to discussions about using custom applications to expose the full functionality of a portal.
Entando is a powerful and extensible open source, component-based, UI software platform that simplifies the end-to-end development of web, mobile and hybrid applications that leverage devices, data and services.
Enabling IoT Devices’ Hardware and Software Interoperability, IPSO Alliance (...Open Mobile Alliance
Presentation delivered during the Internet of Things World, Santa Clara pre-event workshop by Christian Legare - IPSO Alliance Chairman, Chief of Software Engineering, Micrium (Part of Silicon Labs)
Internet Protocol for Smart Objects (IPSO) is an alliance that, among other things, defines a data model to represent sensor values and attributes. OMA uses IPSO Smart Objects v1.0 as its resource model to expose sensor information to a remote LwM2M Server. From the speaker from IPSO Alliance, you will learn:
● What is an IPSO Smart Object data model
● What do these Objects and Resources look like
● How to create and register your own resources
● What is next for IPSO Alliance
Storytelling for CX: Make Your Audience the Herorivetlogic
Too often, we think about the “look & feel” for experience designs more than we do about the story we are trying to communicate. In this presentation, we explore how customer experience and digital marketing leaders can use storytelling for digital experience at the intersection of editorial, design, and development.
Learn:
- Available techniques and technologies for effective online storytelling
- How to better construct narratives around products and services
- How to use storytelling to more deeply engage your audiences.
How to Accelerate Your Digital Transformation With Design Thinkingrivetlogic
Why are leading brands around the world including Apple, Google, Starbucks, Coca Cola, and Target adopting a Design Thinking approach? By thinking like a designer, these companies are transforming the way they develop products, services, processes and strategy.
Design thinking has become a key component of digital transformation success, providing a flexible approach to tackling the complex problems that digital transformation journeys present.
By approaching problem solving through a human centered mindset, design thinking allowing organizations to discover more innovative solutions that focus on the user’s needs.
This webinar discusses:
* Common pitfalls for project failure
* Why the design thinking approach works
* The five stages of Design Thinking
* Best practices for incorporating design thinking into your digital transformation strategy
Ensuring the Success of a Global Partner Network - How Dropbox is managing it...rivetlogic
Rivet Logic shares how a Liferay powered solution gave Dropbox the flexibility and customizability it needed to build a world class partner portal to effectively manage partners while providing them with the tools they needed to succeed.
How a Product Development Portal Can Help Turn Innovative Ideas Into Marketab...rivetlogic
Excelling in a modern digital age is all about speed - speed of innovation, getting your products to market, and meeting your customer expectations.
Bringing a new product to market involves multiple phases requiring participation from various teams across the organization, from idea conception to product development and launch.
Without the right tools and processes in place, this could easily result in unnecessary miscommunications, delays, wasted efforts and costs, and could even sacrifice the quality of the outcome.
This presentation discusses how an Ideation and Product Development Portal can help your business manage its end-to-end product development process, from ideation to product launch, with modern tools that help cultivate knowledge flow and innovation.
Reimagine Your Video Communications With Video Center on AWSrivetlogic
If your organization delivers video at scale, streams live or recorded updates from company leadership, or provides e-learning assets, then the shifting video landscape will change the way you create and deliver video.
This presentation discusses:
- Where the enterprise video landscape is headed
- Best practices for enterprise video solutions
- Benefits of cloud-based video operations
- Ways to leverage other cutting edge AWS services
- How to manage, publish, and deliver personalized video to any device and any audience
- Case study of how the DoD is using the Video Center to help soldiers connect anywhere in the world
- Video Center on AWS and how to get started
Elevate Your Digital Experiences with Cloud Content Management on Boxrivetlogic
The Enterprise Content Management landscape is ever evolving. As more businesses undergo digital transformation, they need modern and agile ECM technology that can keep up with the changing pace.
Successful companies are rethinking the workplace, processes and IT infrastructure, making the journey from legacy IT to modernized, future-ready IT that gives your business the agility to innovate.
Box is a cloud content management platform for the digital age, combining centralized, cloud-native content services with advanced security and governance.
And with Box Platform, businesses can create custom digital experience solutions that leverage and extend the core functionality of Box, without having to build the underlying infrastructure.
This presentation discusses the following:
- Where the ECM landscape is headed
- Benefits of cloud content management
- Why businesses are turning to Box and common use cases
- How businesses are building custom digital experience solutions leveraging Box Platform
- Solution Highlight: Document Center on Box
Delivering Connected Digital Experiences for Engaging the Modern Day Customerrivetlogic
Modern consumers are expecting faster, more convenient, more personalized content and services delivered on demand, while employees are demanding the same level of experience in the workplace. To remain competitive, businesses need to remain agile, with the ability to adjust to these ever evolving demands.
In this presentation, we will explore the drivers behind the changing digital landscape and why more and more businesses are undergoing digital transformation initiatives to drive growth and create new value for customers and employees.
You’ll learn about a new breed of Digital Experience Platforms (DXP) and how they provide the tools necessary to create personalized digital experiences for maximum user engagement and business value.
5 Reasons Why You Should Consider Migrating Web Apps to the Cloud on AWSrivetlogic
More and more, organizations are turning to the Cloud to reduce cost and liability, increase performance and develop greater flexibility to provide services for their mission critical enterprise deployments.
This presentation covers the benefits of migrating web applications to the Cloud leveraging Amazon Web Services (AWS), and the positive impact it can have on your business, including:
- Reduced costs
- Increased operational efficiency
- Flexibility and scalability
- Increased security and reduced risk
- Freeing up IT resources to focus on strategic projects
- Benefits of Managed Services
5 Reasons Why Your CMS Should Move to the Cloudrivetlogic
Why are a growing number of enterprise customers deploying their Web experiences in the cloud? In this presentation, we discuss top reasons for moving a CMS to the cloud, how to craft a successful enterprise web strategy, and best practices for building next-generation web experiences.
Improve Employee Engagement With a Mobile Enabled Intranetrivetlogic
Top businesses today are leveraging social intranet solutions to drive employee engagement and facilitate smarter enterprise collaboration. This webinar shows you how to further extend your intranet’s benefits through mobile, successfully mobilize your workforce, and the tools needed to do so.
Increase Customer Engagement and Drive Revenue with Liferay Audience Targeting rivetlogic
Today’s consumers are surrounded with an ever-increasing amount of digital content, as we’ve all probably experienced personally. To capture their attention and truly engage them, businesses need to deliver personalized experiences that are targeted towards their individual needs. An engaged audience can lead to more new customers as well as drive existing customer loyalty.
This presentation dives into the topic of audience engagement - how to connect with your audience through personalized content, and how Liferay’s new Audience Targeting app helps to tailor content for specific users.
Incorporating Mobile Into Your Digital Experience Strategyrivetlogic
Mobile web traffic continues to increase and in some cases is surpassing that of desktops. And from 2013 to 2014, mobile app usage saw an astounding 52% increase compared to just a 1% increase with desktops. With facts like these, it’s apparent that businesses can no longer afford to ignore their mobile experience.
Whether your audience is spending just a few minutes checking on the status of an order or watching streaming media for hours on their mobile device, it all plays a part in the overall customer experience journey they have with your business.
Marketing Asset Center - Enabling Consistency & Productivity Across Sales & M...rivetlogic
The Digital Marketing landscape continues to transform in the form of content marketing, big data, mobile marketing, and social media. All of this equates to an abundance of digital marketing assets – audio, video, images, documents, corporate communications, campaign assets, and more – which need to be effectively managed and distributed to various stakeholders – sales teams, employees, partners, customers, remote offices, and others.
The Marketing Asset Center provides a powerful and easy way for enterprises to manage and distribute all their digital marketing assets, resulting in increased marketing productivity, brand consistency, sales effectiveness, and revenue.
NoSQL Design Considerations and Lessons Learnedrivetlogic
Leading organizations worldwide are using NoSQL database technologies to create data-driven solutions that help them gain valuable insight into their business and customers. This presentation shares our experiences, thought processes and lessons learned building apps on NoSQL databases.
Increase Your Marketing Productivity With the Marketing Asset Center for Alfr...rivetlogic
The Digital Marketing landscape continues to transform in the form of content marketing, big data, mobile marketing, and social media. All of this equates to an abundance of digital marketing assets – audio, video, images, documents, corporate communications, campaign assets, and more – which need to be effectively managed and distributed to various stakeholders – sales teams, employees, partners, customers, remote offices, and others.
The Marketing Asset Center provides a powerful and easy way for enterprises to manage and distribute all their digital marketing assets, resulting in increased marketing productivity, brand consistency, sales effectiveness, and revenue.
Social Intranets for Smarter Enterprise Collaborationrivetlogic
Rivet Logic introduces its Employee Experience Maturity Model, which may be used by any organization to assess and optimize employee collaboration, engagement and productivity, and will highlight how it may be implemented through a real-world case study.
AT&T’s Mobile Developer Community: Social, Personalized, and Built for Scalerivetlogic
The largest and most successful online communities, websites and applications on the internet today are social, personalized, and require large-scale content and user data management.
To create a highly engaged community and resource center for its mobile developers, AT&T is turning to Crafter and MongoDB for the implementation of its next generation mobile developer community.
This presentations discusses AT&T's journey in achieving an engaging community site for its Developer Program.
The internet has revolutionized the way companies market their products and services today. One of the biggest changes is how businesses are leveraging their websites to market their online presence. In a competitive digital world, the key to success is reaching potential customers and driving them to your website.
One of the most effective methods to do so is through Search Engine Optimization, also known as SEO, a top priority in today’s growing world of technology and reliance on web-based platforms.
This presentation demonstrates Liferay's newest SEO features, and discusses how we've implemented SEO-friendly dynamic pages and carousels.
Implementing an SEO Strategy for Your Liferay Websitesrivetlogic
The internet has revolutionized the way companies market their products and services today. One of the biggest changes is how businesses are leveraging their websites to market their online presence. In a competitive digital world, the key to success is reaching potential customers and driving them to your website.
One of the most effective methods to do so is through Search Engine Optimization (SEO). In today's growing world of technology and reliance on web-based platforms, every public site must be concerned about SEO. There are a number of reasons why SEO is routinely selected as the primary marketing method by many organizations to acquire customers.
This presentation discusses how Rivet Logic has met sophisticated SEO requirements for highly visible Liferay sites, along with demonstrating Liferay's newest SEO features.
Building Engaging Customer Experiences Powered by MongoDBrivetlogic
This presentation discusses the challenges many organizations face in providing fine-grained personalization, and how a modern database like MongoDB can be used to help businesses better leverage the data they already have in separate systems by making meaningful connections and creating interactions of value.
Introduction to Portlets using Liferay Portal (Part 2)
1. ARTISANS OF OPEN SOURCE
Introduction to Portlets using Liferay Portal
(Part 2)
By: Aníbal Gómez-Estrada
http://rivetlogic.com/web/agomez
October 19th, 2011
Rivet Logic Corporation Rivet Logic Costa Rica SRL
11410 Isaac Newton Square N. Costa Rica Developer's Forge
Suite 210 Edificio María Luisa, 3A office
Reston, VA 20190, USA Paseo Colón, San José, Costa Rica
Ph: 703.955.3480 Fax: 703.234.7711 Ph: (506) 2256-1024 Fax: (506) 2256-1024
2. Rivet Logic Overview ARTISANS OF OPEN SOURCE
• Award-winning consulting and systems integration firm
focused on enabling open source –based software solutions
for content management, collaboration and community:
– Innovator of the Year: JBoss (2008)
– Solution of the Year: Alfresco (2010)
– Platinum Partner: Liferay (2011)
• We use top-notch open source technology:
• Company Facts:
– Founded in 2005. Consistently Profitable and Employee-owned. 40+ Consultants
– Headquarters in Virginia, USA. Near-shore office in San José, Costa Rica for two years
– Certified Liferay Partner since 2006:
• Conduct all public training on East Coast, USA
• Contributor (software, documentation, forums, training material)
• 20+ Liferay projects underway or completed!
3. Agenda ARTISANS OF OPEN SOURCE
• Introduction
– Portals and Portlets
– Liferay SDK Plugin Types
– Liferay Service Builder
– Portlets 1.0 (JSR 168)
• Portlets 2.0 (JSR 286)
– Resource Serving
– Inter-Portlet Communication
– Lifecycle Revisited
– Portlet Filters and PortletURL Listeners
– Enhancements:
• Servlet Programming Features
• Annotations
• Tag Libraries
• Conclusion
– Questions and Answers
– References
• Announcements
– JSF 2.0 Portlets using Liferay Portal is Available Now!
– Rivet Logic Is Hiring!
5. Portals and Portlets ARTISANS OF OPEN SOURCE
In a Nutshell
Portal Architecture:
A Portal is designed to Liferay Portal is a
be a single web-based Portlet Container
environment where all and Portal Server
users applications Platform and
run integrated environment to run/
together in a administer web sites
systematic way” and to integrate portlets
6. Liferay SDK Plugin Types ARTISANS OF OPEN SOURCE
Themes
• Themes customize the overall structure and look and feel of the Portal pages and are
based on HTML, CSS and Velocity/FreeMarker
• Theme Plugins are based on a pre-made theme which gives the site minimal structure (either
unstyled or styled)
• Customizations are overlaid against the “base theme” with a overwriting mechanism
and differentiation scheme
• Provide control over everything: HTML, CSS and images inside portlets (box) and
outside (page) and positioning/behavior of the top navigation elements
• Deployed Themes can be used at level different levels: the overall site, a community/organization
or a single page
More Info: http://www.liferay.com/community/wiki/-/wiki/Main/Themes
7. Liferay SDK Plugin Types (2) ARTISANS OF OPEN SOURCE
Layout Templates
• Layout Templates control how portlets are arranged
on a Portal page and are created with a combination of
HTML, CSS and Velocity
• They make up the body of the page, the large area where
portlets can be dragged and dropped into
• Allow portlets to be embedded into templates
• Deployed Layout Templates are used at page level
• For Instance:
More Info: http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Layout+Template
8. Liferay SDK Plugin Types (3) ARTISANS OF OPEN SOURCE
Hooks
• Hooks allow to hook custom code at different extension
points in order to either change, override or extend:
• Display: JSPs and Language Properties
• Behavior: Portal Server Lifecycle Events, Services, Model Listeners
and Portal Properties
• Hook Plugins are Java code –based and they are hot-
deployable, as well as, Themes, Layout Templates and
Portlet Plugins do!
More Info: http://www.liferay.com/community/wiki/-/wiki/Main/Portal+Hook+Plugins
9. Liferay SDK Plugin Types (4) ARTISANS OF OPEN SOURCE
Portlets
• Portlets are componentized
user-facing applications
that generate a fragment of the
Portal page
In this presentation, you will learn more
about what Portlet Plugins are!
• For now, let’s take a look at
some of the portlets available
for Liferay Portal..
More Info: http://www.liferay.com/community/wiki/-/wiki/Main/Out+of+The+Box+Portlets
10. Liferay SDK Plugin Types (5) ARTISANS OF OPEN SOURCE
Ext
• Ext allow to extend/override built-in code in special
scenarios that can not be met by another plugin types:
• Easily extensible: Liferay Portal is implemented on top of Spring,
Hibernate and Struts/Tiles, so custom code can be plugged in very easily
• Complete control: It allows access to internal APIs or even overwriting
files/classes provided in the Liferay core
• To be carefully used: it is a powerful tool that comes with a cost in terms of
complexity and maintenance!
• Ext Plugins are NOT hot-deployable!
– Require server restart
– Can not be un-deployed
More Info: https://www.liferay.com/community/wiki/-/wiki/Main/Ext+Plugin
11. Liferay Service Builder ARTISANS OF OPEN SOURCE
• Service Builder is a tool built by Liferay to automate the creation of Services,
Models and Persistence –related interfaces and classes relying on Liferay API,
Spring and Hibernate:
• Input: an XML file specifying the structure of Model classes and data-storage –related
operations
• Ouput: a service JAR that can be exposed either at a global or local (ie. Portlet plugin) levels
and a set of implementation classes with beans and basic logic generated for the Model and
Service/Persistence classes
• When specified, Service Builder also generates Javascript stubs for remote
access (ie. client side / browser)!
More Info: http://www.liferay.com/community/wiki/-/wiki/Main/Service+Builder
12. Portlet 1.0 (JSR 168) ARTISANS OF OPEN SOURCE
• JSR 168 in a Nutshell:
– Portlet Container Contract and Portlet Lifecycle
– Packaging and Deployment
– Portlet Modes and Window States
– Portlet Preferences Management
– JSP Support
– User Information and Security
– Localization and Caching
• JSR 168 defined the overall UI component model and provided a
few support for building integrated/coordinated composite
applications. However, “portlets are islands” in JSR 168:
– Can not generate non-markup content
– Can not communicate with other portlets
– Can not influence the portal page
14. Portlet 2.0 (JSR 286) ARTISANS OF OPEN SOURCE
• JSR 286 addresses limitations identified by many portal
vendors that caused custom solutions and not portable to be placed
in their products
– Released in June, 2008
– Expert Group: IBM, ASF, Oracle, BEA, Liferay, among others
• Features introduced in JSR 286’s Portlet API also fill some
gaps with related technologies, such as J2EE 1.4, WSRP,
Servlets, JSF, among others
• JSR 286 mainly addresses following topics:
– Resource Serving *
– Inter-Portlet Communication: Event-Notification and Public Render
Parameters *
– Portlet Filters and PortletURL Listeners *
– Servlet Programming Model Features *
– Enhancement on Annotations, JSP support, Portlet Modes, Caching *
15. Resource Serving ARTISANS OF OPEN SOURCE
• In JSR 168, dynamically generated resources could not be directly
served from a portlet instance. An additional servlet was needed to serve
the resources:
– Disadvantages: Out of Portal’s Scope (No Access to render parameters, portlet mode,
window state, portlet preferences, portlet session, etc). Not under Portal access control
(Servlet to be secured separately)
– Advantages: less overhead because the request does not have to pass through the additional
portal framework. Adequate when serving large media streams…
• JSR 286 introduces Resource Serving as a lifecycle operation that
is dispatched directly from corresponding portlet instance:
– Normally occurs after a render call and can be used to implement AJAX use cases
– Does not generate a full new portal page. Returned content not aggregated with another
markup. The resource response allows full control over output stream
– Cannot set new render parameters, portlet mode, or window state since the portal
does not have a chance to update other parts of the page
• During a Resource Request, a portlet implementing ResourceServingPortlet
interface can create dynamic resources through serveResource() method
• Portlet API provide Resource URLs for Resource Serving requests. They are created
with RenderResponse.createResourceURL() and trigger lifecycle
serveResource() method. ResourceURLs can be set with params as other URLs
16. Resource Serving (2) ARTISANS OF OPEN SOURCE
• Let’s create a new JSP-based Portlet which returns a greeting on
Ajax call:
File: /WEB-INF/src/com/sample/jsp/portlets/JSPPortlet.java
package com.sample.jsp.portlets;
import java.io.IOException;
import java.io.OutputStream;
import javax.portlet.*;
public class JSPPortlet extends javax.portlet.GenericPortlet {
@Override
protected void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/html/view.jsp");
rd.include(request,response);
}
@Override
public void serveResource(ResourceRequest request, ResourceResponse response)
throws PortletException, IOException {
OutputStream stream = response.getPortletOutputStream();
response.setContentType("text/html");
stream.write(
String.format(
"%1$s (Ajax - %2$s)!!”,
request.getParameter("ajax-parameter-greeting"), Math.random()
).getBytes()
);
}
}
17. Resource Serving (3) ARTISANS OF OPEN SOURCE
• Now, let’s create the JSP page invoking the portlet via Ajax:
File: /html/view.jsp
<%@ page session="false" contentType="text/html; charset=ISO-8859-1" %>
<%@ page import="javax.portlet.*"%>
<%@ taglib uri='/WEB-INF/tld/liferay-portlet.tld' prefix='portlet'%>
<portlet:defineObjects/>
<portlet:resourceURL var="resourceUrl">
<portlet:param name="ajax-parameter-greeting" value="Hello World from Resource Serving Param" />
</portlet:resourceURL>
<p>
<input
type="button" value='Ajax!' title='<%=resourceUrl%>’
onclick="javascript:ajaxHelloWorld('<%=resourceUrl%>');”
/>
</p>
<div id="msg_display">The data from the server will go here</div>
<script type="text/javascript">
/* PLEASE LOOK AT NEXT SLIDE */
</script>
18. Resource Serving (4) ARTISANS OF OPEN SOURCE
• Now, let’s create the JSP page invoking the portlet via Ajax (2):
File: /html/view.jsp
...
<script type="text/javascript">
function ajaxHelloWorld(url){
var request = createXMLHttpRequest();
var callback = function() {
var msg_display = document.getElementById("msg_display");
if (request.readyState == 4) {
if (request.status == 200) {
msg_display.innerHTML = request.responseText;
} else {
msg_display.innerHTML = "ERROR: "+ request.statusText;
}
}
};
request.onreadystatechange = callback;
request.open("GET", url, true);
request.send();
}
function createXMLHttpRequest() {
var request;
if (window.XMLHttpRequest) {
request = new XMLHttpRequest();
} else if (window.ActiveXObject) {
try {
request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try { request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
}
}
return request;
}
</script>
19. Resource Serving (5) ARTISANS OF OPEN SOURCE
• Finally, let’s add the portlet in corresponding deployment descriptors
File: /WEB-INF/portlet.xml
<portlet-app ...>
...
<portlet>
<portlet-name>jsp-hello-world-portlet</portlet-name>
<display-name>JSP 2.0 Hello World Portlet</display-name>
<portlet-class>com.sample.jsp.portlets.JSPPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
<portlet-info>
<title>JSP 2.0 Hello World Portlet</title>
<short-title>JSP 2.0 Hello World Portlet</short-title>
<keywords>JSP 2.0 Hello World Portlet</keywords>
</portlet-info>
</portlet>
...
</portlet-app>
File: /WEB-INF/liferay-portlet.xml
<liferay-portlet-app>
<portlet>
<portlet-name>jsp-hello-world-portlet</portlet-name>
<icon>/icon.png</icon>
<instanceable>true</instanceable>
</portlet>
</liferay-portlet-app>
File: /WEB-INF/liferay-display.xml
<display>
<category name="category.sample">
<portlet id=”jsp-hello-world-portlet" />
</category>
</display>
20. Resource Serving (6) ARTISANS OF OPEN SOURCE
• After re-deploying our Portlet plugin and clicking portlet’s button:
21. Resource Serving (7) ARTISANS OF OPEN SOURCE
• An additional resource ID can be set on the resource URL that clearly identifies
the resource through ResourceURL.setResourceID() method, such as:
– resourceUrl.setResourceID("WEB-INF/jsp/xmlcontent.jspx");
– When extending GenericPortlet, a serveResource call is automatically dispatched to the JSP,
which can then make use of the portlet state information by including the portlet tag library
• Serving static resources using the portlet's serveResource() method causes
unnecessary performance overhead:
– Static resources like image files packaged in the portlet WAR should normally be
referenced with static resource URLs, such as:
String url = response.encodeURL(request.getContextPath()+"/icons/myimage.gif");
• In contrast to RenderURLs, all HTTP methods (GET, POST or DELETE) can be
leveraged with ResourceURLs (not only GET) which means:
– Methods to change state can be used in the serveResource() call. But, changes should
be limited to private state of portlet: Portlet-scoped session and Portlet Preferences
– State that affects other portlets should not be modified because the portal
framework has no chance to update another portions of the page on serveResource()
22. IPC: Event Notifications ARTISANS OF OPEN SOURCE
• In JSR 168, the only way to achieve communication between portlets
was through portlet session. Only possible with portlets in same web-app…
• JSR 286 provides a loosely coupled publish/subscribe model that allows
portlets in different web applications to send and receive events
• An event is a lifecycle operation that occurs before the rendering phase and
allow portlets to respond on actions or state changes
• Descriptor portlet.xml must declare events and define what portlets are allowed
to produce and consume them:
– Event name is represented as QName (Namespace + Localpart) to identify it uniquely
– Event payload (argument) is represented by a java.io.Serializable class
• During action and event lifecycle operations, a portlet can publish events through
inherited StateAwareResponse’s setEvent() method
• During event lifecycle operation, a portlet implementing EventPortlet interface
can handle events through processEvent() method
23. IPC: Event Notifications (2) ARTISANS OF OPEN SOURCE
• Let's create a new "Hello World" portlet which issues an event once
its action button is clicked:
File: /WEB-INF/src/com/sample/generic/portlets/HelloWorldPortlet.java
package com.sample.generic.portlets;
import java.io.IOException;
import java.io.PrintWriter;
import javax.portlet.*;
import javax.xml.namespace.QName;
public class HelloWorldPortlet extends javax.portlet.GenericPortlet {
@Override
protected void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
PrintWriter writer = response.getWriter();
writer.write(
String.format(
"<form action='%1$s' method='POST'>" +
"<input type='submit' value='Change!' />"+
"</form>",
response.createActionURL().toString()
)
);
}
@Override
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {
response.setEvent(
new QName("http://sample.com/events", "ipc.speak.world"), "The Event PayLoad!!"
);
}
}
24. IPC: Event Notifications (3) ARTISANS OF OPEN SOURCE
• Let's create a new "Hello World" portlet which issues an event once
its action button is clicked:
File: /WEB-INF/src/com/sample/generic/portlets/GoodbyeWorldPortlet.java
package com.sample.generic.portlets;
import java.io.IOException;
import java.io.PrintWriter;
import javax.portlet.*;
public class GoodbyeWorldPortlet implements javax.portlet.Portlet, javax.portlet.EventPortlet {
public void init(PortletConfig config) throws PortletException {}
public void destroy() {}
public void render(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
PrintWriter writer = response.getWriter();
String renderParameter = request.getParameter("render-param-greeting");
writer.write(
String.format(
"<p>%1$s</p>”, (renderParameter != null) ? renderParameter : "Waiting for Greeting...”
)
);
}
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {}
public void processEvent(EventRequest request, EventResponse response) throws PortletException, IOException {
Event event = request.getEvent();
if ("{http://sample.com/events}ipc.speak.world".equals(event.getQName().toString())
&& "The Event PayLoad!!".equals(event.getValue())) {
response.setRenderParameter("render-param-greeting", "Goodbye World!!");
}
}
}
25. IPC: Event Notifications (4) ARTISANS OF OPEN SOURCE
• Let’s now declare the event and add the portlets in the standard
deployment descriptor:
File: /WEB-INF/portlet.xml
<portlet-app ...>
...
<portlet>
<portlet-name>generic-hello-world-portlet</portlet-name>
<display-name>Generic 2.0 Hello World Portlet</display-name>
<portlet-class>com.sample.generic.portlets.HelloWorldPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
<portlet-info>
<title>Generic 2.0 Hello World Portlet</title>
<short-title>Generic 2.0 Hello World Portlet</short-title>
<keywords>Generic 2.0 Hello World Portlet</keywords>
</portlet-info>
<supported-publishing-event>
<qname xmlns:x="http://sample.com/events">x:ipc.speak.world</qname>
</supported-publishing-event>
</portlet>
...
<event-definition>
<qname xmlns:x="http://sample.com/events">x:ipc.speak.world</qname>
<value-type>java.lang.String</value-type>
</event-definition>
</portlet-app>
26. IPC: Event Notifications (5) ARTISANS OF OPEN SOURCE
• Let’s now declare the event and add the portlets in the standard
deployment descriptor (2):
File: /WEB-INF/portlet.xml
<portlet-app ...>
...
<portlet>
<portlet-name>generic-goodbye-world-portlet</portlet-name>
<display-name>Generic 2.0 Goodbye World Portlet</display-name>
<portlet-class>com.sample.generic.portlets.GoodbyeWorldPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
<portlet-info>
<title>Generic 2.0 Goodbye World Portlet</title>
<short-title>Generic 2.0 Goodbye World Portlet</short-title>
<keywords>Generic 2.0 Goodbye World Portlet</keywords>
</portlet-info>
<supported-processing-event>
<qname xmlns:x="http://sample.com/events">x:ipc.speak.world</qname>
</supported-processing-event>
</portlet>
...
</portlet-app>
28. IPC: Event Notifications (7) ARTISANS OF OPEN SOURCE
• After re-deploying our Portlet plugin, adding both portlets to the
same page and click on “Hello World” portlet’s button…
29. IPC: Event Notifications (8) ARTISANS OF OPEN SOURCE
• JSR 286 defines some additional features for event definition and
declaration available from portlet.xml:
– Default namespace: a namespace defined through <default-
namespace> element can be applied to all events defined only with a local
name (<name> element)
– Aliases: an alternative name defined through <alias> element can be used
to coordinate communication between portlets that need to use different
names for same event
– Wildcards: <supported-processing-event> and <supported-
publishing-event> elements can use trailing-dot -based wildcards to match
events names which local part is defined in hierarchical manner using the dot
(.) as a separator. For example:
• “x:foo.event.” can match “x:foo.event.one” and “x:foo.event.two”, but not “x:foo.bar.event”
• “x:foo..” can match “x:foo.event.one” and “x:foo.event.two” and “x:foo.bar.event”
30. IPC: Event Notifications (9) ARTISANS OF OPEN SOURCE
• JSR 286 defines some additional features for event definition and
declaration available from portlet.xml:
File: /WEB-INF/portlet.xml
<portlet-app ...>
...
<portlet>
<portlet-name>generic-hello-world-portlet</portlet-name>
...
<supported-processing-event>
<qname xmlns:x="http://sample.com/events">x:ipc..</qname>
</supported-processing-event>
</portlet>
...
<portlet>
<portlet-name>generic-goodbye-world-portlet</portlet-name>
...
<supported-processing-event>
<name>ipc.speak.world</name>
</supported-processing-event>
</portlet>
...
<default-namespace>http://sample.com/events</default-namespace>
...
<event-definition>
<name>ipc.hello.world</name>
<alias xmlns:x="http://sample.com/events">x:ipc.speak.world</alias>
<value-type>java.lang.String</value-type>
</event-definition>
...
</portlet-app>
31. IPC: Public Render Parameters ARTISANS OF OPEN SOURCE
• In JSR 168, render parameters set in processAction() method are only available in
the render phase of the same portlet
• JSR 286 allows render parameters to be shared across portlets of same web page.
They enable coordination between portlets (parameter passing) and avoid the additional
process event call
• Public render parameters are available in all lifecycle methods and can be viewed or
changed by other portlets or components
• Descriptor portlet.xml must declare public render parameters and specify which ones are
to be shared for each portlet:
– Name is represented as QName (Namespace + Localpart) to identify it uniquely
– Identifier defines how it can be referenced from different portlets configuration
• Similarly to Events, features for public render parameters available from portlet.xml:
– Default namespace: a namespace defined through element <default-namespace>
can be applied to all public render parameters defined only with a local name (<name>)
– Aliases: an alternative name defined through element <alias> can be used to
coordinate portlets that need to use different names for same public render parameter
32. IPC: Public Render Parameters (2) ARTISANS OF OPEN SOURCE
• Let’s replace mechanism for Inter-Portlet communication through
Public Render Parameters:
File: /WEB-INF/src/com/sample/generic/portlets/HelloWorldPortlet.java
package com.sample.generic.portlets;
import java.io.IOException;
import java.io.PrintWriter;
import javax.portlet.*;
import javax.xml.namespace.QName;
public class HelloWorldPortlet extends javax.portlet.GenericPortlet {
...
@Override
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {
response.setRenderParameter
(
"render-param-greeting", "Goodbye World from Public Render Parameter!!"
);
//response.setEvent
//(
// new QName("http://sample.com/events", "ipc.speak.world"), "The Event PayLoad!!"
//);
}
}
33. IPC: Public Render Parameters (3) ARTISANS OF OPEN SOURCE
• Let’s now declare the public render parameter in the standard
deployment descriptor:
File: /WEB-INF/portlet.xml
<portlet-app ...>
...
<portlet>
<portlet-name>generic-hello-world-portlet</portlet-name>
...
<supported-public-render-parameter>
render-param-greeting
</supported-public-render-parameter>
</portlet>
...
<portlet>
<portlet-name>generic-goodbye-world-portlet</portlet-name>
...
<supported-public-render-parameter>
render-param-greeting
</supported-public-render-parameter>
</portlet>
...
<default-namespace>http://sample.com/events</default-namespace>
...
<public-render-parameter>
<identifier>render-param-greeting</identifier>
<name>ipc.render.world</name>
</public-render-parameter>
...
</portlet-app>
34. IPC: Public Render Parameters (4) ARTISANS OF OPEN SOURCE
• After re-deploying our Portlet plugin and clicking on “Hello World”
portlet’s button…
35. Contract and Lifecycle Revisited ARTISANS OF OPEN SOURCE
• Request handling sequence after lifecycle methods
introduced by JSR 286:
36. Let’s Take a Break! ARTISANS OF OPEN SOURCE
Introduction to Portlets using Liferay Portal
(Part 2)
By: Aníbal Gómez-Estrada
http://rivetlogic.com/web/agomez
October 19th, 2011
Rivet Logic Corporation Rivet Logic Costa Rica SRL
11410 Isaac Newton Square N. Costa Rica Developer's Forge
Suite 210 Edificio María Luisa, 3A office
Reston, VA 20190, USA Paseo Colón, San José, Costa Rica
Ph: 703.955.3480 Fax: 703.234.7711 Ph: (506) 2256-1024 Fax: (506) 2256-1024
37. Portlet Filters ARTISANS OF OPEN SOURCE
• JSR-268 introduces Portlet Filters as a means to
intercept any lifecycle call to a portlet and manage custom
behavior in centralized way
• Portlet Filters are reusable pieces of code that can
transform content in both request and response of the portlet
• Functionality implementable through Portlet Filters:
– Pass additional data into the portlet (as attributes or parameters)
– Output filtering for security enforcement or markup compliance
– Collecting diagnostic information
– Bridging between Web application frameworks
• Portlet Filter model is based on the Servlet Filter model...
38. Portlet Filters (2) ARTISANS OF OPEN SOURCE
• Depending on type of lifecycle call to be filtered, a Portlet
Filters must implement one of the following interfaces:
– javax.portlet.filter.RenderFilter
– javax.portlet.filter.ActionFilter
– javax.portlet.filter.EventFilter
– javax.portlet.filter.ResourceFilter
• Portlet Filters have the following lifecycle:
– Initialization: init() called when filter is instantiated. FilterConfig
holding init parameters and PortletContext is provided for resource
initialization
– Deinitialization: destroy() called when filter is being taken out of
service. To contain logic that cleans it up (ie, memory, file handles,
threads, etc)
– Filtering: doFilter () called each time an action request/response
pair is passed through the chain due to a client request
39. Portlet Filters (3) ARTISANS OF OPEN SOURCE
• At runtime, a filter chain of all filters is applied:
– Each filter gets the current request/response and the filter chain
– After doing its pre/post processing, the filter can either:
• Terminate the request processing, or
• Call the next element in the chain by passing in either the received request and
response, or wrapped versions
– The last element in the filter chain is the portlet itself!
• Descriptor portlet.xml must define:
– Filters with a name, intended lifecycle phase (ACTION_PHASE,
EVENT_PHASE, RENDER_PHASE or RESOURCE_PHASE),
PortletFilter class and init parameters
– Filter mappings by associating filters to portlets. Order of filter-
mapping defines the order in which they are applied at runtime
40. Portlet Filters (4) ARTISANS OF OPEN SOURCE
• Let’s create a PortletFilter to agregate content at beginning/end on
render response:
File: /WEB-INF/src/com/sample/generic/filters/RenderFilter.java
package com.sample.generic.filters;
import java.io.IOException;
import java.io.PrintWriter;
import javax.portlet.*;
import javax.portlet.filter.*;
public class RenderFilter implements javax.portlet.filter.RenderFilter {
private String prologueMessage, epilogueMessage;
public void init(FilterConfig config) throws PortletException {
prologueMessage = config.getInitParameter("filter-init-parameter-prologue");
epilogueMessage = config.getInitParameter("filter-init-parameter-epilogue");
}
public void destroy() {
}
public void doFilter(RenderRequest request,RenderResponse response, FilterChain chain)
throws IOException, PortletException {
PrintWriter writer = response.getWriter();
writer.write(String.format("<p>%1$s</p>", prologueMessage));
chain.doFilter(request, response);
writer.write(String.format("<p>%1$s</p>", epilogueMessage));
}
}
41. Portlet Filters (5) ARTISANS OF OPEN SOURCE
• Now, let’s define/enable our PorletFilter on each existing portlet:
File: /WEB-INF/portlet.xml
<portlet-app ...>
...
<portlet>...</portlet>
...
<filter>
<filter-name>render-filter</filter-name>
<filter-class>com.sample.generic.filters.RenderFilter</filter-class>
<lifecycle>RENDER_PHASE</lifecycle>
<init-param>
<name>filter-init-parameter-prologue</name>
<value>Good Morning,</value>
</init-param>
<init-param>
<name>filter-init-parameter-epilogue</name>
<value>Have a Good Day!</value>
</init-param>
</filter>
<filter-mapping>
<filter-name>render-filter</filter-name>
<portlet-name>generic-hello-world-portlet</portlet-name>
<portlet-name>generic-goodbye-world-portlet</portlet-name>
<portlet-name>jsp-hello-world-portlet</portlet-name>
</filter-mapping>
...
<default-namespace>...</default-namespace>
...
</portlet-app>
42. Portlet Filters (6) ARTISANS OF OPEN SOURCE
• After re-deploying our Portlet plugin:
43. Portlet URL Listeners ARTISANS OF OPEN SOURCE
• JSR-268 introduces Portlet URL Listeners as a means to
intercept URLs in centralized way, before they get generated (ie.
when methods toString() or write() are called on URLs)
• Functionality implementable through Portlet URL Listeners is
around managing specific Portlet –related properties on URLs:
– Parameters, portlet mode, window state
– Security, Cache level of resources, etc
• In order to receive a callback whenever a Portlet URL is
generated, Portlet URL Listeners must implement interface
javax.portlet.PortletURLGenerationListener with methods:
– filterRenderURL() for RenderURLs
– filterActionURL() for ActionURLs
– filterResourceURL() for ResourceURLs
44. Portlet URL Listeners (2) ARTISANS OF OPEN SOURCE
• Descriptor portlet.xml must register Portlet URL Listeners with a
<listener> element for each PortletURLGenerationListener class
• Order of <listener> elements defines the order they are applied at
runtime
• Let’s create a Portlet URL Listener to override parameter value for
Ajax call on previously created Portlet:
File: /WEB-INF/src/com/sample/generic/listeners/ResourceURLListener.java
package com.sample.generic.listeners;
import javax.portlet.*;
public class ResourceURLListener implements PortletURLGenerationListener {
public void filterActionURL(PortletURL actionURL) {
}
public void filterRenderURL(PortletURL renderURL) {
}
public void filterResourceURL(ResourceURL resourceURL) {
resourceURL.setParameter
(
"ajax-parameter-greeting", "Hello World from Resource URL Listener"
);
}
}
45. Portlet URL Listeners (3) ARTISANS OF OPEN SOURCE
• Now, let’s define/enable our PorletFilter on each existing portlet:
File: /WEB-INF/portlet.xml
<portlet-app ...>
...
<public-render-parameter>...</public-render-parameter>
...
<listener>
<display-name>Hello World Portlet URL Listener</display-name>
<listener-class>com.sample.generic.listeners.ResourceURLListener</listener-class>
</listener>
...
</portlet-app>
After re-deploying our Portlet plugin and clicking on Portlet’s button:
46. Servlet Programming Features ARTISANS OF OPEN SOURCE
• If compared to Servlets, JSR-168 restricted the portlet programming
model in some areas because some Servlet model features -assuming only one
component on the page- are not easily applied on Portlets
• JSR-268 provides nearly the same capabilities as the Servlet programming model plus
the portlet specific extensions…
• Document head section elements, HTTP headers and Cookies: JSR-268
allows the portlet to contribute to sections of portal page outside its portlet window:
– Document head section elements: a two-part render call (RENDER_HEADER and
RENDER_MARKUP) is enabled in order portlets can return content outside the portlet window (ie.
HTML ones such as meta, link, or style) through GenericPortlet.doHeaders()
– HTTP Headers (ie. app-specific Pragma headers) via PortletResponse.setProperty()
– Cookies through PortletResponse.addProperty() at the response of each life-cycle method
(processAction, processEvent, render, and serveResource):
• Cookies are not guaranteed to be shared across different portlets and may be stored by the portal (not at the client)
• To set cookies in the render method, the renderHeaders option should be turned on and the cookies should be set in the
RENDER_HEADERS part by using overriding GenericPortlet.doHeaders()
• Dispatching to Servlets and JSPs: A portlet can invoke servlets and JSPs in
all lifecycle methods by using methods include() or forward() via a request
dispatcher (PortletContext.getRequestDispatcher()):
– Action/event can be dispatched to logic written in a servlet, or do forward in serving resource
– Servlet request/response objs given to the servlet/JSP are based on portlet request/response:
• Attributes set in the portlet request are available in the included servlet request
• The portlet and the included servlet or JSP share the same output stream
• Attributes set in the portlet session are accessible from the servlet session and vice versa
47. Annotations ARTISANS OF OPEN SOURCE
• JSR-268 introduces Annotations for directly
dispatching requests when using GenericPortlet to
ease configuration pain
– Annotation @ProcessEvent for event calls
@ProcessEvent(qname="{http://sample.com/events}ipc.speak.world")
public void processSpeakWorldEvent(EventRequest req, EventResponse res){...}
– Annotation @ProcessAction for action calls via a
ActionURL with parameter "javax.portlet.action” set:
@ProcessAction(name="speakWorld”)
public void speakWorld(ActionRequest request, ActionResponse response){...}
– Annotation @RenderMode for render calls for a
corresponding Portlet Mode
@RenderMode(name="VIEW")
public void speakWorld(RenderRequest request, RenderResponse response){...}
48. Tag Libraries ARTISANS OF OPEN SOURCE
• JSR-268 provides new tags to ease JSP development:
– <portlet:resourceURL>: build ResourceURL refering back to the portlet
– Attributes copyCurrentRenderParameters and escapeXML on
RenderURL, ActionURL and ResourceURL
– <portlet:namespace>: returns unique value for the current Portlet window
• Since Portlet’s markup is aggregated in same page, name of items that should be
unique should be “namespaced” through PortletRequest.getNamespace():
– Returned value is same/preserved for the entire lifetime of the Portlet window
– To be used to prefix names that should be unique (ie. html ids/names,
javascript functions/variables, etc)
<script type="text/javascript”>
…
function <portlet:namespace/>ajaxHelloWorld(url){...}
…
</script>
…
<input
type="button" value='Ajax!' title='<%=resourceUrl%>’
onclick="javascript:<portlet:namespace/>ajaxHelloWorld('<%=resourceUrl%>');”
/>
50. Questions? ARTISANS OF OPEN SOURCE
Introduction to Portlets using Liferay Portal
(Part 2)
By: Aníbal Gómez-Estrada
http://rivetlogic.com/web/agomez
October 19th, 2011
Rivet Logic Corporation Rivet Logic Costa Rica SRL
11410 Isaac Newton Square N. Costa Rica Developer's Forge
Suite 210 Edificio María Luisa, 3A office
Reston, VA 20190, USA Paseo Colón, San José, Costa Rica
Ph: 703.955.3480 Fax: 703.234.7711 Ph: (506) 2256-1024 Fax: (506) 2256-1024
51. References ARTISANS OF OPEN SOURCE
JSR 286: Portlet Specification 2.0
http://www.bluesunrise.com/portlet-api/javax/portlet/
package-summary.html
http://www.ibm.com/developerworks/websphere/library/
techarticles/0803_hepper/0803_hepper.html
http://developers.sun.com/portalserver/reference/techart/
jsr286/jsr286.html
http://download.oracle.com/docs/cd/E15919_01/wlp.1032/
e14244/javaportlets.htm#BCGIBGBJ
http://www.liferay.com
53. Available At My Blog! ARTISANS OF OPEN SOURCE
JSF 2.0 Portlets using Liferay Portal
Available At My Blog!
http://rivetlogic.com/web/agomez/
Contents
Introduction to Portlet Bridges
Setup and Hello World Portlet
Internationalization
Actions and Navigation
Portlet Preferences
Inter-Portlet Communication
54. Rivet Logic Is Hiring! ARTISANS OF OPEN SOURCE
We are hiring! Java developers – mcalvo@rivetlogic.com
• Award-winning consulting and systems integration firm
focused on enabling open source –based software solutions
for content management, collaboration and community:
– Innovator of the Year: JBoss (2008)
– Solution of the Year: Alfresco (2010)
– Platinum Partner: Liferay (2011)
• We use top-notch open source technology:
• Company Facts:
– Founded in 2005. Consistently Profitable and Employee-owned. 40+ Consultants
– Headquarters in Virginia, USA. Near-shore office in San José, Costa Rica for two years
– Certified Liferay Partner since 2006