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

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

Introduction

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

Prototype

@Nullable
public static RequestAttributes getRequestAttributes() 

Source Link

Document

Return the RequestAttributes currently bound to the thread.

Usage

From source file:uk.ac.ebi.intact.editor.util.HybridSessionThreadScope.java

@Override
public Object remove(String name) {
    if (RequestContextHolder.getRequestAttributes() != null) {
        Object mutex = RequestContextHolder.currentRequestAttributes().getSessionMutex();
        synchronized (mutex) {
            return super.remove(name);
        }/*w w  w .j a va  2s  .  c  o  m*/
    }
    return super.remove(name);
}

From source file:de.accso.performancetesting.tools.PerformanceLogger.java

private String getCtxUrl() {
    String url = "";
    RequestAttributes ra = RequestContextHolder.getRequestAttributes();
    if (ra != null && ra instanceof ServletRequestAttributes) {
        HttpServletRequest r = ((ServletRequestAttributes) ra).getRequest();
        url = r.getRequestURI();//from   w w w.j  av  a  2s .c o  m
    }
    return url;
}

From source file:com.beginner.core.utils.ProjectUtil.java

/**
 * ?Web???(?????)/* w  ww.j a v  a 2s .  com*/
 */
public static int port() {
    HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
            .getRequest();
    return request.getLocalPort();
}

From source file:nl.surfnet.coin.api.oauth.ImplicitGrantExplicitRedirectResolver.java

private boolean isImplicitGrant() {
    ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder
            .getRequestAttributes();/*w ww. j av a 2 s.c  o m*/
    String responseType = (String) requestAttributes.getRequest().getParameter("response_type");
    Set<String> responseTypes = OAuth2Utils.parseParameterList(responseType);
    return responseTypes.contains("token");
}

From source file:com.sibvisions.rad.server.security.spring.authentication.SecurityManagerPreparerApplicationListener.java

/**
 * {@inheritDoc}//w w w  .  jav a2s .  com
 */
public void onApplicationEvent(InteractiveAuthenticationSuccessEvent pEvent) {
    RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();

    if (requestAttributes != null) {
        Object request = requestAttributes.resolveReference(RequestAttributes.REFERENCE_REQUEST);

        if (request != null && request instanceof HttpServletRequest) {
            doPrepareParameters((HttpServletRequest) request);
        }
    }
}

From source file:com.roncoo.controller.BaseController.java

/**
 * ?application// ww  w . j av a 2s.c o  m
 * 
 * @return
 */
protected ServletContext getApplication() {
    return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getSession()
            .getServletContext();
}

From source file:org.jasig.portlet.emailpreview.dao.exchange.MailCredentialsProvider.java

@Override
public Credentials getCredentials() {
    final RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
    final Credentials credentials = (Credentials) requestAttributes.getAttribute(
            MailCredentialsProvider.EXCHANGE_CREDENTIALS_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST);
    return credentials;
}

From source file:com.centeractive.ws.server.protocol.GenericSoapMessageFactory.java

private void setMessageFactoryForRequestContext(SaajSoapMessageFactory factory) {
    RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
    attributes.setAttribute(REQUEST_CONTEXT_ATTRIBUTE, factory, RequestAttributes.SCOPE_REQUEST);
}

From source file:io.pivotal.cla.mvc.ClaRequest.java

private String syncUrl() throws Exception {
    ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder
            .getRequestAttributes();/*  w  w w  .  j a v a 2s.c  o m*/
    HttpServletRequest request = requestAttributes.getRequest();
    return UrlBuilder.createSyncUrl(request, claName, repositoryId, pullRequestId);
}