EMMA Coverage Report (generated Fri Sep 15 10:32:43 EDT 2006)
[all classes][org.apache.pluto.driver.tags]

COVERAGE SUMMARY FOR SOURCE FILE [PortletRenderTag.java]

nameclass, %method, %block, %line, %
PortletRenderTag.java0%   (0/1)0%   (0/2)0%   (0/70)0%   (0/18)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PortletRenderTag0%   (0/1)0%   (0/2)0%   (0/70)0%   (0/18)
PortletRenderTag (): void 0%   (0/1)0%   (0/3)0%   (0/1)
doEndTag (): int 0%   (0/1)0%   (0/67)0%   (0/17)

1/*
2 * Copyright 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 */
16package org.apache.pluto.driver.tags;
17 
18import java.io.IOException;
19import java.io.PrintWriter;
20 
21import javax.servlet.jsp.JspException;
22import javax.servlet.jsp.tagext.TagSupport;
23 
24/**
25 * The portlet render tag is used to print portlet rendering result (or error
26 * details) to the page.
27 * 
28 * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
29 * @version 1.0
30 * @since Oct 4, 2004
31 */
32public class PortletRenderTag extends TagSupport {
33        
34        // TagSupport Impl ---------------------------------------------------------
35        
36        /**
37         * 
38         * @see PortletTag
39         */
40    public int doEndTag() throws JspException {
41            
42            // Ensure that the portlet render tag resides within a portlet tag.
43        PortletTag parentTag = (PortletTag) TagSupport.findAncestorWithClass(
44                        this, PortletTag.class);
45        if (parentTag == null) {
46            throw new JspException("Portlet render tag may only reside "
47                            + "within a pluto:portlet tag.");
48        }
49        
50        // If the portlet is rendered successfully, print the rendering result.
51        if (parentTag.getStatus() == PortletTag.SUCCESS) {
52            try {
53                StringBuffer buffer = parentTag.getPortalServletResponse()
54                                .getInternalBuffer().getBuffer();
55                pageContext.getOut().print(buffer.toString());
56            } catch (IOException ex) {
57                throw new JspException(ex);
58            }
59        }
60        // Otherwise, print the error stack trace.
61        else {
62            try {
63                pageContext.getOut().print("Error rendering portlet.");
64                pageContext.getOut().print("<pre>");
65                parentTag.getThrowable().printStackTrace(
66                                new PrintWriter(pageContext.getOut()));
67                pageContext.getOut().print("</pre>");
68            } catch (IOException ex) {
69                throw new JspException(ex);
70            }
71        }
72        
73        // Return.
74        return SKIP_BODY;
75    }
76 
77 
78}
79 

[all classes][org.apache.pluto.driver.tags]
EMMA 2.0.5312 (C) Vladimir Roubtsov