View Javadoc

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