Portlet Filters and Portlet windows
In the 1th part of this series, we briefly review the JSR-2.0 portlet and introduce the new features of the JSR 286 portlet in detail, with parts 2nd and 3rd going through the development and deployment of portlets on the Apache Pluto platform Application to introduce to readers how the new features of the JSR 286 Portlet are used. This article describes the Portlet Filter and Portlet window application development for the JSR 286 portlet.
About this series
This series is designed for developers who have a JSR portlet development base and want to learn about the new features and development processes of the JSR 286 portlet. After completing this series, you will learn what enhancements are available relative to the JSR PORTLET,JSR 286 Portlet, and how these new features are applied in real-world development.
Part 1th of this series briefly reviews the JSR-a portlet and lists what's new in the JSR 286 portlet. Parts 2nd and 3rd will provide readers with a way to use the new features of the JSR 286 portlet by developing and deploying Portlet applications on the Apache Pluto 2.0 platform.
About this article
This article takes part 2nd to continue with the development of portlet Filter and Portlet window application for the JSR 286 portlet. Before reading this article, you should have an idea of the JSR Portlet and read the 1th and 2nd parts of this series.
Portlet Filters
By introducing the 1th part, we know that the Portlet filters are divided into:
Action Filter
Render Filter
Resource Filter
Event Filter
We will first introduce each of the four Portlet filters separately, then combine the four Portlet filters for further development, and finally use the combination of servlet filters to make the reader aware that the Portlet filters and servlet The relationship and difference between filters.
Action Filter
New Java class Testactionfilter:
Listing 1. Testactionfilter.java file
Package com.ibm.samples.jsr286.filters;
Import ...
public class Testactionfilter implements Actionfilter {
private static log log = Logfactory.getlog (Testactionfilter.class);
Private Filterconfig Filterconfig;
public void init (Filterconfig filterconfig) throws Portletexception {
Log.info ("Action filter [" + Filterconfig.getfiltername ()
+ "] is initialized.");
This.filterconfig = Filterconfig;
}
public void Destroy () {
Log.info ("Action filter [" + Filterconfig.getfiltername ()
+ "] is destroyed.");
}
public void Dofilter (Actionrequest actionrequest,
Actionresponse Actionresponse, Filterchain filterchain)
Throws IOException, Portletexception {
Log.info ("Action filter [" + Filterconfig.getfiltername ()
+ "] is called.");
Filterchain.dofilter (Actionrequest, actionresponse);
}
}