• 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/ParameterDecoratorMapper.java
1
/*
2
 * SPDX-License-Identifier: Apache-2.0
3
 * Copyright 2011-2026 Hazendaz
4
 */
5
/*
6
 * Title:        ParameterDecoratorMapper
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 ParameterDecoratorMapper will map a suitable decorator based on request parameters.
27
 * <p>
28
 * The ParameterDecoratorMapper is configured via three properties.
29
 * <p>
30
 * <code>decorator.parameter</code> - the parameter which contains the name of the decorator which will be mapped. The
31
 * default is "decorator".
32
 * <p>
33
 * For example if <code>decorator.parameter</code> is "foobar" then myurl.jsp?foobar=mydecorator will map to the
34
 * decorator named "mydecorator".
35
 * <p>
36
 * You can also supply an optional 'confirmation parameter'. The decorator will only be mapped if the parameter named
37
 * <code>parameter.name</code> is in the request URI and the value of that parameter is equal to the
38
 * <code>parameter.value</code> property.
39
 * <p>
40
 * For example assuming parameter.name=confirm and parameter.value=true the URI
41
 * myurl.jsp?decorator=mydecorator&amp;confirm=true will map the decorator mydecorator. where as the URIs
42
 * myurl.jsp?decorator=mydecorator and myurl.jsp?decorator=mydecorator&amp;confirm=false will not return any decorator.
43
 *
44
 * @author <a href="mailto:mcannon@internet.com">Mike Cannon-Brookes</a>
45
 *
46
 * @see com.opensymphony.module.sitemesh.DecoratorMapper
47
 */
48
public class ParameterDecoratorMapper extends AbstractDecoratorMapper {
×
49

50
    /** The param value. */
51
    private String decoratorParameter = null, paramName = null, paramValue = null;
×
52

53
    @Override
54
    public void init(Config config, Properties properties, DecoratorMapper parent) throws InstantiationException {
55
        super.init(config, properties, parent);
×
56
        decoratorParameter = properties.getProperty("decorator.parameter", "decorator");
×
57
        paramName = properties.getProperty("parameter.name", null);
×
58
        paramValue = properties.getProperty("parameter.value", null);
×
59
    }
×
60

61
    @Override
62
    public Decorator getDecorator(HttpServletRequest request, Page page) {
63
        Decorator result = null;
×
64
        String decoratorParamValue = request.getParameter(decoratorParameter);
×
65

66
        if ((paramName == null || paramValue.equals(request.getParameter(paramName))) && decoratorParamValue != null
×
67
                && !decoratorParamValue.trim().equals("")) {
×
68
            result = getNamedDecorator(request, decoratorParamValue);
×
69
        }
70
        return result == null ? super.getDecorator(request, page) : result;
×
71
    }
72
}
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