Files
mdm/src/main/java/com/midm/controller/FragmentController.java
T
rick 10aa1829f5 fix: repair decompiled sources and add exhaustive documentation
- restore generic signatures, scoped variables and missing code from original bytecode
- remove decompiler artifacts and document classes, methods, fields and packages
- restore resources, add Batik/BouncyCastle dependencies and build/runtime docs
2026-11-16 17:28:23 +08:00

158 lines
6.6 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.midm.controller;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 【Web 控制器】{@code FragmentController}
*
* 类职责:
* <ul>
* <li>接收 HTTP 请求、做参数绑定/鉴权,并把业务委托给 Service。</li>
* </ul>
*
* 学习提示:先看类上的 @RequestMapping 路径,再沿 public 方法里的 service 调用链阅读。
*/
@Controller
public class FragmentController extends BaseController {
/**
* 处理view。
*
* 实现要点:包含 1 个条件分支、0 个循环。
*
* 框架注解:{@code @RequestMapping(value = {"/view/**"}, method = {RequestMethod.GET})}。
*
* @param request HTTP 请求({@code HttpServletRequest})
* @param response HTTP 响应({@code HttpServletResponse})
* @param authentication Spring Security 认证信息({@code Authentication})
* @param model 参数 {@code model}({@code Model})
* @return 字符串结果
*/
@RequestMapping(
value = {"/view/**"},
method = {RequestMethod.GET}
)
public String view(HttpServletRequest request, HttpServletResponse response, Authentication authentication, Model model) {
this.init(request, response, authentication);
model.addAttribute("theme", this.theme);
if (authentication == null) {
model.addAttribute("hasUser", this.userService.hasUser());
}
return this.getView(authentication, request.getServletPath());
}
/**
* 处理resourceView。
*
* 框架注解:{@code @RequestMapping(value = {"/view/system/resource"}, method = {RequestMethod.GET})}。
*
* @param request HTTP 请求({@code HttpServletRequest})
* @param response HTTP 响应({@code HttpServletResponse})
* @param authentication Spring Security 认证信息({@code Authentication})
* @param locale 参数 {@code locale}({@code Locale})
* @param model 参数 {@code model}({@code Model})
* @param category 分类(app/ota/other/report 等)({@code String})
* @return 字符串结果
*/
@RequestMapping(
value = {"/view/system/resource"},
method = {RequestMethod.GET}
)
public String resourceView(HttpServletRequest request, HttpServletResponse response, Authentication authentication, Locale locale, Model model, @RequestParam String category) {
super.init(request, response, authentication);
model.addAttribute("category", category);
return "template/system/resource.html";
}
/**
* 处理fragment。
*
* 实现要点:包含 1 个条件分支、0 个循环。
*
* 框架注解:{@code @RequestMapping(value = {"/fragment/{fragmentName}"}, method = {RequestMethod.GET})}。
*
* @param request HTTP 请求({@code HttpServletRequest})
* @param response HTTP 响应({@code HttpServletResponse})
* @param authentication Spring Security 认证信息({@code Authentication})
* @param locale 参数 {@code locale}({@code Locale})
* @param model 参数 {@code model}({@code Model})
* @param fragmentName 参数 {@code fragmentName}({@code String})
* @return 字符串结果
*/
@RequestMapping(
value = {"/fragment/{fragmentName}"},
method = {RequestMethod.GET}
)
public String fragment(HttpServletRequest request, HttpServletResponse response, Authentication authentication, Locale locale, Model model, @PathVariable String fragmentName) {
super.init(request, response, authentication);
model.addAttribute("theme", this.theme);
if (authentication == null) {
model.addAttribute("hasUser", this.userService.hasUser());
}
return this.getView(authentication, request.getServletPath()) + " :: fragment";
}
/**
* 处理fragment。
*
* 框架注解:{@code @RequestMapping(value = {"/fragment/{fragmentName}/{blockName}"}, method = {RequestMethod.GET})}。
*
* @param request HTTP 请求({@code HttpServletRequest})
* @param response HTTP 响应({@code HttpServletResponse})
* @param authentication Spring Security 认证信息({@code Authentication})
* @param locale 参数 {@code locale}({@code Locale})
* @param model 参数 {@code model}({@code Model})
* @param fragmentName 参数 {@code fragmentName}({@code String})
* @param blockName 参数 {@code blockName}({@code String})
* @return 字符串结果
*/
@RequestMapping(
value = {"/fragment/{fragmentName}/{blockName}"},
method = {RequestMethod.GET}
)
public String fragment(HttpServletRequest request, HttpServletResponse response, Authentication authentication, Locale locale, Model model, @PathVariable String fragmentName, @PathVariable String blockName) {
super.init(request, response, authentication);
return this.getView(authentication, "/fragment/" + fragmentName) + " :: " + blockName;
}
/**
* 处理dialog。
*
* 实现要点:包含 1 个条件分支、0 个循环。
*
* 框架注解:{@code @RequestMapping(value = {"/dialog/{dialogName}"}, method = {RequestMethod.GET})}。
*
* @param request HTTP 请求({@code HttpServletRequest})
* @param response HTTP 响应({@code HttpServletResponse})
* @param authentication Spring Security 认证信息({@code Authentication})
* @param locale 参数 {@code locale}({@code Locale})
* @param model 参数 {@code model}({@code Model})
* @param dialogName 参数 {@code dialogName}({@code String})
* @param category 分类(app/ota/other/report 等)({@code String})
* @return 字符串结果
*/
@RequestMapping(
value = {"/dialog/{dialogName}"},
method = {RequestMethod.GET}
)
public String dialog(HttpServletRequest request, HttpServletResponse response, Authentication authentication, Locale locale, Model model, @PathVariable String dialogName, @RequestParam(required = false) String category) {
this.init(request, response, authentication);
model.addAttribute("theme", this.theme);
if (authentication == null) {
model.addAttribute("hasUser", this.userService.hasUser());
}
return this.getView(authentication, request.getServletPath()) + " :: dialog";
}
}