Example usage for javax.servlet ServletRequest setAttribute

List of usage examples for javax.servlet ServletRequest setAttribute

Introduction

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

Prototype

public void setAttribute(String name, Object o);

Source Link

Document

Stores an attribute in this request.

Usage

From source file:com.nominanuda.springmvc.JettyChainableDispatcherServlet.java

public static void markRequestAsUnhandled(ServletRequest request) {
    request.setAttribute(UNHANDLED_REQUEST, true);
}

From source file:grails.plugins.jaxrs.web.JaxrsUtils.java

/**
 * Stores a request <code>uri</code> as <code>request</code> attribute. The
 * request attribute name is {@link #REQUEST_URI_ATTRIBUTE_NAME}.
 *
 * @param request/*from  w w w. ja v a2  s  . co m*/
 *            request where to store the URI.
 * @param uri
 *            request URI.
 */
public static void setRequestUriAttribute(ServletRequest request, String uri) {
    request.setAttribute(REQUEST_URI_ATTRIBUTE_NAME, uri);
}

From source file:net.sourceforge.vulcan.web.ContentTypeFilter.java

public static void disableContentTypeSupression(ServletRequest request) {
    request.setAttribute(ATTR_DISABLE_SUPPRESSION, Boolean.TRUE);
}

From source file:com.redhat.rhn.frontend.taglibs.list.RadioColumnTag.java

static void bindDefaultValue(ServletRequest request, String listName, String value) {
    request.setAttribute(getDefaultValueName(listName), value);
}

From source file:org.apache.struts.tiles.DefinitionsUtil.java

/**
 * Store definition in jsp context.//from w  w w  .j av a  2  s .c o m
 * Mainly used by Struts to pass a definition defined in an Action to the forward.
 */
public static void setActionDefinition(ServletRequest request, ComponentDefinition definition) {

    request.setAttribute(ACTION_DEFINITION, definition);
}

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

/**
 * Sets the current container to use in web pages.
 *
 * @param request The request to use.//w  ww.  j ava  2  s .c  o m
 * @param context The servlet context to use.
 * @param container The container to use as the current container.
 * @since 2.1.0
 */
public static void setCurrentContainer(ServletRequest request, ServletContext context,
        TilesContainer container) {
    if (container != null) {
        request.setAttribute(CURRENT_CONTAINER_ATTRIBUTE_NAME, container);
    } else {
        throw new NoSuchContainerException("The container cannot be null");
    }
}

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

/**
 * Get the current list of policy additions from the request, or create one
 * if there is none. This method may return an empty list, but it never
 * returns null.//from  w  w w .  j  a v  a  2  s. c  o  m
 */
private static PolicyList getPoliciesFromRequest(ServletRequest request) {
    if (request == null) {
        throw new NullPointerException("request may not be null.");
    }

    Object obj = request.getAttribute(ATTRIBUTE_POLICY_ADDITIONS);
    if (obj == null) {
        obj = new PolicyList();
        request.setAttribute(ATTRIBUTE_POLICY_ADDITIONS, obj);
    }

    if (!(obj instanceof PolicyList)) {
        throw new IllegalStateException("Expected to find an instance of " + PolicyList.class.getName()
                + " in the context, but found an instance of " + obj.getClass().getName() + " instead.");
    }

    return (PolicyList) obj;
}

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

/**
 * Sets the current container to use in web pages.
 *
 * @param request The request to use./*  www.j  a va 2  s . c  om*/
 * @param context The servlet context to use.
 * @param key The key under which the container is stored.
 * @since 2.1.0
 */
public static void setCurrentContainer(ServletRequest request, ServletContext context, String key) {
    TilesContainer container = getContainer(context, key);
    if (container != null) {
        request.setAttribute(CURRENT_CONTAINER_ATTRIBUTE_NAME, container);
    } else {
        throw new NoSuchContainerException("The container with the key '" + key + "' cannot be found");
    }
}

From source file:com.redhat.rhn.frontend.taglibs.list.ListTagHelper.java

/**
 * Stores the declaration information of an rhnSet
 * so as to be used by the list tag while
 * rendering a set./*from   w ww  . j  av  a 2s . com*/
 * @param listName name of list
 * @param label the set  declaration to bind
 * @param request current HttpServletRequest
 */
public static void bindSetDeclTo(String listName, String label, ServletRequest request) {
    String uniqueName = TagHelper.generateUniqueName(listName);
    String selectedName = makeSetDeclAttributeName(uniqueName);
    request.setAttribute(selectedName, label);
}

From source file:com.boylesoftware.web.Router.java

/**
 * Set asynchronous transaction exception in the request.
 *
 * @param request The request.// w  w w  .  j av  a 2  s. com
 * @param e The exception.
 */
static void setAsyncException(final ServletRequest request, final Exception e) {

    request.setAttribute(ASYNC_EXCEPTION_ATTNAME, e);
}