Wednesday 21 September 2011

JSR-286 Key features?

1. Resource serving:
Invoking a Portlet directly  ( but still through the Portal ) API: MimeResponse.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 )

2.Extended Cache
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 (  ) .isPublicScope (  ) , .setPublicScope ( boolean )                .getETag (  ) , .setETag ( String ) .useCachedContent (  ) , .setUseCachedContent ( boolean )
Better Web Platform support Allow servlet dispatching, including using forwards, from: processAction processEvent render serveResource Optionally providing a PORTLET_SCOPEd session to Servlets Extended JSP tag library using new taglib uri "http://java.sun.com/portlet_2_0" Bridging and native integration underway for JSF  ( JSR-301 ) and Apache Wicket  ( 1.3+ )


3.Portlet Coordination – Portlet Events
Events must be defined in portlet.xml After event definition, each portlet must declare what events it will publish or receive Portal-defined events do not have to be defined in portlet.xml Event naming: Must use the W3C QName standard Receiving events can end with a * wildcard Can declare default-event-namespace in portlet.xml and just use local names A portlet declares the events it wants to receive or send in portlet.xml using Qnames or by using a default namespace: <defaultnamespace> http://acme.com/events</defaultnamespace> <eventdefinition> <name>foo</name> <javaclass> java.lang.String</javaclass> </eventdefinition> <portlet> <portletname> PortletA</ portletname> ... <supportedprocessingevent> <qname xmlns:x=”http://acme.com/events”>x:foo</qname> </supportedprocessingevent> <supportedpublishingevent> <name>foo</name> </supportedpublishingevent>

</portlet>
Sending non-declared events at runtime is allowed too Allows wiring of portlets at runtime The portal / portlet container will act as broker The portal or portlet container can also send events Formally not 100% reliable, i.e. no guarantee of delivery  ( mainly for WSRP, “local” portals are less limited ) New 3rd life cycle phase: before rendering API: EventPortlet.processEvent ( EventRequest req, EventResponse res ) StateAwareResponse.setEvent ( QName name, Serializable value ) StateAwareResponse.setEvent ( String name, Serializable value )

4.Portlet Filters -
Modeled after Servlet Filters Modify request data by wrapping request Modify response data by wrapping response Intercept invocation of a portlet before and after it is called Filters may be chained Defined in portlet.xml  <filter> <filter-name>Event Filter</filter-name> <filter-class>com.acme.EventFilter</filter-class> </filter> <filter-mapping> <filter-name>Event Filter</filter-name> <portlet-name>SamplePortlet</portlet-name> <lifecycle>EVENT</lifecycle> </filter-mapping> Must implement javax.portlet.Filter interface Must provide a public no-arg constructor init (  ) method will be called on all Filters before being called on any Portlets destroy (  ) will be called if Filter is removed from service doFilter (  ) method called if processAction (  ) , processEvent (  ) , render (  ) , or serveResource (  ) would be called on Filtered Portlet
Redirect to login page after session timeout?


No comments:

Post a Comment