+ All Categories
Home > Technology > OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

Date post: 08-May-2015
Category:
Upload: alkacon-software-gmbh
View: 1,382 times
Download: 3 times
Share this document with a friend
20
(c) 2012 eonas GmbH Portals in OpenCms Building JSF and portlet applications in openCms Presented by: Dipl.-Ing. Helmut Manck OpenCms conference 2012 25. September 2012
Transcript
Page 1: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

Portals in OpenCms Building JSF and portlet applications in openCms

Presented by: Dipl.-Ing. Helmut Manck

OpenCms conference 2012

25. September 2012

Page 2: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

Agenda

What are Portals good for?

• Scenarios, Market Players

• Common Architectural Issues

Portals in OpenCms

• How to build a portal

JSF and Portlets

• How to build a portlet

Page 3: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

Scenario: Company Intranet Typically a mix of content and web applications

Content

Process

Content

Navigation

Page 4: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

Architectural approaches

• Method I: Don't use a CMS = All programmatic

• Editors hand over articles to programmers

• Programmers integrate, test and release

• Good for Programmers, Bad for Editors

• Method II: Separate CMS and Applications

• Two independent parts: one CMS-driven, one programmatic driven.

• Clean and sweet until navigation and deep links are an issue.

Page 5: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

Architectural approaches

• Method III: Develop within CMS

• Each piece of code is a formatter, JSP-fragment, Template or similar

• Development within (Open)CMS

• Pro: Single location of code

• Con: IDE support, independent testing, technological freedom

• Or you use Portals...

Page 6: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

Method IV: Portals

Content Portlet

Content

Portlet

Portlet

Navigation

Page 7: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

POST /cms/test HTTP/1.1

Host: server

select=7

Portal Issues

• There are 3 Portlets on the Page. Who handles this POST-Request?

• Portals must provide:

• Name spacing

• Link Generation

• (with in HTML-Space and the generated URLs)

Page 8: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

Java Portlets: JSR-286

• Portlets are like Servlets

• own J2EE-Webapp (.war)

• own data source, jars, configuration, version

• plus a portlet.xml

• Portlets extend GenericPortlet

• “render”: Deliver HTML-Snippet

• “action”: Process POST

• “resource”: Deliver CSS, JS, Ajax

Page 9: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

Portlet example

- Build recipe based on maven

- Additional Libs

- J2EE-Configuration plus Portlet-Config

- The Portlet plus some logic classes

- Some JSPs to render the HTML-Snipplets

- Can be developed, tested, debugged locally with full IDE support (e.g. hot code replace)

Page 10: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

Example: Request Flow

1. A HTML-Snippet generates a POST-URL:

<p:actionURL var="target" name="choosemode"/>

<form name="form" action="${target}“ method="post">

2. Form-Submit triggers URL, then redirect to

processAction(request, response)

3. New HTML-Snipplet is rendered.

render(request,response)

Page 11: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

Market View

redhat

Page 12: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

OpenCms as Portal Server

OpenCms 7/8 Pluto Portal

(Reference implementation for JSR286)

OpenCms Portal - Maven Overlay

Portal Driver (glue logic)

Page 13: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

Anatomy of the Portal

- Maven overlays the base wars, builds the final war, Pluto requires a certain Spring version.

- web.xml must be heavily modified, spring support is required by pluto, add some filters - the driver ( = glue logic ) is referenced here

- context.xml: the portal needs enhanced privileges

- Storage location of the base wars

Page 14: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

PortletTag tag = new PortletTag();

tag.setPortletId(id);

tag.setPageContext(copy);

tag.doStartTag();

Using the Portlet Support

1. Create an opencmsportal.war

• Usual Setup-Process necessary

• Portlet support enabled, but no templates, formatters or

document types contained.

2. Create an OpenCms Module

• Define Look & Feel, CSS etc.

3. The selected portlet is rendered using API-Calls within the

formatter (usually)

Page 15: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

Creating the Portlet Module

- Maven Pom to build the Module

- Document Type Definition for a Portlet

- Formatter for a Portlet

OpenCms 8 Module

- Rest of the Module not affected

Page 16: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

JSF and Rich Client Widgets

• Several JSF Libraries provide nice, easy to use widgets

• Primefaces, Richfaces, ICEfaces

• Lots of widgets, mostly easy to use

• Ajax support “built in”, Partial updates, Push-Support

• E.g. Primefaces Datatable

• JSF is gaining traction

• Application development gets much faster

• Applications get a “rich client” look & feel

• How to integrate into a portlet?

Page 17: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

JSR 301 and JSR329

• JSR301 and JSR329:

• Transparent bridge between JSF and Portals

• A JSF Application can be made Portlet just by adding a few Jars and

some configuration (portlet.xml)

• Portal vendors are pushing this technology

• RedHat (Jboss)

• Liferay

• The Liferay-JSF-Bridge can be used with OpenCms/Pluto!

Page 18: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

Component Overview

Portlet B Webapp

Primefaces

Portlet A Webapp

Plain Portlet

OpenCms Portal

Pluto with Portal Driver

dispatch() - Render or Action

HTTP GET

JSF Bridge

Tomcat 6

Page 19: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

Real world example

Example: A simple voting portlet

• Backend: Spring/Hibernate/AOP

• Frontend: Primefaces

Page 20: OpenCms Days 2012 - OpenCms 8 as a JSR-286 compliant portlet server

(c) 2012 eonas GmbH

Fragen?

Dipl. Ing. Helmut Manck

Geschäftsführer

eonas IT-Beratung und Entwicklung GmbH

Pascalstr. 10A

10587 Berlin

Germany

[email protected]

Telefon +49-30-3980 522 – 10

20


Recommended