Beruflich Dokumente
Kultur Dokumente
Rosario Iannella
JSR168 Concepts
Rosario Iannella
30/11/2009
Agenda
2 11/30/09
A
A portlet
portal is
portletis aa web
Javabased
container technology based
runs application
portlets andthatweb–commonly-
component,
provides managed
provides
them with by a runtime
portlet container,
personalization,
the required single that
environment.
processes
sign on, ……
A portlet requests and
A portal
container generates
may
containshave dynamic
sophisticated
portlets and manages content. Portlets
personalization
their are used to
features
lifecycle. by portals as pluggable
provide
user
It also Part I: JSR 168 Specification
customized
interface
provides contentstorage
components
persistent to users
that provide a presentation
for. [PLT.2.1]
portlet layer
preferences. to Information
A portlet Systems.
container receives[PLT.2.2]
requests
from the portal to execute requests on the portlets hosted by it. 30 [PLT.2.3]
Portal Definition
§
§
Portlet Container
Portlet
3 11/30/09
Part I: JSR 168 Specification
4 11/30/09
Part I: JSR 168 Specification
§ Significant Types:
• PortletConfig
• PortletContext
• PortalContext
• Portlet
• PortletSession
5 11/30/09
Part I: JSR 168 Specification
Portlet Config:
6 11/30/09
Part I: JSR 168 Specification
PortletContext:
7 11/30/09
Part I: JSR 168 Specification
PortalContext:
8 11/30/09
Part I: JSR 168 Specification
Portlet:
A portlet is managed through a well defined life cycle that defines how it
is loaded, instantiated and initialized, how it handles requests from
clients, ….. This life cycle of a portlet is expressed through the init,
processAction, render and destroy methods of the Portlet interface…
•Lifecycle:
•Init()
•Destroy()
•Request Processing:
•ProcessAction()
•RenderRequest
9 11/30/09
Part I: JSR 168 Specification
10 11/30/09
Part I: JSR 168 Specification
PortletSession:
11 11/30/09
Part I: JSR 168 Specification
Portlet Mode:
12 11/30/09
Part I: JSR 168 Specification
13 11/30/09
Part II: JSR168 and the MVC Pattern
Model-View-Controller (MVC)
software architecture that separates an application's data model,
user interface, and control logic into three distinct components so
that modifications to the view component can be made with
minimal impact to the data model component.
14 11/30/09
Part II: JSR168 and the MVC Pattern
15 11/30/09
Part II: JSR168 and the MVC Pattern
MVC: Features
§Request Parameter Mapping
§Request Handlers
§Request Validation
§Views
§
16 11/30/09
Part III: Spring MVC Portet
Portlet.xml Configuration
<portlet>
<description>Search Portlet</description>
<portlet-name>SearchPortlet</portlet-name>
<display-name>SearchPortlet</display-name>
<portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
<init-param>
<name>contextConfigLocation</name>
<value>/WEB-INF/context/SearchPortlet-portlet.xml</value>
</init-param>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
<portlet-mode>config</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
<portlet-info>
<title>Search by category Portlet</title>
<short-title>SP</short-title>
<keywords>Search</keywords>
</portlet-info>
</portlet>
17 11/30/09
Part III: Spring MVC Portet
SearchPortlet-portlet.xml: HandlerMapping
<bean id="portletModeParameterHandlerMapping"
class="org.springframework.web.portlet.handler.PortletModeParameterHandlerMapping">
<property name="order" value="0" />
<property name="portletModeParameterMap">
<map>
<entry key="config"> Mode
<map> ParameterValue
<entry key=“queryStr"><ref bean=“queryPortletController"/></entry>
<entry key=“advanced"><ref bean=“advancedSearch"/></entry>
</map>
</entry>
</map>
</property>
<property name="parameterName" value="setaction" />
</bean>
18 11/30/09
Part III: Spring MVC Portet
SearchPortlet-portlet.xml: HandlerMapping
<bean id="portletModeHandlerMapping"
class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
<property name="order" value="1" />
<property name="portletModeMap">
<map>
Mode
<entry key="config"><ref local=“configPortletController"/></entry>
<entry key="view"><ref local=“displayPortletController"/></entry>
</map>
</property>
</bean>
19 11/30/09
Part III: Spring MVC Portet
SearchPortlet-portlet.xml: Controller
<bean id=“displayPortletController" class=“portlet.mvc.DisplayPortletController">
<property name="commandName" value="DisplayCommand" />
<property name="commandClass" value="portlet.command.DisplayCommand" />
</bean>
20 11/30/09
Part III: Spring MVC Portet
SearchPortlet-portlet.xml: View
<bean id=“myView" class=“org.springframework.web.servlet.view.JstlView">
<property name="url" value=“/jsp/searchView.jsp" />
</bean>
21 11/30/09
Part III: Spring MVC Portet
errors.rejectValue(PortletConstants.queryString,"",ErrorMessages.MISSINGVALUE);
22 11/30/09
Part IV: Pattern - Builder
23 11/30/09
Part IV: Pattern - Builder
Builder
24 11/30/09
Part IV: Pattern - Builder
BuildContentSource
BuildContentType
BuildView
BuildByChannel/Byco
ntent/ByFeed
BuildLabels
25 11/30/09
Part IV: Pattern - Builder
String contentSource
SettingPageBuilder = parameterAdapter.getParameter(PortletConstants.contentSource);
pageBuilder = new CQSettingPage(modelAndView, renderRequest);
Content content = (Content)ServiceManager.getInstance().getService(contentSource);
pageBuilder.buildPage(action);
….
modelAndView.addObject(PortletConstants.orderableAttributes,content.getOrderableAttrib
public
utes());class CQSettingPage extends AbstractSettingPageBuilder {
this.getParameterAdapter().setType(ParameterAdapter.PREFERENCES);
modelAndView.addObject(type,parameterAdapter.getParameter(type));
} this.buildContentSource();
this.buildContentType();
this.buildFilterBy();
// build view for type: channel
this.buildDisplayView(viewForType);
this.buildLabels();
26 11/30/09
Questions ?
27 11/30/09