| 1 |
/* |
| 2 |
* Copyright 2004-2006 The Portal Application Laboratory Team. |
| 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, |
| 13 |
* either express or implied. See the License for the specific language |
| 14 |
* governing permissions and limitations under the License. |
| 15 |
*/ |
| 16 |
package jp.sf.pal.wiki.portlet; |
| 17 |
|
| 18 |
import java.io.IOException; |
| 19 |
|
| 20 |
import javax.portlet.ActionRequest; |
| 21 |
import javax.portlet.ActionResponse; |
| 22 |
import javax.portlet.PortletException; |
| 23 |
import javax.portlet.RenderRequest; |
| 24 |
import javax.portlet.RenderResponse; |
| 25 |
|
| 26 |
import jp.sf.pal.wiki.WikiConstants; |
| 27 |
import jp.sf.stconv.wiki.pipeline.callback.LinkGeneratorCallback; |
| 28 |
|
| 29 |
import org.apache.commons.logging.Log; |
| 30 |
import org.apache.commons.logging.LogFactory; |
| 31 |
import org.apache.portals.bridges.portletfilter.PortletFilter; |
| 32 |
import org.apache.portals.bridges.portletfilter.PortletFilterChain; |
| 33 |
import org.apache.portals.bridges.portletfilter.PortletFilterConfig; |
| 34 |
|
| 35 |
/** |
| 36 |
* @author shinsuke |
| 37 |
* |
| 38 |
*/ |
| 39 |
public class WikiPortletFilter implements PortletFilter { |
| 40 |
/** |
| 41 |
* Logger for this class |
| 42 |
*/ |
| 43 |
private static final Log log = LogFactory.getLog(WikiPortletFilter.class); |
| 44 |
|
| 45 |
/* |
| 46 |
* (non-Javadoc) |
| 47 |
* |
| 48 |
* @see org.apache.portals.bridges.portletfilter.PortletFilter#destroy() |
| 49 |
*/ |
| 50 |
public void destroy() { |
| 51 |
} |
| 52 |
|
| 53 |
/* |
| 54 |
* (non-Javadoc) |
| 55 |
* |
| 56 |
* @see org.apache.portals.bridges.portletfilter.PortletFilter#init(org.apache.portals.bridges.portletfilter.PortletFilterConfig) |
| 57 |
*/ |
| 58 |
public void init(PortletFilterConfig filterConfig) throws PortletException { |
| 59 |
} |
| 60 |
|
| 61 |
/* |
| 62 |
* (non-Javadoc) |
| 63 |
* |
| 64 |
* @see org.apache.portals.bridges.portletfilter.PortletFilter#processActionFilter(javax.portlet.ActionRequest, |
| 65 |
* javax.portlet.ActionResponse, |
| 66 |
* org.apache.portals.bridges.portletfilter.PortletFilterChain) |
| 67 |
*/ |
| 68 |
public void processActionFilter(ActionRequest request, |
| 69 |
ActionResponse response, PortletFilterChain chain) |
| 70 |
throws PortletException, IOException { |
| 71 |
chain.processActionFilter(request, response); |
| 72 |
} |
| 73 |
|
| 74 |
/* |
| 75 |
* (non-Javadoc) |
| 76 |
* |
| 77 |
* @see org.apache.portals.bridges.portletfilter.PortletFilter#renderFilter(javax.portlet.RenderRequest, |
| 78 |
* javax.portlet.RenderResponse, |
| 79 |
* org.apache.portals.bridges.portletfilter.PortletFilterChain) |
| 80 |
*/ |
| 81 |
public void renderFilter(RenderRequest request, RenderResponse response, |
| 82 |
PortletFilterChain chain) throws PortletException, IOException { |
| 83 |
String pageName = request.getParameter(LinkGeneratorCallback.PAGE_NAME); |
| 84 |
if (pageName != null) { |
| 85 |
request.getPortletSession().setAttribute( |
| 86 |
WikiConstants.CURRENT_PAGE_NAME, pageName); |
| 87 |
} |
| 88 |
|
| 89 |
chain.renderFilter(request, response); |
| 90 |
|
| 91 |
} |
| 92 |
} |