Example usage for javax.servlet ServletConfig getServletContext

List of usage examples for javax.servlet ServletConfig getServletContext

Introduction

In this page you can find the example usage for javax.servlet ServletConfig getServletContext.

Prototype

public ServletContext getServletContext();

Source Link

Document

Returns a reference to the ServletContext in which the caller is executing.

Usage

From source file:org.electrologic.convergence.server.TargetServlet.java

@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    ServletContext ctx = config.getServletContext();
    cache = (Cache) ctx.getAttribute(TargetConfigurator.CACHEPATH);
    signer = (Sha1RSASignature) ctx.getAttribute(TargetConfigurator.SIGNERPATH);
}

From source file:io.github.benas.todolist.web.servlet.todo.DeleteTodoServlet.java

@Override
public void init(ServletConfig servletConfig) throws ServletException {
    ApplicationContext applicationContext = WebApplicationContextUtils
            .getWebApplicationContext(servletConfig.getServletContext());
    todoService = applicationContext.getBean(TodoService.class);
    resourceBundle = ResourceBundle.getBundle("todolist");
}

From source file:org.activiti.explorer.servlet.ExplorerApplicationServlet.java

@Override
public void init(ServletConfig servletConfig) throws ServletException {
    super.init(servletConfig);
    applicationContext = WebApplicationContextUtils.getWebApplicationContext(servletConfig.getServletContext());
}

From source file:com.deltastar.task7.web.servlet.employee.BaseEmployeeServlet.java

@Override
public void init(ServletConfig servletConfig) throws ServletException {
    super.init(servletConfig);
    ApplicationContext applicationContext = WebApplicationContextUtils
            .getWebApplicationContext(servletConfig.getServletContext());
    employeeService = applicationContext.getBean(EmployeeService.class);
}

From source file:org.jbpm.designer.web.plugin.impl.PluginServiceServlet.java

public void init(ServletConfig config) throws ServletException {
    super.init(config);
    _pluginService = PluginServiceImpl.getInstance(config.getServletContext());
}

From source file:com.netcracker.financeapp.controller.income.IncomeServlet.java

@Override
public void init(ServletConfig config) {
    try {//from  w  w  w.  jav a 2  s. c  o  m
        super.init(config);
        SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext());
    } catch (ServletException ex) {
        Logger.getLogger(IncomeServlet.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.kesdip.license.web.servlet.UpdateServlet.java

/**
 * Initialize {@link HibernateTemplate} and the actualUpdateRoot.
 * /*from  www  . j  a v a 2  s  .com*/
 * @see javax.servlet.GenericServlet#init(javax.servlet.ServletConfig)
 */
@Override
public void init(ServletConfig config) throws ServletException {

    servletContext = config.getServletContext();

    WebApplicationContext springCtx = WebApplicationContextUtils
            .getRequiredWebApplicationContext(servletContext);

    hibernateTemplate = (HibernateTemplate) springCtx.getBean("hibernateTemplate");
    actualUpdateRoot = config.getInitParameter("updateSiteRoot");
}

From source file:org.brixcms.rmiserver.web.dav.WebDavServlet.java

@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);

    final ServletContext sc = config.getServletContext();
    ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(sc);
    if (context == null) {
        throw new IllegalStateException("Could not find application context");
    }//from ww w.  ja  va  2s.co  m

    repository = (Repository) BeanFactoryUtils.beanOfTypeIncludingAncestors(context, Repository.class);
    if (repository == null) {
        throw new IllegalStateException("Could not find JackRabbit repository in spring context");
    }

    UserService users = (UserService) BeanFactoryUtils.beanOfTypeIncludingAncestors(context, UserService.class);
    if (repository == null) {
        throw new IllegalStateException("Could not find UserService implementation in spring context");
    }

    authorizer = new Authorizer(users);
    credentialsProvider = getCredentialsProvider();
}

From source file:com.jaspersoft.jasperserver.war.themes.ThemeResolverServlet.java

@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    servletContext = config.getServletContext();

    WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(config.getServletContext());
    themeCache = (ThemeCache) ctx.getBean("themeCache");

    String value = config.getInitParameter(EXPIRES_AFTER_ACCESS_IN_SECS);
    try {//  ww  w  .  j  a va 2  s  .  c o m
        expiresInSecs = Integer.parseInt(value);
        log.debug("Expires in seconds set : " + expiresInSecs);
    } catch (Exception ex) {
        log.error(EXPIRES_AFTER_ACCESS_IN_SECS + " should be a non-negative integer", ex);
    }

}

From source file:org.jlibrary.servlet.JLibraryStartupAxisServlet.java

/** 
  * Called by the servlet container to indicate to a servlet that 
  * the servlet is being placed into service. 
  *       * @param javax.servlet.ServletConfig config 
  * @throws javax.servlet.ServletException ServletException 
  *//*from  ww w .java 2 s . c om*/
public void init(ServletConfig config) throws ServletException {

    super.init(config);

    // Deploy web services  
    deployWebServices(config.getServletContext());
}