当前位置: 首页>>代码示例>>Java>>正文


Java ServletRequestEvent.getServletContext方法代码示例

本文整理汇总了Java中javax.servlet.ServletRequestEvent.getServletContext方法的典型用法代码示例。如果您正苦于以下问题:Java ServletRequestEvent.getServletContext方法的具体用法?Java ServletRequestEvent.getServletContext怎么用?Java ServletRequestEvent.getServletContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.servlet.ServletRequestEvent的用法示例。


在下文中一共展示了ServletRequestEvent.getServletContext方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: requestInitialized

import javax.servlet.ServletRequestEvent; //导入方法依赖的package包/类
@Override
public void requestInitialized(ServletRequestEvent sre) {
    ServletContext servletContext = sre.getServletContext();
    ApplicationContext applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
    GroovyClassLoader classLoader = applicationContext.getBean(GroovyClassLoader.class);
    if (Thread.currentThread().getContextClassLoader() instanceof GroovyClassLoader) {
    } else {
        Thread.currentThread().setContextClassLoader(classLoader);
    }
    DataSource dataSource = applicationContext.getBean(DataSource.class);
    try {
        this.connection = dataSource.getConnection();
        this.connection.setAutoCommit(true);
    } catch (SQLException e) {
    }
}
 
开发者ID:PkayJava,项目名称:MBaaS,代码行数:17,代码来源:ServletRequestListener.java

示例2: requestInitialized

import javax.servlet.ServletRequestEvent; //导入方法依赖的package包/类
@Override
public void requestInitialized(ServletRequestEvent sre) {
	//System.out.println("Requset 初始化了:" + sre.getServletRequest());
	
	ServletContext ctx = sre.getServletContext();
	exector.execute(new Runnable() {
		@Override
		public void run() {
			System.out.println(Thread.currentThread().getName());
			Integer count = (Integer) ctx.getAttribute(BookStoreConstants.REQUEST_COUNT); // 获得list
			if (count == null) {
				count = 0;
			}
			ctx.setAttribute(BookStoreConstants.REQUEST_COUNT, count+1);
			
		}
	});
	

}
 
开发者ID:shihuihzh,项目名称:BookStore,代码行数:21,代码来源:StoreRequestListener.java

示例3: requestInitialized

import javax.servlet.ServletRequestEvent; //导入方法依赖的package包/类
@Override
public void requestInitialized(ServletRequestEvent requestEvent) {
    if (!(requestEvent.getServletRequest() instanceof HttpServletRequest)) {
        logger.debug("error type: " + requestEvent.getServletRequest().getClass().getName());
        throw new IllegalArgumentException("Request is not an HttpServletRequest: " + requestEvent.getServletContext());
    }

    HttpServletRequest request = (HttpServletRequest) requestEvent.getServletRequest();
    GlobalServiceImpl.setUpHttpSession(request);
}
 
开发者ID:sercxtyf,项目名称:onboard,代码行数:11,代码来源:RequestContextListener.java

示例4: requestInitialized

import javax.servlet.ServletRequestEvent; //导入方法依赖的package包/类
public void requestInitialized(ServletRequestEvent sre) {
    ServletRequest request = sre.getServletRequest();
    ServletContext context = sre.getServletContext();
    if(request!=null&&context!=null)
        request.setAttribute(LocaleUtils.LOCALE_RESOLVER_ATTRIBUTE, context.getAttribute(LocaleUtils.LOCALE_RESOLVER_NAME));

}
 
开发者ID:mobilipia,项目名称:Deskera-HRMS,代码行数:8,代码来源:LocaleResolverListener.java

示例5: requestInitialized

import javax.servlet.ServletRequestEvent; //导入方法依赖的package包/类
@Override
public void requestInitialized(ServletRequestEvent sre) {
  Map<String, String[]> paramMap = sre.getServletRequest().getParameterMap();
  ServletContext servletContext = sre.getServletContext();
  
  // to see log messages at runtime, check the terminal window where you started JBoss AS.
  servletContext
      .log("ParameterDumpingRequestListener: request has been initialized. It has " + paramMap.size() + " parameters:");
  for (Map.Entry<String, String[]> entry : paramMap.entrySet()) {
    for (String val : entry.getValue()) {
      servletContext.log("  " + entry.getKey() + "=" + val);
    }
  }
}
 
开发者ID:red-fox-mulder,项目名称:eap-6.1-quickstarts,代码行数:15,代码来源:ParameterDumpingRequestListener.java

示例6: requestInitialized

import javax.servlet.ServletRequestEvent; //导入方法依赖的package包/类
@Override
public void requestInitialized(ServletRequestEvent sre) {
    Map<String, String[]> paramMap = sre.getServletRequest().getParameterMap();
    ServletContext servletContext = sre.getServletContext();

    // to see log messages at runtime, check the terminal window where you started JBoss AS.
    servletContext.log("ParameterDumpingRequestListener: request has been initialized. It has " + paramMap.size()
            + " parameters:");
    for (Map.Entry<String, String[]> entry : paramMap.entrySet()) {
        for (String val : entry.getValue()) {
            servletContext.log("  " + entry.getKey() + "=" + val);
        }
    }
}
 
开发者ID:wfink,项目名称:jboss-as-quickstart,代码行数:15,代码来源:ParameterDumpingRequestListener.java


注:本文中的javax.servlet.ServletRequestEvent.getServletContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。