Example usage for org.springframework.web.context.request RequestContextHolder resetRequestAttributes

List of usage examples for org.springframework.web.context.request RequestContextHolder resetRequestAttributes

Introduction

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

Prototype

public static void resetRequestAttributes() 

Source Link

Document

Reset the RequestAttributes for the current thread.

Usage

From source file:org.ngrinder.agent.controller.AgentManagerControllerTest.java

@After
public void reSetRequest() {
    RequestContextHolder.resetRequestAttributes();
}

From source file:at.ac.univie.isc.asio.engine.ReactiveInvokerTest.java

@After
public void tearDown() throws Exception {
    RequestContextHolder.resetRequestAttributes();
}

From source file:br.com.caelum.vraptor.ioc.spring.SpringProviderTest.java

@After
public void destroy() {
    RequestContextHolder.resetRequestAttributes();
}

From source file:org.craftercms.core.url.impl.ExtractRequestAttributesUrlTransformerTest.java

private void tearDownTestRequestAttributes() {
    RequestContextHolder.resetRequestAttributes();
}

From source file:at.ac.univie.isc.asio.spring.ContextPropagator.java

/**
 * Clear the context, which has been previously published to the current thread.
 *//*from w w w.j a v  a2 s. c  om*/
@Override
public void close() {
    final RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
    if (attributes == null) {
        fail(Pretty.format("cannot clear context of %s - none present", Thread.currentThread()));
    } else if (attributes != stored) {
        fail(Pretty.format("cannot clear context of %s - attributes not published by this propagator (%s)",
                Thread.currentThread(), this));
    } else {
        log.debug(Scope.SYSTEM.marker(), "clearing context of {}", Thread.currentThread());
        RequestContextHolder.resetRequestAttributes();
    }
}

From source file:org.craftercms.core.url.impl.AddSchemeAndDomainAndServerPortUrlTransformerTest.java

private void removeCurrentRequest() {
    RequestContextHolder.resetRequestAttributes();
}

From source file:org.vaadin.webinars.springandvaadin.i18n.ui.Servlet.java

@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    final Locale locale = localeResolver.resolveLocale(request);
    LocaleContextHolder.setLocale(locale);
    ServletRequestAttributes requestAttributes = new ServletRequestAttributes(request);
    RequestContextHolder.setRequestAttributes(requestAttributes);
    try {// w w w .j  av a 2  s. com
        super.service(new HttpServletRequestWrapper(request) {
            @Override
            public Locale getLocale() {
                return locale;
            }
        }, response);
    } finally {
        if (!locale.equals(LocaleContextHolder.getLocale())) {
            localeResolver.setLocale(request, response, LocaleContextHolder.getLocale());
        }
        LocaleContextHolder.resetLocaleContext();
        RequestContextHolder.resetRequestAttributes();
    }
}

From source file:io.neba.core.spring.web.filter.NebaRequestContextFilter.java

private void resetContextHolders() {
    LocaleContextHolder.resetLocaleContext();
    RequestContextHolder.resetRequestAttributes();
}

From source file:nl.jeslee.jersey.server.spring.scope.RequestContextFilter.java

/**
 * Create a new request context filter instance.
 * @param locator HK2 service locator.//from w ww.j  ava2 s  . c om
 */
@Inject
public RequestContextFilter(ServiceLocator locator) {
    ApplicationContext ctx = locator.getService(ApplicationContext.class);
    attributeController = (ctx != null) ? new SpringAttributeController() {

        @Override
        public void setAttributes(final ContainerRequestContext requestContext) {
            final JaxrsRequestAttributes attributes = new JaxrsRequestAttributes(requestContext);
            requestContext.setProperty(REQUEST_ATTRIBUTES_PROPERTY, attributes);
            RequestContextHolder.setRequestAttributes(attributes);
        }

        @Override
        public void resetAttributes(final ContainerRequestContext requestContext) {
            JaxrsRequestAttributes attributes = (JaxrsRequestAttributes) requestContext
                    .getProperty(REQUEST_ATTRIBUTES_PROPERTY);
            RequestContextHolder.resetRequestAttributes();
            attributes.requestCompleted();
        }
    } : EMPTY_ATTRIBUTE_CONTROLLER;
}

From source file:de.blizzy.documentr.web.FunctionsTest.java

@After
public void tearDown() {
    Functions.setGlobalRepositoryManager(null);
    Functions.setPageStore(null);//  www . j av  a2 s .  com
    Functions.setUserStore(null);
    Functions.setPageRenderer(null);
    Functions.setMarkdownProcessor(null);
    Functions.setMessageSource(null);
    Functions.setMacroFactory(null);
    SecurityContextHolder.clearContext();
    LocaleContextHolder.resetLocaleContext();
    RequestContextHolder.resetRequestAttributes();
}