0% found this document useful (0 votes)
347 views

SR-286: Portlet Specification 2.0

The document discusses the JSR-286 Portlet Specification 2.0, which aims to improve upon JSR-168. Key features include portlet coordination through public render parameters and events, resource serving for partial AJAX support, portlet filters, extended caching, and improved support for common web frameworks and AJAX through features like servlet dispatching and optional portlet-scoped sessions. The specification is in its final stages with a planned release in late summer 2007.

Uploaded by

kameshwar2004
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
347 views

SR-286: Portlet Specification 2.0

The document discusses the JSR-286 Portlet Specification 2.0, which aims to improve upon JSR-168. Key features include portlet coordination through public render parameters and events, resource serving for partial AJAX support, portlet filters, extended caching, and improved support for common web frameworks and AJAX through features like servlet dispatching and optional portlet-scoped sessions. The specification is in its final stages with a planned release in late summer 2007.

Uploaded by

kameshwar2004
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

JSR-286: Portlet Specification 2.

0
SR-286: Portlet Specification 2.0
What is a Portal?
“ A portal is a web based application that –commonly provides personalization,
single sign on, content aggregation from different sources and hosts the
presentation layer of Information Systems.”R-286: Portlet Specification 2.0
What is a Portlet?
“A portlet is a Java technology based web component managed by a portlet
container that processes requests and generates dynamic content.
Portlets are used by portals as pluggable user interface components that provide
a presentation layer to Information Systems.”86: Portlet Specification 2.0
What is a Portlet Container
“A portlet container runs portlets and provides them with the required runtime
environment. A portlet container contains portlets and manages their lifecycle.”
“A portlet container receives requests from the portal to execute requests on the
portlets hosted by it.”
JSR-286: Portlet Specification 2.0

JSR-286: Portlet Specification 2.0


JSR-168 – What is missing?
• inter-portlet communication / portlet coordination
• serving non-html resources (pdf, doc, images etc.)
• portlet filters
• contributing javascript or css to <head>, using cookies
• proper support for common web frameworks
• AJAX
Inter-portlet communication
• only supported within the same portlet application using
session attributes
• target portlets will only “see” messages during next
render request
• portlets cannot (should not) update their state during a
render request: “event” handling not really possible
Serving non-html resources
• A portlet can only render html fragments
• Have to fallback/delegate to the servlet container
• Requires coordination between portlet and servlet
Contributing to <head>, setting cookies
• javascript or css can only be embedded withing the
content markup; no body onLoad handling hooks
• API forbids adding cookies: only client side setting of
cookies using javascript is possible
Proper support for common web frameworks
• Most web frameworks are still primarily (or only) Servlet
API oriented, and with reason
• Servlet dispatching not supported from processAction
• Needs Portals Bridges or similar solutions
• Split between Action and Render makes migration
painful
• “Unaware” servlets only “see” the application scope session
• JSP/JSTL support very limited:
<c:out value=”<%= ((FooBean)renderRequest.getSession()
.getAttribute("fooBean",PortletSession.PORTLET_SCOPE))
.getBeanValue() %>"/>
AJAX
• Many portals actually do support AJAX now
• But: none of that is support through the spec.
• Requires custom / portal specific extensions
• No portable solution possible

JSR-286

• Portlet Specification 2.0


