View Javadoc

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *      http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   */
    17  package org.apache.portals.bridges.portletfilter;
    18
    19
    20  import java.io.IOException;
    21
    22  import javax.portlet.ActionRequest;
    23  import javax.portlet.ActionResponse;
    24  import javax.portlet.PortletException;
    25  import javax.portlet.RenderRequest;
    26  import javax.portlet.RenderResponse;
    27
    28  /***
    29   * A filter is an object that performs filtering tasks on either the request
    30   * to a resource (a portlet), or on the response from a resource, or both.
    31   *
    32   * Filters perform filtering in the renderFilter and processActionFilter
    33   * method. Every Filter has access to a PortletFilterConfig object from
    34   * which it can obtain its initialization parameters, a reference to the
    35   * PortletConfig which it can use, for example, to load resources needed
    36   * for filtering tasks. Filters are configured in the deployment descriptor
    37   * of a portlet(portlet.xml).
    38   *
    39   * @author <a href="mailto:shinsuke@yahoo.co.jp">Shinsuke Sugaya</a>
    40   */
    41  public interface PortletFilter
    42  {
    43
    44      /***
    45       * Called by init method of FilterPortlet to initialize this
    46       * portlet filter.
    47       *
    48       * @param filterConfig
    49       * @throws PortletException
    50       */
    51      public abstract void init(PortletFilterConfig filterConfig) throws PortletException;
    52
    53      /***
    54       * Called by render method of FilterPortlet to put tags, such as
    55       * &lt;style&gt;, into &lt;head&gt;.
    56       *
    57       * @param request
    58       * @param response
    59       * @param chain PortletFilterChain instance
    60       * @throws PortletException
    61       */
    62      public abstract void renderFilter(RenderRequest request, RenderResponse response, PortletFilterChain chain)
    63              throws PortletException, IOException;
    64
    65      /***
    66       * Called by render method of FilterPortlet to wrap the request
    67       * when it has a multipart content.
    68       *
    69       * @param request
    70       * @param response
    71       * @param chain PortletFilterChain instance
    72       * @throws PortletException
    73       */
    74      public abstract void processActionFilter(ActionRequest request, ActionResponse response, PortletFilterChain chain)
    75              throws PortletException, IOException;
    76
    77      /***
    78       * Called by destroy method of FilterPortlet to destroy this
    79       * portlet filter.
    80       *
    81       * @throws PortletException
    82       */
    83      public abstract void destroy();
    84
    85  }