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

sonus21 / rqueue / 25597948910

09 May 2026 09:41AM UTC coverage: 79.664%. First build
25597948910

Pull #295

github

web-flow
Merge b93680621 into 9757517ae
Pull Request #295: Nats v2 web

2417 of 3407 branches covered (70.94%)

Branch coverage included in aggregate %.

792 of 1072 new or added lines in 22 files covered. (73.88%)

7404 of 8921 relevant lines covered (83.0%)

0.83 hits per line

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

90.32
/rqueue-web/src/main/java/com/github/sonus21/rqueue/web/controller/RqueueViewController.java
1
/*
2
 * Copyright (c) 2020-2026 Sonu Kumar
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * You may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     https://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and limitations under the License.
14
 *
15
 */
16

17
package com.github.sonus21.rqueue.web.controller;
18

19
import com.github.sonus21.rqueue.config.RqueueWebConfig;
20
import com.github.sonus21.rqueue.utils.condition.ReactiveDisabled;
21
import com.github.sonus21.rqueue.web.RqueueViewControllerService;
22
import com.github.sonus21.rqueue.web.view.RqueueHtmlRenderer;
23
import jakarta.servlet.http.HttpServletRequest;
24
import jakarta.servlet.http.HttpServletResponse;
25
import java.io.IOException;
26
import org.springframework.beans.factory.annotation.Autowired;
27
import org.springframework.context.annotation.Conditional;
28
import org.springframework.stereotype.Controller;
29
import org.springframework.ui.Model;
30
import org.springframework.web.bind.annotation.GetMapping;
31
import org.springframework.web.bind.annotation.PathVariable;
32
import org.springframework.web.bind.annotation.RequestMapping;
33
import org.springframework.web.bind.annotation.RequestParam;
34

35
@Conditional(ReactiveDisabled.class)
36
@Controller
37
@RequestMapping(path = "${rqueue.web.url.prefix:}rqueue")
38
public class RqueueViewController extends BaseController {
39

40
  private final RqueueHtmlRenderer renderer;
41
  private final RqueueViewControllerService rqueueViewControllerService;
42

43
  @Autowired
44
  public RqueueViewController(
45
      RqueueHtmlRenderer renderer,
46
      RqueueWebConfig rqueueWebConfig,
47
      RqueueViewControllerService rqueueViewControllerService) {
48
    super(rqueueWebConfig);
1✔
49
    this.renderer = renderer;
1✔
50
    this.rqueueViewControllerService = rqueueViewControllerService;
1✔
51
  }
1✔
52

53
  private String xForwardedPrefix(HttpServletRequest request) {
54
    return request.getHeader("x-forwarded-prefix");
1✔
55
  }
56

57
  private void writeHtml(HttpServletResponse response, String html) throws IOException {
58
    response.setContentType("text/html;charset=UTF-8");
1✔
59
    response.getWriter().write(html);
1✔
60
  }
1✔
61

62
  @GetMapping
63
  public void index(Model model, HttpServletRequest request, HttpServletResponse response)
64
      throws IOException {
65
    if (!isEnable(response)) return;
1✔
66
    rqueueViewControllerService.index(model, xForwardedPrefix(request));
1✔
67
    writeHtml(response, renderer.renderIndex(model.asMap()));
1✔
68
  }
1✔
69

70
  @GetMapping("queues")
71
  public void queues(
72
      Model model,
73
      @RequestParam(name = "page", defaultValue = "1") int pageNumber,
74
      HttpServletRequest request,
75
      HttpServletResponse response)
76
      throws IOException {
77
    if (!isEnable(response)) return;
1✔
78
    rqueueViewControllerService.queues(model, xForwardedPrefix(request), pageNumber);
1✔
79
    writeHtml(response, renderer.renderQueues(model.asMap()));
1✔
80
  }
1✔
81

82
  @GetMapping("workers")
83
  public void workers(
84
      Model model,
85
      @RequestParam(name = "page", defaultValue = "1") int pageNumber,
86
      HttpServletRequest request,
87
      HttpServletResponse response)
88
      throws IOException {
NEW
89
    if (!isEnable(response)) return;
×
NEW
90
    rqueueViewControllerService.workers(model, xForwardedPrefix(request), pageNumber);
×
NEW
91
    writeHtml(response, renderer.renderWorkers(model.asMap()));
×
92
  }
×
93

94
  @GetMapping("queues/{queueName}")
95
  public void queueDetail(
96
      @PathVariable("queueName") String queueName,
97
      Model model,
98
      HttpServletRequest request,
99
      HttpServletResponse response)
100
      throws IOException {
101
    if (!isEnable(response)) return;
1✔
102
    rqueueViewControllerService.queueDetail(model, xForwardedPrefix(request), queueName);
1✔
103
    writeHtml(response, renderer.renderQueueDetail(model.asMap()));
1✔
104
  }
1✔
105

106
  @GetMapping("running")
107
  public void running(Model model, HttpServletRequest request, HttpServletResponse response)
108
      throws IOException {
109
    if (!isEnable(response)) return;
1✔
110
    rqueueViewControllerService.running(model, xForwardedPrefix(request));
1✔
111
    writeHtml(response, renderer.renderRunning(model.asMap()));
1✔
112
  }
1✔
113

114
  @GetMapping("scheduled")
115
  public void scheduled(Model model, HttpServletRequest request, HttpServletResponse response)
116
      throws IOException {
117
    if (!isEnable(response)) return;
1✔
118
    rqueueViewControllerService.scheduled(model, xForwardedPrefix(request));
1✔
119
    writeHtml(response, renderer.renderRunning(model.asMap()));
1✔
120
  }
1✔
121

122
  @GetMapping("dead")
123
  public void dead(Model model, HttpServletRequest request, HttpServletResponse response)
124
      throws IOException {
125
    if (!isEnable(response)) return;
1✔
126
    rqueueViewControllerService.dead(model, xForwardedPrefix(request));
1✔
127
    writeHtml(response, renderer.renderRunning(model.asMap()));
1✔
128
  }
1✔
129

130
  @GetMapping("pending")
131
  public void pending(Model model, HttpServletRequest request, HttpServletResponse response)
132
      throws IOException {
133
    if (!isEnable(response)) return;
1✔
134
    rqueueViewControllerService.pending(model, xForwardedPrefix(request));
1✔
135
    writeHtml(response, renderer.renderRunning(model.asMap()));
1✔
136
  }
1✔
137

138
  @GetMapping("utility")
139
  public void utility(Model model, HttpServletRequest request, HttpServletResponse response)
140
      throws IOException {
141
    if (!isEnable(response)) return;
1✔
142
    rqueueViewControllerService.utility(model, xForwardedPrefix(request));
1✔
143
    writeHtml(response, renderer.renderUtility(model.asMap()));
1✔
144
  }
1✔
145
}
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