• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hazendaz / sitemesh2 / 59

22 Mar 2026 02:30AM UTC coverage: 40.347%. Remained the same
59

push

github

hazendaz
[mvn] Update maven wrapper

698 of 1891 branches covered (36.91%)

Branch coverage included in aggregate %.

1555 of 3693 relevant lines covered (42.11%)

0.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/com/opensymphony/module/sitemesh/taglib/AbstractTag.java
1
/*
2
 * SPDX-License-Identifier: Apache-2.0
3
 * Copyright 2011-2026 Hazendaz
4
 */
5
/*
6
 * Title:        AbstractTag
7
 * Description:
8
 *
9
 * This software is published under the terms of the OpenSymphony Software
10
 * License version 1.1, of which a copy has been included with this
11
 * distribution in the LICENSE.txt file.
12
 */
13

14
package com.opensymphony.module.sitemesh.taglib;
15

16
import com.opensymphony.module.sitemesh.Page;
17
import com.opensymphony.module.sitemesh.RequestConstants;
18
import com.opensymphony.module.sitemesh.util.OutputConverter;
19

20
import jakarta.servlet.jsp.JspException;
21
import jakarta.servlet.jsp.PageContext;
22
import jakarta.servlet.jsp.tagext.BodyTagSupport;
23
import jakarta.servlet.jsp.tagext.Tag;
24

25
import java.io.Writer;
26

27
/**
28
 * Convenience implementation of Tag containing generice methods required by all (or most) taglibs.
29
 *
30
 * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
31
 */
32
public abstract class AbstractTag extends BodyTagSupport implements RequestConstants {
×
33

34
    /** The Constant serialVersionUID. */
35
    private static final long serialVersionUID = 1L;
36

37
    /** The page context. */
38
    protected PageContext pageContext;
39

40
    /** The parent. */
41
    protected Tag parent;
42

43
    /** To be implemented by all empty tags. */
44
    @Override
45
    public abstract int doEndTag() throws JspException;
46

47
    /** Returns SKIP_BODY. */
48
    @Override
49
    public int doStartTag() {
50
        return SKIP_BODY;
×
51
    }
52

53
    @Override
54
    public void release() {
55
    }
×
56

57
    @Override
58
    public Tag getParent() {
59
        return parent;
×
60
    }
61

62
    @Override
63
    public void setParent(Tag parent) {
64
        this.parent = parent;
×
65
    }
×
66

67
    @Override
68
    public void setPageContext(PageContext pageContext) {
69
        this.pageContext = pageContext;
×
70
    }
×
71

72
    /**
73
     * Return the Page object from the PAGE scope. If this is found in REQUEST scope instead, it will be moved into PAGE
74
     * scope - to handle multi-level includes.
75
     *
76
     * @return the page
77
     */
78
    protected Page getPage() {
79
        Page p = (Page) pageContext.getAttribute(PAGE, PageContext.PAGE_SCOPE);
×
80

81
        if (p == null) {
×
82
            p = (Page) pageContext.getAttribute(PAGE, PageContext.REQUEST_SCOPE);
×
83
            if (p == null) {
×
84
                pageContext.removeAttribute(PAGE, PageContext.PAGE_SCOPE);
×
85
            } else {
86
                pageContext.setAttribute(PAGE, p, PageContext.PAGE_SCOPE);
×
87
            }
88
            pageContext.removeAttribute(PAGE, PageContext.REQUEST_SCOPE);
×
89
        }
90
        return p;
×
91
    }
92

93
    /**
94
     * Log exception generated by taglib.
95
     *
96
     * @param e
97
     *            the e
98
     */
99
    protected static void trace(Exception e) {
100
        e.printStackTrace();
×
101
    }
×
102

103
    /**
104
     * Get the outputWriter. This method should be used in preference to <code>pageContext.getOut()</code>, as some
105
     * charset conversions may need to happen in some servers.
106
     *
107
     * @return the writer for use in the tag
108
     */
109
    protected Writer getOut() {
110
        return OutputConverter.getWriter(pageContext.getOut());
×
111
    }
112
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc