Implementing Portlet Filter - Websphere

This is a discussion on Implementing Portlet Filter - Websphere ; Hi, I tried implementing a portlet filter in WPS 6.1. The steps are 1) Updated PortletFilterService.properties under /PortalServer/config # ------ Login User Filter ------ # # filter name, required filtername14 = LoginUserLogFilter # filter implementation class, required LoginUserLogFilter.classname = com.aig.filters.LoginUserLogFilter ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Implementing Portlet Filter

  1. Implementing Portlet Filter

    Hi,

    I tried implementing a portlet filter in WPS 6.1. The steps are
    1) Updated PortletFilterService.properties under /PortalServer/config
    # ------ Login User Filter ------ #
    # filter name, required
    filtername14 = LoginUserLogFilter
    # filter implementation class, required
    LoginUserLogFilter.classname = com.aig.filters.LoginUserLogFilter
    # supported methods, at least one is required
    LoginUserLogFilter.method.2 = service
    # configuration parameter, optional
    LoginUserLogFilter.Trace = true

    2) I copied the JAR file to /shared/app

    3) Updated PortletContainerService.properties file
    legacy.portlet.enable.filtering = true
    4) In the Portlet Configuration FilterChain=LoginUserLogFilter parameter is set

    But the request is not being intercepted by PortletFilter. Did I miss any steps?
    Can someone please help me?

    Thanks

  2. Re: Implementing Portlet Filter

    Hi Lahiri,

    do you solved the problem?

    I'm using WebSphere Portal 6.1 and made all the changes you've done but the filter won't be invoked. I've also added the filter in my portlet.xml descriptor. In JBoss Portal it works fine...

    Thanks!

  3. Re: Implementing Portlet Filter

    Hello,
    Did you solve the problem? I am facing the same problem. I've just completed the following tasks:

    1. Enabled the portlet fltering by the following line of PortletContainerService.properties file under PortletContainerService.properties directory:
    #
    # Portlet filtering
    #
    # Default: true
    #
    legacy.portlet.enable.filtering = true
    #
    # Allow property broker processing of portlet actions
    #


    2. Set the PortletContainerService.properties under C:\IBM\WebSphere\PortalServer\config\properties
    filtername14 = MyPortletFilter
    # filter implementation class, required
    MyPortletFilter.classname = com.sample.MyPortletFilte

    # supported methods, at least one is required
    MyPortletFilter.method.1 = service
    MyPortletFilter.method.2 = doTitle

    # configuration parameter, optional
    MyPortletFilter.Trace = true

    3. Implement a simle Filter and export the jar to C:\IBM\WebSphere\PortalServer\shared\app\

    public class MyPortletFilter extends PortletFilterAdapter {

    public MyPortletFilter() {
    super();
    System.out.println("MyPortletFilter() constructor called");
    System.out.flush();
    }

    public void init(PortletFilterConfigImpl filterConfig) throws PortletException
    {

    System.out.println(" init() --entering");
    super.init(filterConfig);

    ServletContext context;
    boolean trace = false;;
    super.init(filterConfig);
    context = filterConfig.getPortalContext();
    String param = filterConfig.getInitParameter("Trace");
    if ((param!=null)&&(param.equalsIgnoreCase("true"))) {
    trace = true;
    }
    context.log("Trace = " + trace);

    System.out.println(" myFilter initialized");
    System.out.flush();
    }

    public void doService(PortletRequestWrapper request,PortletResponseWrapper response, PortletFilterChainImpl filterChain) throws PortletException, IOException
    {
    System.out.println("doService() -- entering");
    filterChain.doFilter(request, response);
    System.out.println("doService() -- leaving");
    }

    public void doTitle(PortletRequestWrapper request,PortletResponseWrapper response, PortletFilterChainImpl filterChain) throws PortletException, IOException {
    System.out.println("doTitle() -- entering");
    super.doTitle(request, response, filterChain);
    System.out.println("doTitle() -- leaving");
    }
    }

    4. Set the FilterChain parameter on portlet manager page as MyPortletFilter

    5. Additionally, I've added the following lines to portlet.xml under portlet's related WE-INF directory:


    MyPortletFilter
    com.sample.MyPortletFilter
    RENDER_PHASE
    ACTION_PHASE

    message
    My Sample Portlet Filter




    MyPortletFilter
    My_Portlet



    Could you please give an advice if you see a missing point? When I click on the porlet, nothing happens.. I can not see the system out messages in my console..

+ Reply to Thread