• 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/SessionDecoratorMapper.java
1
/*
2
 * SPDX-License-Identifier: Apache-2.0
3
 * Copyright 2011-2026 Hazendaz
4
 */
5
package com.opensymphony.module.sitemesh.mapper;
6

7
import com.opensymphony.module.sitemesh.Config;
8
import com.opensymphony.module.sitemesh.Decorator;
9
import com.opensymphony.module.sitemesh.DecoratorMapper;
10
import com.opensymphony.module.sitemesh.Page;
11

12
import jakarta.servlet.http.HttpServletRequest;
13

14
import java.util.Properties;
15

16
/**
17
 * <p>
18
 * Will look at a session attribute to find the name of an appropriate decorator to use. If the session attribute is
19
 * present, the mapper will not do anything and allow the next mapper in the chain to select a decorator.
20
 * </p>
21
 * <p>
22
 * By default, it will look at the 'decorator' session attribute, however this can be overriden by configuring the
23
 * mapper with a 'decorator.parameter' property.
24
 * </p>
25
 *
26
 * @author Ricardo Lecheta
27
 */
28
public class SessionDecoratorMapper extends AbstractDecoratorMapper {
×
29

30
    /** The decorator parameter. */
31
    private String decoratorParameter = null;
×
32

33
    @Override
34
    public void init(Config config, Properties properties, DecoratorMapper parent) throws InstantiationException {
35
        super.init(config, properties, parent);
×
36
        decoratorParameter = properties.getProperty("decorator.parameter", "decorator");
×
37
    }
×
38

39
    @Override
40
    public Decorator getDecorator(HttpServletRequest request, Page page) {
41
        Decorator result = null;
×
42
        String decorator = (String) request.getSession().getAttribute(decoratorParameter);
×
43

44
        // get decorator from HttpSession
45
        if (decorator != null) {
×
46
            result = getNamedDecorator(request, decorator);
×
47
        }
48
        return result == null ? super.getDecorator(request, page) : result;
×
49
    }
50
}
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