Example usage for org.springframework.web.context.request WebRequest getAttribute

List of usage examples for org.springframework.web.context.request WebRequest getAttribute

Introduction

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

Prototype

@Nullable
Object getAttribute(String name, int scope);

Source Link

Document

Return the value for the scoped attribute of the given name, if any.

Usage

From source file:com.springsource.greenhouse.connect.TwitterConnectInterceptor.java

public void postConnect(Connection<Twitter> connection, WebRequest request) {
    if (request.getAttribute(POST_TWEET_ATTRIBUTE, WebRequest.SCOPE_SESSION) != null) {
        connection.getApi().timelineOperations()
                .updateStatus("Join me at the Greenhouse! " + AccountUtils.getCurrentAccount().getProfileUrl());
        request.removeAttribute(POST_TWEET_ATTRIBUTE, WebRequest.SCOPE_SESSION);
    }/*from www. j a  v  a  2 s  .co  m*/
}

From source file:eu.gyza.eap.eapsocialontology.facebook.PostToWallAfterConnectInterceptor.java

public void postConnect(Connection<Facebook> connection, WebRequest request) {
    if (request.getAttribute(POST_TO_WALL_ATTRIBUTE, WebRequest.SCOPE_SESSION) != null) {
        try {/*from   w ww  .  jav a 2s .c om*/
            connection.updateStatus("I've connected with the EAP Social Ontology!");
        } catch (ApiException e) {
            // Do nothing: No need to break down if the post-connect post can't be made.
        }
        request.removeAttribute(POST_TO_WALL_ATTRIBUTE, WebRequest.SCOPE_SESSION);
    }
}

From source file:org.fuzzydb.samples.social.PostToWallAfterConnectInterceptor.java

public void postConnect(Connection<Facebook> connection, WebRequest request) {
    if (request.getAttribute(POST_TO_WALL_ATTRIBUTE, WebRequest.SCOPE_SESSION) != null) {
        try {/*www .j  a va  2s  .c o  m*/
            connection.updateStatus("I've connected with the fuzzydb sample webapp");
        } catch (ApiException e) {
            // Do nothing: No need to break down if the post-connect post can't be made.
        }
        request.removeAttribute(POST_TO_WALL_ATTRIBUTE, WebRequest.SCOPE_SESSION);
    }
}

From source file:rd.kpath.facebook.PostToWallAfterConnectInterceptor.java

public void postConnect(Connection<Facebook> connection, WebRequest request) {
    if (request.getAttribute(POST_TO_WALL_ATTRIBUTE, WebRequest.SCOPE_SESSION) != null) {
        try {//  w w  w .j  a  va  2 s .c  o m
            connection.updateStatus("I've connected with the K-Path!");
        } catch (ApiException e) {
            // Do nothing: No need to break down if the post-connect post can't be made.
        }
        request.removeAttribute(POST_TO_WALL_ATTRIBUTE, WebRequest.SCOPE_SESSION);
    }
}

From source file:com.bg.jtown.social.twitter.TweetAfterSignInInterceptor.java

public void postConnect(Connection<Twitter> connection, WebRequest request) {
    if (request.getAttribute(POST_TWEET_ATTRIBUTE, WebRequest.SCOPE_SESSION) != null) {
        try {//from   w w  w  .  j av  a  2 s  . co m
            connection.updateStatus("I've signin with the Mirros!");
            //TODO updateStatus  
        } catch (DuplicateStatusException e) {
        }
        request.removeAttribute(POST_TWEET_ATTRIBUTE, WebRequest.SCOPE_SESSION);
    }
}

From source file:com.bg.jtown.social.twitter.TweetAfterConnectInterceptor.java

public void postConnect(Connection<Twitter> connection, WebRequest request) {
    if (request.getAttribute(POST_TWEET_ATTRIBUTE, WebRequest.SCOPE_SESSION) != null) {
        try {/*  www.ja  v  a 2s.c  o  m*/
            //TODO updateStatus  
            connection.updateStatus("I've connected with the Mirros!");
        } catch (DuplicateStatusException e) {
        }
        request.removeAttribute(POST_TWEET_ATTRIBUTE, WebRequest.SCOPE_SESSION);
    }
}

From source file:org.opensprout.osaf.web.session.PrefixedSessionAttributeStore.java

@Override
public Object retrieveAttribute(WebRequest request, String attributeName) {
    String prefix = (String) request.getAttribute(SessionAttributeNameInterceptor.SESSION_ATTR_PREFIX,
            RequestAttributes.SCOPE_REQUEST);
    return super.retrieveAttribute(request, prefix + attributeName);
}

From source file:org.mytms.common.web.RequestCustomerResolverImpl.java

@Override
public Object getCustomer(WebRequest request) {
    return request.getAttribute(getCustomerRequestAttributeName(), WebRequest.SCOPE_REQUEST);
}

From source file:org.opensprout.osaf.web.session.PrefixedSessionAttributeStore.java

@Override
public void storeAttribute(WebRequest request, String attributeName, Object attributeValue) {
    String prefix = (String) request.getAttribute(SessionAttributeNameInterceptor.SESSION_ATTR_PREFIX,
            RequestAttributes.SCOPE_REQUEST);
    super.storeAttribute(request, prefix + attributeName, attributeValue);
}

From source file:com.springsource.greenhouse.connect.FacebookConnectInterceptor.java

private void postToWall(Connection<Facebook> connection, Account account, WebRequest request) {
    if (request.getAttribute(POST_TO_WALL_ATTRIBUTE, WebRequest.SCOPE_SESSION) != null) {
        connection.getApi().feedOperations().postLink("Join me at the Greenhouse!", new FacebookLink(
                account.getProfileUrl(), "Greenhouse", "Where Spring developers hang out.",
                "We help you connect with fellow application developers and take advantage of everything the Spring community has to offer."));
        request.removeAttribute(POST_TO_WALL_ATTRIBUTE, WebRequest.SCOPE_SESSION);
    }/*from   w  ww  .java 2 s . c o m*/
}