【问题标题】:How do you access the Servlet Context (on the server) when using GWT Request Factory?使用 GWT 请求工厂时如何访问 Servlet 上下文(在服务器上)?
【发布时间】:2012-07-24 04:29:38
【问题描述】:

我需要访问通常在 servlet 中可用的 ServletContext 对象,以便我可以调用如下方法:

String fullPath = getServletContext().getRealPath("images/file.jpg");

我确定有一些内置的东西,我只需要弄清楚它是什么。

【问题讨论】:

    标签: gwt requestfactory


    【解决方案1】:

    您需要做的就是:

    String fullPath = RequestFactoryServlet.getThreadLocalServletContext().getRealPath("images/file.jpg");
    

    【讨论】:

      猜你喜欢
      • 2013-04-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-07
      • 2012-07-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多