Example usage for javax.servlet ServletContext setAttribute

List of usage examples for javax.servlet ServletContext setAttribute

Introduction

In this page you can find the example usage for javax.servlet ServletContext setAttribute.

Prototype

public void setAttribute(String name, Object object);

Source Link

Document

Binds an object to a given attribute name in this ServletContext.

Usage

From source file:au.gov.ansto.bragg.nbi.restlet.fileupload.servlet.FileCleanerCleanup.java

/**
 * Sets the instance of {@link FileCleaningTracker}, which is
 * associated with the given {@link ServletContext}.
 *
 * @param pServletContext The servlet context to modify
 * @param pTracker The tracker to set//w  ww.ja v a2 s  . co m
 */
public static void setFileCleaningTracker(ServletContext pServletContext, FileCleaningTracker pTracker) {
    pServletContext.setAttribute(FILE_CLEANING_TRACKER_ATTRIBUTE, pTracker);
}

From source file:edu.cornell.mannlib.vitro.webapp.controller.authenticate.ExternalAuthHelper.java

/** It would be private, but we want to allow calls for faking. */
protected static void setBean(ServletContext context, ExternalAuthHelper bean) {
    context.setAttribute(BEAN_ATTRIBUTE, bean);
}

From source file:edu.cornell.mannlib.vitro.webapp.controller.authenticate.Authenticator.java

public static void setAuthenticatorFactory(AuthenticatorFactory factory, ServletContext ctx) {
    ctx.setAttribute(FACTORY_ATTRIBUTE_NAME, factory);
}

From source file:org.openmrs.web.user.CurrentUsers.java

/**
 * Initialize the current users list.//  w  ww.ja  v  a2s .  com
 * 
 * @param servletContext
 */
public static Map<String, String> init(ServletContext servletContext) {
    Map<String, String> currentUserMap = Collections.synchronizedMap(new TreeMap<String, String>());
    servletContext.setAttribute(WebConstants.CURRENT_USERS, currentUserMap);
    return currentUserMap;
}

From source file:org.jodconverter.sample.webapp.WebappContext.java

protected static void init(final ServletContext servletContext) throws OfficeException {
    final WebappContext instance = new WebappContext(servletContext);
    servletContext.setAttribute(KEY, instance);
    instance.officeManager.start();/* w w  w .j a  v a2  s  .c o  m*/
}

From source file:edu.cornell.mannlib.vitro.webapp.servlet.setup.SimpleReasonerSetup.java

public static void setRecomputeRequired(ServletContext ctx, RecomputeMode mode) {
    ctx.setAttribute(RECOMPUTE_REQUIRED_ATTR, mode);
}

From source file:edu.cornell.mannlib.vitro.webapp.rdfservice.impl.RDFServiceUtils.java

public static void setRDFServiceFactory(ServletContext context, RDFServiceFactory factory, WhichService which) {
    String attribute = RDFSERVICEFACTORY_ATTR + "." + which.name();
    context.setAttribute(attribute, factory);
}

From source file:org.nextframework.core.web.NextWeb.java

public static WebApplicationContext createApplicationContext(ServletContext servletContext) {

    WebApplicationContext applicationContext;
    applicationContext = new DefaultWebApplicationContext(servletContext);
    servletContext.setAttribute(WebApplicationContext.APPLICATION_CONTEXT_ATTRIBUTE, applicationContext);

    Next.applicationContext.set(applicationContext);

    return applicationContext;
}

From source file:edu.cornell.mannlib.vitro.webapp.i18n.selection.SelectedLocale.java

/**
 * Store the forced locale in the servlet context. Clear any selectable
 * Locales.//  w ww .ja  va 2  s . co  m
 */
public static void setForcedLocale(ServletContext ctx, Locale forcedLocale) {
    log.debug("Set forced locale: " + forcedLocale);
    ctx.setAttribute(ATTRIBUTE_NAME, new ContextSelectedLocale(forcedLocale));
}

From source file:edu.cornell.mannlib.vitro.webapp.config.RevisionInfoBean.java

/** Package access: should only be used during setup. */
static void setBean(ServletContext context, RevisionInfoBean bean) {
    if (bean == null) {
        bean = DUMMY_BEAN;/*  w  ww . j  a  v  a  2 s. c  o  m*/
    }
    context.setAttribute(ATTRIBUTE_NAME, bean);
    log.info(bean);
}