Documentation

Trace: Portlet integration

(applications)

Portlet integration

If you want to use Vaadin UI with Liferay Portlets, use following security manager in your config.xml:

<?xml version="1.0" encoding="UTF-8"?>
 
<application>
  <securitymanager>
    <class>
    com.sibvisions.apps.vaadin.portlet.server.security.PortletSecurityManager
    </class>
...

and following code in your Session life-cycle object:

public IWorkScreenAccess getWorkScreenAccess()
{
    PortletWorkScreenAccess wosc = (PortletWorkScreenAccess)get("workScreenAccess");
 
    if (wosc == null)
    {
        wosc = new PortletWorkScreenAccess();
 
        put("workScreenAccess", wosc);
    }
 
    return wosc;
}

The PortletSecurityManager uses current Liferay user and PortletWorkScreenAccess uses configured user roles. The security manager sets the configured portlet screen as default screen. This screen will be shown in Liferay.

To configure the default screen, add an additional parameter to your portlet.xml:

<init-param>
  <name>screen</name>
  <value>com.sibvisions.apps.vaadin.portlet.screens.ContactsWorkScreen</value>
</init-param>

An example portlet.xml with complete configuration:

<?xml version="1.0"?>
 
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0">
   <portlet>
      <portlet-name>VaadinApps</portlet-name>
      <display-name>VaadinApps</display-name>
      <portlet-class>com.sibvisions.rad.ui.vaadin.server.VaadinPortlet</portlet-class>
      <init-param>
         <description>Vaadin UI class to use</description>
         <name>UI</name>
         <value>com.sibvisions.rad.ui.vaadin.impl.VaadinUI</value>
      </init-param>
      <init-param>
         <description>Application widgetset</description>
         <name>widgetset</name>
         <value>com.sibvisions.rad.ui.vaadin.ext.ui.Widgetset</value>
      </init-param>
      <init-param>
         <name>main</name>
         <value>com.sibvisions.apps.projx.ProjX</value>
      </init-param>
      <init-param>
         <name>config</name>
         <value>/com/sibvisions/apps/vaadin/portlet/application.xml</value>
      </init-param>
      <init-param>
         <name>Application.setup.classname</name>
         <value>com.sibvisions.apps.vaadin.portlet.PortletApplicationSetup</value>
      </init-param>
      <init-param>
         <name>screen</name>
         <value>com.sibvisions.apps.vaadin.portlet.screens.ContactsWorkScreen</value>
      </init-param>
      <init-param>
         <name>vaadin.resources.portletContainerMode</name>
         <value>true</value>
      </init-param>
      <expiration-cache>0</expiration-cache>
      <supports>
         <mime-type>text/html</mime-type>
      </supports>
      <portlet-info>
         <title>VaadinApps</title>
         <short-title>VaadinApps</short-title>
         <keywords>VaadinApps</keywords>
      </portlet-info>
      <security-role-ref>
         <role-name>administrator</role-name>
      </security-role-ref>
      <security-role-ref>
         <role-name>guest</role-name>
      </security-role-ref>
      <security-role-ref>
         <role-name>power-user</role-name>
      </security-role-ref>
      <security-role-ref>
         <role-name>user</role-name>
      </security-role-ref>
   </portlet>
</portlet-app>
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information