类 CustomUReportServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
net.sohelp.boot.engine.web.report.CustomUReportServlet
所有已实现的接口:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

public class CustomUReportServlet extends jakarta.servlet.http.HttpServlet
从以下版本开始:
2024/8/2 9:26
作者:
AaronFung
另请参阅:
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    static final String
     

    从类继承的字段 jakarta.servlet.http.HttpServlet

    LEGACY_DO_HEAD
  • 构造器概要

    构造器
    构造器
    说明
     
  • 方法概要

    修饰符和类型
    方法
    说明
    protected org.springframework.web.context.WebApplicationContext
    getWebApplicationContext(jakarta.servlet.ServletConfig config)
    从Servlet配置中获取Web应用上下文
    void
    init(jakarta.servlet.ServletConfig config)
    初始化Servlet,加载并注册所有ServletAction处理器。
    protected void
    service(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
    处理UReport报表服务的请求,根据请求URI分发到对应的处理器执行

    从类继承的方法 jakarta.servlet.http.HttpServlet

    doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service

    从类继承的方法 jakarta.servlet.GenericServlet

    destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 字段详细资料

  • 构造器详细资料

    • CustomUReportServlet

      public CustomUReportServlet()
  • 方法详细资料

    • init

      public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException
      初始化Servlet,加载并注册所有ServletAction处理器。

      该方法会从Spring应用上下文中获取所有ServletAction类型的Bean, 将它们按URL路径注册到actionMap中。如果发现重复的URL路径, 会抛出RuntimeException异常。

      指定者:
      init 在接口中 jakarta.servlet.Servlet
      覆盖:
      init 在类中 jakarta.servlet.http.HttpServlet
      参数:
      config - Servlet配置对象,用于获取Spring应用上下文
      抛出:
      jakarta.servlet.ServletException - 如果Servlet初始化过程中发生错误
      RuntimeException - 如果发现重复的URL路径处理器
    • getWebApplicationContext

      protected org.springframework.web.context.WebApplicationContext getWebApplicationContext(jakarta.servlet.ServletConfig config)
      从Servlet配置中获取Web应用上下文
      参数:
      config - Servlet配置对象,用于获取Servlet上下文
      返回:
      返回与当前Servlet关联的Web应用上下文对象
    • service

      protected void service(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException
      处理UReport报表服务的请求,根据请求URI分发到对应的处理器执行
      覆盖:
      service 在类中 jakarta.servlet.http.HttpServlet
      参数:
      req - HttpServletRequest对象,包含客户端请求信息
      resp - HttpServletResponse对象,用于返回响应数据
      抛出:
      jakarta.servlet.ServletException - 当Servlet处理请求时发生错误
      IOException - 当处理I/O操作时发生错误 逻辑说明: 1. 从请求中获取上下文路径和请求URI,提取目标URL 2. 如果目标URL为空,返回欢迎信息 3. 处理目标URL中的斜杠,确保获取正确的处理器键 4. 根据目标URL从actionMap中获取对应的处理器 5. 如果处理器不存在,返回错误信息 6. 处理特殊请求"/ureport/datasource/buildClass",返回JSON格式的实体字段信息 7. 对于其他请求,调用对应的处理器执行 8. 捕获并处理执行过程中的异常,返回错误信息 9. 在finally块中清理RequestHolder