• Expert Group started January 2006
• 1st Early Public Draft was released August 2006
covering most, but not yet all, planned features
• Several public but not-official public early drafts
• Currently at revision 14, d.d. 2007-04-27, now covering
(almost) all planned features
• Final Release planned (late) Summer 2007
• RI done under Apache Pluto umbrella with help from a
developers group at University of Jena
JSR-286: Main Features
• Alignment with J2EE 1.4, WSRP 2.0
• Portlet coordination
• Public Render Parameters
• Portlet Events
• Resource serving (which can be used for partial AJAX support)
• Portlet Filters
• Extended Cache support
• Container runtime options
• Improved support for common web frameworks
JSR-286: Public render Parameters
• Coordination of render state with other portlets across
web applications
• Limited to String values
• Defined in portlet.xml using QNames:
<publicrenderparameter>
<identifier>foo</identifier>
<name xmlns:x=”http://acme.com/parameters”>x:foo.2</name>
</publicrenderparameter>
<portlet>
<portletname>
PortletA</
portletname>
...
<supportedpublicrenderparameter>
<name>foo</name>
</supportedpublicrenderparameter>
</portlet>
JSR-286: Portlet Events
• A portlet declares the events it wants to receive or emit
in portlet.xml using QNames:
<eventdefinition>
<name xmlns:x=”http://acme.com/events”>x:foo</name>
<javaclass>
java.lang.String</javaclass>
</eventdefinition>
<portlet>
<portletname>
PortletA</
portletname>
...
<supportedprocessingevent>
<name xmlns:x=”http://acme.com/events”>x:foo</name>
</supportedprocessingevent>
<supportedpublishingevent>
<name xmlns:x=”http://acme.com/events”>x:foo</name>
</supportedpublishingevent>
</portlet>
• Emitting dynamic non-declared events is allowed too
Allows wiring of portlets at runtime
• The portal / portlet container will act as broker
• The portal or portlet container can also emit events
• Formally not 100% reliable, i.e. no guarantee of delivery
(mainly for WSRP, “local” portals are less limited)
• New 3rd lifecyle phase: before rendering
• API:
EventPortlet.processEvent(EventRequest req,EventResponse res)
StateAwareResponse.setEvent(String name,Object value)
StateAwareResponse.setEvents(Map events)
• Can be send from both processAction and processEvent
• State changes are allowed during processEvent
• Will be delivered in “order” as send out by the Portlet
JSR-286: Resource Serving
• New type of PortletURL and request handler
• API:
PortletResponse.createResourceURL()
ResourceServingPortlet.serveResource(ResourceRequest, ResourceResponse)
• Extends the render phase, NOT a new life-cycle phase
• POST, PUT, DELETE supported
• Should not change shared portlet state
• Additional URL parameters are specific for the request
• Full control over request and response headers
• Can be used for binary data or “readonly” AJAX
(cannot change navigational state)
JSR-286: Native AJAX support
Was intended and discussed at large
• But: will not be part of this spec
• AJAX request identification
• synchronizing state changes to the client for other portlets on the page
• XMLPortletRequest or plain XMLHttpRequest
• integration with popular AJAX toolkits
• Too many not yet unknown or fully thought through use-cases
• Instead: guidelines will be provided for common use-cases
with possible solutions (in concerto with WSRP 2.0 team)
• Let the community determine a feasible API first
JSR-286: Portlet Filters
• Allow on the fly transformations of information in both
the request to and the response from the portlet
• Modelled after Servlet filters
• Defined in portlet.xml:
<filter>
<filtername>
Event Filter</filtername>
<filterclass>
com.acme.EventFilter</filterclass>
<lifecycle>EVENT_PHASE</lifecycle>
</filter>
<filtermapping>
<filtername>
Event Filter</filtername>
<portletname>
SamplePortlet</portletname>
</filtermapping>
<filtermapping>
<filtername>
Event Filter</filtername>
<portletname>
OtherPortlet*</portletname>
</filtermapping>
JSR-286: Extended Cache support
• Allow public cached content for multiple users
<portlet>
...
<expirationcache>
<expirationtime>
300</expirationtime>
<scope>public</scope>
</expirationcache>
</portlet>
• Support validation based caching using ETAG
• API:
response.getCacheControl()
.getExpirationTime(), .setExpirationTime()
.getPublicScope(), .setPublicScope(boolean)
.getETag(), .setETag(String)
.useCachedContent(), .setUseCachedContent(boolean)
JSR-286: Better web framework support
• Allow servlet dispatching during all lifecycle calls:
• processAction
• processEvent
• render
• serveResource (including using forward)
• Optional providing a PORTLET_SCOPED session to servlets
(as container runtime option, see next slide)
• Extended JSP tag library
• <portlet:defineObjects/>
• <portlet:action|renderURL copyCurrentRenderParameters=”true”
escapeXml=”false”>
• <portlet:resourceURL>
JSR-286: Container runtime options
• Defineable in portlet.xml on both application and portlet level
• Queryable from PortletContext
• Three predefined options:
– javax.portlet.escapeXml (for backwards compatibility)
– javax.portlet.renderHeaders
– javax.portlet.includedPortletSessionScope
<containerruntimeoption>
<name>javax.portlet.includedPortletSessionScope</name>
<value>PORTLET_SCOPE</value>
</containerruntimeoption>
JSR-286: ... and more ...
• Create PortletURLs within all life-cycle phases
• PortletRequest.getWindowID()
• RenderResponse.setNextAvailablePortletModes()
• Contributing to HTTP and HTML headers: doHeaders(...)
• Java 5 annotation support for events in GenericPortlet:
@ProcessEvent(name=”{http://acme.com/events}foo”)
void processFoo(EventRequest request, EventResponse response)
throws PortletException, java.io.IOException;
• JSR-188: Composite Capability/Preference Profiles:
request attribute PortletRequest.CCPP_PROFILE

You might also like