Example usage for javax.servlet ServletContext removeAttribute

List of usage examples for javax.servlet ServletContext removeAttribute

Introduction

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

Prototype

public void removeAttribute(String name);

Source Link

Document

Removes the attribute with the given name from this ServletContext.

Usage

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

public static void removeBean(ServletContext context) {
    context.removeAttribute(ATTRIBUTE_NAME);
}

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

/** Package access, so unit tests can call it. */
static void removeBean(ServletContext context) {
    if (context == null) {
        throw new NullPointerException("context may not be null.");
    }/*from w ww.ja v  a  2s .  com*/
    context.removeAttribute(ATTRIBUTE_NAME);
}

From source file:es.tid.cep.esperanza.Utils.java

public static synchronized void destroyEPService(ServletContext sc) {
    EPServiceProvider epService = (EPServiceProvider) sc.getAttribute(EPSERV_ATTR_NAME);
    if (epService != null) {
        epService.destroy();/*  w ww  . j  av  a2 s.co m*/
        sc.removeAttribute(EPSERV_ATTR_NAME);
    }
}

From source file:edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionPolicyHelper.java

private static void removeBean(ServletContext ctx) {
    ctx.removeAttribute(ATTRIBUTE_NAME);
}

From source file:com.telefonica.iot.perseo.Utils.java

/**
 * Delete the EPServiceProvider from the ServletContext
 *
 * @param sc ServleContext to add ESPServiceProvider
 *//*  w w w  . j a  va  2  s .  c om*/
public static synchronized void destroyEPService(ServletContext sc) {
    EPServiceProvider epService = (EPServiceProvider) sc.getAttribute(EPSERV_ATTR_NAME);
    if (epService != null) {
        epService.destroy();
        sc.removeAttribute(EPSERV_ATTR_NAME);
    }
}

From source file:org.apache.axis.transport.http.AxisServletBase.java

/**
 * put the engine back in to the context.
 * @param context servlet context to use
 * @param engine reference to the engine. If null, the engine is removed
 *//* w  w  w .  j  a  v  a  2 s.  c o  m*/
private static void storeEngine(HttpServlet servlet, AxisServer engine) {
    ServletContext context = servlet.getServletContext();
    String axisServletName = servlet.getServletName();
    if (engine == null) {
        context.removeAttribute(axisServletName + ATTR_AXIS_ENGINE);
        // find if there is other AxisEngine in Context
        AxisServer server = (AxisServer) context.getAttribute(ATTR_AXIS_ENGINE);

        // no other AxisEngine in ServletContext
        if (server != null && servlet.getServletName().equals(server.getName())) {
            context.removeAttribute(ATTR_AXIS_ENGINE);
        }
    } else {
        if (context.getAttribute(ATTR_AXIS_ENGINE) == null) {
            // first Axis servlet to store its AxisEngine
            // use default name
            context.setAttribute(ATTR_AXIS_ENGINE, engine);
        }
        context.setAttribute(axisServletName + ATTR_AXIS_ENGINE, engine);
    }
}

From source file:org.apache.tiles.servlet.context.ServletUtil.java

/**
 * Configures the container to be used in the application.
 *
 * @param context The servlet context object to use.
 * @param container The container object to set.
 * @param key The key under which the container will be stored.
 * @since 2.1.2/*from  w w w .j  ava 2 s  .com*/
 */
public static void setContainer(ServletContext context, TilesContainer container, String key) {
    Log log = LogFactory.getLog(ServletUtil.class);
    if (key == null) {
        key = TilesAccess.CONTAINER_ATTRIBUTE;
    }

    if (container == null) {
        if (log.isInfoEnabled()) {
            log.info("Removing TilesContext for context: " + context.getClass().getName());
        }
        context.removeAttribute(key);
    }
    if (container != null && log.isInfoEnabled()) {
        log.info("Publishing TilesContext for context: " + context.getClass().getName());
    }
    context.setAttribute(key, container);
}

From source file:com.krawler.common.listeners.LocaleResolverBuilder.java

@Override
public void contextDestroyed(ServletContextEvent sce) {
    ServletContext context = sce.getServletContext();
    context.removeAttribute(LOCALE_RESOLVER_CLASS_NAME_ATTR);
}

From source file:com.ikon.servlet.PasswordResetServlet.java

public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException {
    ServletContext sc = getServletContext();
    sc.removeAttribute("forgot");
    sc.removeAttribute("failed");
    response.sendRedirect("login.jsp");
}

From source file:com.github.glue.mvc.general.DefaultConfigListener.java

@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {
    ServletContext servletContext = servletContextEvent.getServletContext();
    servletContext.removeAttribute(CONTAINER);
    super.contextDestroyed(servletContextEvent);
}