List of usage examples for org.springframework.web.context WebApplicationContext getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:example.WacuController.java
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { WebApplicationContext wac = WebApplicationContextUtils .getRequiredWebApplicationContext(this.servletContext); return new ModelAndView("wacu")// .addObject("applicationContextDisplayName", wac.getDisplayName())// .addObject("applicationContextClassName", wac.getClass().getName()); }
From source file:com.workingmouse.webservice.axis.SpringAxisServlet.java
/** * Initialize and publish the WebApplicationContext for the SpringAxisServlet. * Delegates to createWebApplicationContext for actual creation. * Can be overridden in subclasses./* w w w. java 2 s. com*/ * * @throws org.springframework.beans.BeansException * if the context couldn't be initialized * * @see #createWebApplicationContext */ protected WebApplicationContext initWebApplicationContext() throws BeansException { log("Initializing WebApplicationContext for servlet '" + this.getServletName() + "'"); ServletContext ctx = getServletContext(); WebApplicationContext parent = WebApplicationContextUtils.getWebApplicationContext(ctx); WebApplicationContext wac = createWebApplicationContext(parent); if (LOG.isDebugEnabled()) { LOG.debug("Using context class '" + wac.getClass().getName() + "' for servlet '" + getServletName() + "'"); } // publish the context to axis engine application session try { SpringBeanProvider.setWebApplicationContext(getEngine(), wac); } catch (AxisFault e) { throw new ApplicationContextException("Could not save axis engine session object", e); } return wac; }
From source file:org.springframework.web.struts.ContextLoaderPlugIn.java
/** * Initialize and publish the WebApplicationContext for the ActionServlet. * Delegates to createWebApplicationContext for actual creation. * <p>Can be overridden in subclasses. Call <code>getActionServlet</code> * and/or <code>getModuleConfig</code> to access the Struts configuration * that this PlugIn is associated with.// ww w . j ava 2s.c om * @throws org.springframework.beans.BeansException if the context couldn't be initialized * @throws IllegalStateException if there is already a context for the Struts ActionServlet * @see #createWebApplicationContext * @see #getActionServlet * @see #getServletName * @see #getServletContext * @see #getModuleConfig * @see #getModulePrefix */ protected WebApplicationContext initWebApplicationContext() throws BeansException, IllegalStateException { getServletContext().log("Initializing WebApplicationContext for Struts ActionServlet '" + getServletName() + "', module '" + getModulePrefix() + "'"); WebApplicationContext parent = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); WebApplicationContext wac = createWebApplicationContext(parent); if (logger.isInfoEnabled()) { logger.info("Using context class '" + wac.getClass().getName() + "' for servlet '" + getServletName() + "'"); } // Publish the context as a servlet context attribute. String attrName = getServletContextAttributeName(); getServletContext().setAttribute(attrName, wac); if (logger.isDebugEnabled()) { logger.debug( "Published WebApplicationContext of Struts ActionServlet '" + getServletName() + "', module '" + getModulePrefix() + "' as ServletContext attribute with name [" + attrName + "]"); } return wac; }