• 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/mapper/PrintableDecoratorMapper.java
1
/*
2
 * SPDX-License-Identifier: Apache-2.0
3
 * Copyright 2011-2026 Hazendaz
4
 */
5
/*
6
 * Title:        PrintableDecoratorMapper
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.mapper;
15

16
import com.opensymphony.module.sitemesh.Config;
17
import com.opensymphony.module.sitemesh.Decorator;
18
import com.opensymphony.module.sitemesh.DecoratorMapper;
19
import com.opensymphony.module.sitemesh.Page;
20

21
import jakarta.servlet.http.HttpServletRequest;
22

23
import java.util.Properties;
24

25
/**
26
 * The PrintableDecoratorMapper is a sample DecoratorMapper that will check to see whether 'printable=true' is supplied
27
 * as a request parameter and if so, use the specified decorator instead. The name of this decorator should be supplied
28
 * in the <code>decorator</code> property.
29
 * <p>
30
 * The exact 'printable=true' request criteria can be overriden with the <code>parameter.name</code> and
31
 * <code>parameter.value</code> properties.
32
 * <p>
33
 * Although this DecoratorMapper was designed for creating printable versions of a page, it can be used for much more
34
 * imaginative purposes.
35
 *
36
 * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
37
 *
38
 * @see com.opensymphony.module.sitemesh.DecoratorMapper
39
 */
40
public class PrintableDecoratorMapper extends AbstractDecoratorMapper {
×
41

42
    /** The param value. */
43
    private String decorator, paramName, paramValue;
44

45
    @Override
46
    public void init(Config config, Properties properties, DecoratorMapper parent) throws InstantiationException {
47
        super.init(config, properties, parent);
×
48
        decorator = properties.getProperty("decorator");
×
49
        paramName = properties.getProperty("parameter.name", "printable");
×
50
        paramValue = properties.getProperty("parameter.value", "true");
×
51
    }
×
52

53
    @Override
54
    public Decorator getDecorator(HttpServletRequest request, Page page) {
55
        Decorator result = null;
×
56
        if (decorator != null && paramValue.equalsIgnoreCase(request.getParameter(paramName))) {
×
57
            result = getNamedDecorator(request, decorator);
×
58
        }
59
        return result == null ? super.getDecorator(request, page) : result;
×
60
    }
61
}
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