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

7
import com.opensymphony.module.sitemesh.DefaultSitemeshBuffer;
8
import com.opensymphony.module.sitemesh.Page;
9
import com.opensymphony.module.sitemesh.PageParser;
10
import com.opensymphony.module.sitemesh.SitemeshBuffer;
11
import com.opensymphony.module.sitemesh.SitemeshBufferFragment;
12
import com.opensymphony.module.sitemesh.html.BasicRule;
13
import com.opensymphony.module.sitemesh.html.HTMLProcessor;
14
import com.opensymphony.module.sitemesh.html.Tag;
15

16
import jakarta.servlet.http.HttpServletResponse;
17

18
import java.io.IOException;
19

20
/**
21
 * The Class MultipassReplacementPageParser.
22
 */
23
public class MultipassReplacementPageParser implements PageParser {
24

25
    /** The page. */
26
    private final Page page;
27

28
    /** The response. */
29
    private final HttpServletResponse response;
30

31
    /**
32
     * Instantiates a new multipass replacement page parser.
33
     *
34
     * @param page
35
     *            the page
36
     * @param response
37
     *            the response
38
     */
39
    public MultipassReplacementPageParser(Page page, HttpServletResponse response) {
×
40
        this.page = page;
×
41
        this.response = response;
×
42
    }
×
43

44
    @Override
45
    public Page parse(char[] buffer) throws IOException {
46
        return parse(new DefaultSitemeshBuffer(buffer));
×
47
    }
48

49
    @Override
50
    public Page parse(SitemeshBuffer sitemeshBuffer) throws IOException {
51
        SitemeshBufferFragment.Builder builder = SitemeshBufferFragment.builder().setBuffer(sitemeshBuffer);
×
52
        HTMLProcessor processor = new HTMLProcessor(sitemeshBuffer, builder);
×
53
        processor.addRule(new BasicRule("sitemesh:multipass") {
×
54
            @Override
55
            public void process(Tag tag) {
56
                currentBuffer().delete(tag.getPosition(), tag.getLength());
×
57
                String id = tag.getAttributeValue("id", true);
×
58
                if (!page.isPropertySet("_sitemesh.removefrompage." + id)) {
×
59
                    currentBuffer().insert(tag.getPosition(), page.getProperty(id));
×
60
                }
61
            }
×
62
        });
63
        processor.process();
×
64

65
        builder.build().writeTo(response.getWriter());
×
66
        return null;
×
67
    }
68
}
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