List of usage examples for javax.servlet ServletConfig getServletContext
public ServletContext getServletContext();
From source file:com.enonic.cms.web.portal.PortalServlet.java
@Override public void init(final ServletConfig config) throws ServletException { super.init(config); final ServletContext context = config.getServletContext(); final WebApplicationContext springContext = WebApplicationContextUtils .getRequiredWebApplicationContext(context); this.dispatcher = springContext.getBean(RequestDispatcher.class); }
From source file:com.concursive.connect.web.controller.hooks.InitHook.java
/** * Description of the Method/*from w w w.j a v a 2 s . co m*/ * * @param config Description of the Parameter */ public void beginInit(ServletConfig config) { LOG.info("Initializing framework..."); ServletContext context = config.getServletContext(); ApplicationPrefs prefs = new ApplicationPrefs(context); context.setAttribute(Constants.APPLICATION_PREFS, prefs); }
From source file:edu.mayo.cts2.framework.webapp.rest.osgi.ProxyServlet.java
@Override public void init(ServletConfig config) throws ServletException { super.init(config); Assert.notNull(config.getServletContext()); try {// w w w . j ava 2s . c om doInit(config); } catch (ServletException e) { throw e; } catch (Exception e) { throw new ServletException(e); } }
From source file:org.restcomm.sbc.Bootstrapper.java
private String home(final ServletConfig config) { final ServletContext context = config.getServletContext(); final String path = context.getRealPath("/"); if (path.endsWith("/")) { return path.substring(0, path.length() - 1); } else {/*from ww w .j av a 2 s . co m*/ return path; } }
From source file:org.apache.nifi.web.docs.DocumentationController.java
@Override public void init(final ServletConfig config) throws ServletException { super.init(config); servletContext = config.getServletContext(); }
From source file:org.atomserver.utils.alive.AliveServlet.java
protected void loadSpringContext() { if (appCtx == null) { ServletConfig config = getServletConfig(); ServletContext context = config.getServletContext(); if (context != null) { if (log.isDebugEnabled()) log.debug("LOADING: WebApplicationContextUtils.getRequiredWebApplicationContext(context))"); appCtx = WebApplicationContextUtils.getRequiredWebApplicationContext(context); } else {//from w w w.jav a 2 s .co m log.error("COULD NOT LOAD ApplicationContext"); } if (log.isTraceEnabled()) log.trace("Application context set:: appCtx= " + appCtx); isAliveHandler = (IsAliveHandler) (appCtx.getBean("org.atomserver-isAliveHandler")); } }
From source file:cn.com.sgcc.servlet.LicenseServlet.java
@Override public void init(ServletConfig servletConfig) throws ServletException { ServletContext servletContext = servletConfig.getServletContext(); WebApplicationContext webApplicationContext = WebApplicationContextUtils .getWebApplicationContext(servletContext); accessControl = (AccessControl) webApplicationContext.getBean("AccessControlBean"); }
From source file:org.sipfoundry.sipxconfig.site.skin.SkinServlet.java
public void init(ServletConfig config) throws ServletException { ApplicationContext app = WebApplicationContextUtils .getRequiredWebApplicationContext(config.getServletContext()); m_skin = (SkinControl) app.getBean(SkinControl.CONTEXT_BEAN_NAME); }
From source file:org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier.java
/** * Method getServiceObject that is Spring aware via ServletContext. * * @param axisService/*from w w w . j a v a 2 s . c o m*/ * @return Returns Object. * @throws AxisFault */ public Object getServiceObject(AxisService axisService) throws AxisFault { try { // Name of spring aware bean to be injected, taken from services.xml // via 'SERVICE_SPRING_BEANNAME ' . The Bean and its properties are pre-configured // as normally done in a spring type of way and subsequently loaded by Spring. // Axis2 just assumes that the bean is configured and is in the classloader. Parameter implBeanParam = axisService.getParameter(SERVICE_SPRING_BEANNAME); String beanName = ((String) implBeanParam.getValue()).trim(); if (beanName != null) { Parameter servletConfigParam = axisService.getAxisConfiguration() .getParameter(HTTPConstants.HTTP_SERVLETCONFIG); if (servletConfigParam == null) { throw new Exception("Axis2 Can't find ServletConfigParameter"); } Object obj = servletConfigParam.getValue(); ServletContext servletContext; if (obj instanceof ServletConfig) { ServletConfig servletConfig = (ServletConfig) obj; servletContext = servletConfig.getServletContext(); } else { throw new Exception("Axis2 Can't find ServletConfig"); } ApplicationContext aCtx = WebApplicationContextUtils.getWebApplicationContext(servletContext); if (aCtx == null) { log.warn("Axis2 Can't find Spring's ApplicationContext"); return null; } else if (aCtx.getBean(beanName) == null) { throw new Exception("Axis2 Can't find Spring Bean: " + beanName); } return aCtx.getBean(beanName); } else { throw new AxisFault(Messages.getMessage("paramIsNotSpecified", "SERVICE_SPRING_BEANNAME")); } } catch (Exception e) { throw AxisFault.makeFault(e); } }
From source file:org.sakaiproject.tool.gradebook.ui.EntryServlet.java
public void init(ServletConfig config) throws ServletException { ServletContext servletContext = config.getServletContext(); handleMyFacesSecret(servletContext); super.init(config); }