1 | package org.apache.pluto.driver.tags; |
2 | |
3 | import java.io.IOException; |
4 | |
5 | import javax.servlet.http.HttpServletRequest; |
6 | import javax.servlet.jsp.JspException; |
7 | import javax.servlet.jsp.tagext.TagSupport; |
8 | |
9 | import org.apache.pluto.PortletWindow; |
10 | import org.apache.pluto.driver.AttributeKeys; |
11 | |
12 | /** |
13 | * The portlet header links tag is used to print the dynamic portlet links to |
14 | * the page. |
15 | */ |
16 | public class PortletHeaderLinksTag extends TagSupport { |
17 | |
18 | // TagSupport Impl --------------------------------------------------------- |
19 | |
20 | /** |
21 | * Method invoked when the start tag is encountered. This method retrieves |
22 | * the portlet title and print it to the page. |
23 | * |
24 | * @see org.apache.pluto.services.PortalCallbackService#setTitle(HttpServletRequest, |
25 | * PortletWindow, String) |
26 | * @see org.apache.pluto.driver.services.container.PortalCallbackServiceImpl#setTitle(HttpServletRequest, |
27 | * PortletWindow, String) |
28 | * |
29 | * @throws JspException |
30 | */ |
31 | public int doStartTag() throws JspException { |
32 | |
33 | // Ensure that the portlet header links tag resides within a portlet tag. |
34 | PortletTag parentTag = (PortletTag) TagSupport.findAncestorWithClass(this, PortletTag.class); |
35 | if (parentTag == null) { |
36 | throw new JspException("Portlet header links tag may only reside within a pluto:portlet tag."); |
37 | } |
38 | |
39 | // Print out the portlet header links to page. |
40 | try { |
41 | String header = (String) pageContext.getRequest().getAttribute(AttributeKeys.PORTLET_TITLE); |
42 | if (header != null) { |
43 | pageContext.getOut().print(""/*header*/); |
44 | } |
45 | } catch (IOException ex) { |
46 | throw new JspException(ex); |
47 | } |
48 | return SKIP_BODY; |
49 | } |
50 | } |