Example usage for org.springframework.web.context.request NativeWebRequest removeAttribute

List of usage examples for org.springframework.web.context.request NativeWebRequest removeAttribute

Introduction

In this page you can find the example usage for org.springframework.web.context.request NativeWebRequest removeAttribute.

Prototype

void removeAttribute(String name, int scope);

Source Link

Document

Remove the scoped attribute of the given name, if it exists.

Usage

From source file:org.impalaframework.extension.mvc.annotation.resolver.FlashAttributeArgumentResolver.java

protected Object getValue(NativeWebRequest webRequest, String attributeName) {
    Object attribute = webRequest.getAttribute(attributeName, WebRequest.SCOPE_SESSION);

    if (attribute != null && isArgumentPending(webRequest)) {
        webRequest.removeAttribute(attributeName, WebRequest.SCOPE_SESSION);
    }/*from   w w w  . j av  a2  s  .  c o  m*/

    return attribute;
}

From source file:org.impalaframework.extension.mvc.annotation.handler.ServletHandlerMethodInvoker.java

private ArgumentCollector[] assembleArgumentCollectors(Method handlerMethod, Object handler,
        NativeWebRequest webRequest, ExtendedModelMap implicitModel) {

    webRequest.setAttribute(WebAnnotationUtils.ARGUMENT_PENDING, Boolean.TRUE, WebRequest.SCOPE_REQUEST);

    ArgumentCollector[] collection;/* ww  w . ja  va2  s.  c om*/
    try {

        Class<?>[] parameterTypes = handlerMethod.getParameterTypes();

        collection = new ArgumentCollector[parameterTypes.length];
        for (int i = 0; i < parameterTypes.length; i++) {

            collection[i] = argumentCollectorHelper.getArgumentCollector(handlerMethod, webRequest, i);
        }

        argumentCollectors.put(handlerMethod, collection);

    } finally {
        webRequest.removeAttribute(WebAnnotationUtils.ARGUMENT_PENDING, WebRequest.SCOPE_REQUEST);
    }
    return collection;
}