O'Reilly logo

GateIn Cookbook by Piergiorgio Lucidi, Luca Stancapiano, Ken Finnigan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Securing portlets

Now let us see how to secure a new portlet that uses only standard configurations.

Getting ready

In this recipe, we will access these Java Web Technologies:

  • JSP/Servlet
  • Portlet 286
  • WebUI

How to do it…

This is the structure of a simple project working with portlets:

How to do it…

The web.xml file contains only an empty web-app tag to allow the deployment of the application.

Here is the welcome.jsp:

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>

<portlet:defineObjects />

<div class="portlet-section-header">
        
  | <%=renderRequest.isUserInRole("users")%>
        
  | <%=renderRequest.isUserInRole("administrators")%>
</div>

Add the following roles ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required