001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.oauth;
016    
017    import com.liferay.portal.kernel.oauth.OAuthException;
018    import com.liferay.portal.kernel.oauth.OAuthRequest;
019    import com.liferay.portal.kernel.oauth.OAuthResponse;
020    import com.liferay.portal.kernel.oauth.Verb;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class OAuthRequestImpl implements OAuthRequest {
026    
027            public OAuthRequestImpl(org.scribe.model.OAuthRequest oAuthRequest) {
028                    _oAuthRequest = oAuthRequest;
029            }
030    
031            public void addBodyParameter(String key, String value) {
032                    _oAuthRequest.addBodyParameter(key, value);
033            }
034    
035            public String getURL() {
036                    return _oAuthRequest.getUrl();
037            }
038    
039            public Verb getVerb() {
040                    return VerbTranslator.translate(
041                            _oAuthRequest.getVerb());
042            }
043    
044            public Object getWrappedOAuthRequest() {
045                    return _oAuthRequest;
046            }
047    
048            public OAuthResponse send() throws OAuthException {
049                    try {
050                            return new OAuthResponseImpl(_oAuthRequest.send());
051                    }
052                    catch (Exception e) {
053                            throw new OAuthException(e);
054                    }
055            }
056    
057            private org.scribe.model.OAuthRequest _oAuthRequest;
058    
059    }