- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.directwebremoting.WebContext.getServletContext()
方法的一些代码示例,展示了WebContext.getServletContext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebContext.getServletContext()
方法的具体详情如下:
包路径:org.directwebremoting.WebContext
类名称:WebContext
方法名:getServletContext
暂无
代码示例来源:origin: org.directwebremoting/dwr
public Object doFilter(Object object, Method method, Object[] params, AjaxFilterChain chain) throws Exception
{
ServletContext context = WebContextFactory.get().getServletContext();
SessionFactory sessionFactory = (SessionFactory) context.getAttribute(ATTRIBUTE_SESSION);
Transaction transaction = null;
if (sessionFactory != null)
{
Session session = sessionFactory.getCurrentSession();
transaction = session.beginTransaction();
}
else
{
log.error("SessionFactory not initialized for this web application. Use: H3SessionAjaxFilter.setSessionFactory(servletContext, sessionFactory);");
}
Object reply = chain.doFilter(object, method, params);
if (transaction != null)
{
transaction.commit();
}
return reply;
}
代码示例来源:origin: org.directwebremoting/dwr
public void destroy()
{
WebContext webcx = WebContextFactory.get();
for(Creator c : creators.values()) {
if (c.getScope().equals(Creator.APPLICATION)) {
Object creatorInstance = webcx.getServletContext().getAttribute(c.getJavascript());
if (creatorInstance instanceof UninitializingBean) {
((UninitializingBean) creatorInstance).destroy();
}
}
}
}
代码示例来源:origin: org.directwebremoting/dwr
ServletContext sc = WebContextFactory.get().getServletContext();
try
代码示例来源:origin: org.directwebremoting/dwr
ServletContext threadServletContext = webContext.getServletContext();
welcomeFiles = getWebXmlWelcomeFileList(threadServletContext);
代码示例来源:origin: org.directwebremoting/dwr
public Object convertInbound(Class<?> paramType, InboundVariable data)
{
WebContext webcx = WebContextFactory.get();
if (HttpServletRequest.class.isAssignableFrom(paramType))
{
return webcx.getHttpServletRequest();
}
if (HttpServletResponse.class.isAssignableFrom(paramType))
{
return webcx.getHttpServletResponse();
}
if (ServletConfig.class.isAssignableFrom(paramType))
{
return webcx.getServletConfig();
}
if (ServletContext.class.isAssignableFrom(paramType))
{
return webcx.getServletContext();
}
if (HttpSession.class.isAssignableFrom(paramType))
{
return webcx.getSession(true);
}
return null;
}
代码示例来源:origin: infiniteautomation/ma-core-public
public Object doFilter(Object obj, Method method, Object[] params, AjaxFilterChain chain) throws Exception {
WebContext webContext = WebContextFactory.get();
if (resourceBundleDirectory != null && resourceBundleLoader == null)
resourceBundleLoader = new ResourceBundleLoader(webContext.getServletContext().getRealPath(
resourceBundleDirectory));
I18NUtils.prepareRequest(webContext.getHttpServletRequest(), localeResolverName, bundleBaseName,
resourceBundleLoader);
return chain.doFilter(obj, method, params);
}
}
代码示例来源:origin: infiniteautomation/ma-core-public
public Object doFilter(Object obj, Method method, Object[] params, AjaxFilterChain chain) throws Exception {
WebContext webContext = WebContextFactory.get();
WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(webContext
.getServletContext());
MessageSource messageSource = (MessageSource) wac.getBean(messageSourceKey);
JstlUtils.exposeLocalizationContext(webContext.getHttpServletRequest(), messageSource);
return chain.doFilter(obj, method, params);
}
}
代码示例来源:origin: vivo-project/Vitro
public EntityDWR(){
WebContext ctx = WebContextFactory.get();
ServletContext sc= ctx.getServletContext();
entityWADao = ModelAccess.on(sc).getWebappDaoFactory().getIndividualDao();
}
代码示例来源:origin: org.directwebremoting/dwr
String moduleName = (String) getModuleNameMethod.invoke(utils, "/", wc.getServletContext());
moduleConfig = (ModuleConfig) getModuleConfigMethod.invoke(utils, moduleName, wc.getServletContext());
moduleConfig = RequestUtils.getModuleConfig(request, wc.getServletContext());
代码示例来源:origin: org.directwebremoting/dwr
object = webcx.getServletContext().getAttribute(name);
webcx.getServletContext().setAttribute(name, object);
代码示例来源:origin: org.directwebremoting/dwr
if (webcx != null)
return webcx.getServletContext();
代码示例来源:origin: org.directwebremoting/dwr
ServletContext context = WebContextFactory.get().getServletContext();
Session session = H3SessionAjaxFilter.getCurrentSession(context);
这个问题在这里已经有了答案: Different ways to get Servlet Context (1 个回答) 关闭 6 年前。 我有 SampleServlet 类,在其中我重写了 do
我已经看到您也可以直接调用 getservletcontext() 并且也像这样 req.getsession().getservletcontext() 。 这两者有什么区别,我应该使用哪一个?有没
我有一个 Tomcat 6 实例在我的本地机器上运行。 我对其配置进行了以下更改: 在/conf/context.xml – 如下更改标签 在/conf/server.xml – 更改标签如下 假
html Murach's Java Servlets and JSP Thanks for joining our email list H
我知道这个问题已被问过一百万次并且有 500 万个答案 - 一些或其中的信息非常丰富。这些都没有解决这个问题。 我的目标与许多其他目标类似 - 我想访问网络应用程序运行时环境中的文件 - 图像、svg
我是一名菜鸟程序员,正在为 tomcat 在 eclipse 上开发我的第一个动态 Web 应用程序。它与 mySQL 数据库通信并修改一些模板文件并将它们另存为新文件。该应用程序需要便携。我知道绝对
我正在尝试使用 getServletContext().getRealPath( "/") ,但我不断收到此错误: 找不到符号符号:方法 getServletContext()位置:接口(interf
这个问题已经有答案了: Recommended way to save uploaded files in a servlet application (2 个回答) 已关闭 8 年前。 这是我的情况
背景:我想通过使用 Velocity 和 servlet 来学习 Web 开发。我使用 getServletContext().getRealPath("/") 查找 WEB-INF 的路径以及存储在
以下代码是我的示例 servlet 应用程序 protected void doGet(HttpServletRequest request, HttpServletResponse response
我要获取servletContext在 Java 类中从 WEB-INF 读取文件目录。我用 HttpServlet 扩展了我的类(class)并尝试获取如下代码中的上下文,但 servlet 配置返
当尝试像这样设置 Context 属性时: void init() { String testing = new String(); testing = "This is a test
getServletContext.getRealPath("string") 抛出空指针异常。我如何使用它来获取真实路径? public void doGet(HttpServletRequest
我一直在编写一个脚本来构建项目、创建 War 文件并将其部署到 Tomcat 上。我在执行脚本时收到以下错误,特别是在 javac 命令期间。请注意,我尝试在没有 Eclipse 的情况下进行此操作,
本文整理了Java中org.directwebremoting.WebContext.getServletContext()方法的一些代码示例,展示了WebContext.getServletCont
我的生产应用程序位于某个域名 ABC.com 上。在我的代码中,我根据某些操作将用户重定向到其他页面 response.sendRedirect(request.getServletContext()
我正在努力将现有应用程序从 Spring Boot 1.5 升级到 2.1。此应用程序作为 WAR 文件部署在现有 Tomcat 实例中。 我已经克服了大部分迁移障碍,但现在当 Thymeleaf 的
ServletContext context=getServletContext(); 这里 ServletContext 是接口(interface)。 Context是ServletContext
我有一个MainServletContext,它实现了存储属性的ServletContextListener public void contextInitialized(ServletContext
下面是 GenericServlet 类中的 2 个方法, public ServletConfig getServletConfig() { return this.conf
我是一名优秀的程序员,十分优秀!