Index: trunk/ivy.xml
===================================================================
--- trunk/ivy.xml	(revision 16402)
+++ trunk/ivy.xml	(revision 16403)
@@ -30,4 +30,5 @@
         <dependency conf="api->default" org="com.drewnoakes" name="metadata-extractor" rev="2.13.0" transitive="false"/>
         <dependency conf="api->default" org="ch.poole" name="OpeningHoursParser" rev="0.21.4"/>
+        <dependency conf="api->default" org="oauth.signpost" name="signpost-core" rev="2.0.0"/>
         <!-- sources->sources -->
         <dependency conf="sources->sources" org="org.openstreetmap.jmapviewer" name="jmapviewer" rev="2.13"/>
@@ -40,4 +41,5 @@
         <dependency conf="sources->sources" org="com.drewnoakes" name="metadata-extractor" rev="2.13.0" transitive="false"/>
         <dependency conf="sources->sources" org="ch.poole" name="OpeningHoursParser" rev="0.21.4"/>
+        <dependency conf="sources->sources" org="oauth.signpost" name="signpost-core" rev="2.0.0"/>
         <!-- commonslang->default -->
         <dependency conf="commonslang->default" org="org.apache.commons" name="commons-lang3" rev="3.10"/>
Index: trunk/src/oauth/signpost/AbstractOAuthConsumer.java
===================================================================
--- trunk/src/oauth/signpost/AbstractOAuthConsumer.java	(revision 16402)
+++ 	(revision )
@@ -1,276 +1,0 @@
-/* Copyright (c) 2009 Matthias Kaeppler
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package oauth.signpost;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Random;
-import java.util.concurrent.TimeUnit;
-
-import oauth.signpost.basic.UrlStringRequestAdapter;
-import oauth.signpost.exception.OAuthCommunicationException;
-import oauth.signpost.exception.OAuthExpectationFailedException;
-import oauth.signpost.exception.OAuthMessageSignerException;
-import oauth.signpost.http.HttpParameters;
-import oauth.signpost.http.HttpRequest;
-import oauth.signpost.signature.AuthorizationHeaderSigningStrategy;
-import oauth.signpost.signature.HmacSha1MessageSigner;
-import oauth.signpost.signature.OAuthMessageSigner;
-import oauth.signpost.signature.QueryStringSigningStrategy;
-import oauth.signpost.signature.SigningStrategy;
-
-/**
- * ABC for consumer implementations. If you're developing a custom consumer you
- * will probably inherit from this class to save you a lot of work.
- *
- * @author Matthias Kaeppler
- */
-public abstract class AbstractOAuthConsumer implements OAuthConsumer {
-
-    private static final long serialVersionUID = 1L;
-
-    private String consumerKey, consumerSecret;
-
-    private String token;
-
-    private OAuthMessageSigner messageSigner;
-
-    private SigningStrategy signingStrategy;
-
-    // these are params that may be passed to the consumer directly (i.e.
-    // without going through the request object)
-    private HttpParameters additionalParameters;
-
-    // these are the params which will be passed to the message signer
-    private HttpParameters requestParameters;
-
-    private boolean sendEmptyTokens;
-
-    final private Random random = new Random(System.nanoTime());
-
-    public AbstractOAuthConsumer(String consumerKey, String consumerSecret) {
-        this.consumerKey = consumerKey;
-        this.consumerSecret = consumerSecret;
-        setMessageSigner(new HmacSha1MessageSigner());
-        setSigningStrategy(new AuthorizationHeaderSigningStrategy());
-    }
-
-    @Override
-    public void setMessageSigner(OAuthMessageSigner messageSigner) {
-        this.messageSigner = messageSigner;
-        messageSigner.setConsumerSecret(consumerSecret);
-    }
-
-    @Override
-    public void setSigningStrategy(SigningStrategy signingStrategy) {
-        this.signingStrategy = signingStrategy;
-    }
-
-    @Override
-    public void setAdditionalParameters(HttpParameters additionalParameters) {
-        this.additionalParameters = additionalParameters;
-    }
-
-    @Override
-    public synchronized HttpRequest sign(HttpRequest request) throws OAuthMessageSignerException,
-            OAuthExpectationFailedException, OAuthCommunicationException {
-        if (consumerKey == null) {
-            throw new OAuthExpectationFailedException("consumer key not set");
-        }
-        if (consumerSecret == null) {
-            throw new OAuthExpectationFailedException("consumer secret not set");
-        }
-
-        requestParameters = new HttpParameters();
-        try {
-            if (additionalParameters != null) {
-                requestParameters.putAll(additionalParameters, false);
-            }
-            collectHeaderParameters(request, requestParameters);
-            collectQueryParameters(request, requestParameters);
-            collectBodyParameters(request, requestParameters);
-
-            // add any OAuth params that haven't already been set
-            completeOAuthParameters(requestParameters);
-
-            requestParameters.remove(OAuth.OAUTH_SIGNATURE);
-
-        } catch (IOException e) {
-            throw new OAuthCommunicationException(e);
-        }
-
-        String signature = messageSigner.sign(request, requestParameters);
-        OAuth.debugOut("signature", signature);
-
-        signingStrategy.writeSignature(signature, request, requestParameters);
-        OAuth.debugOut("Request URL", request.getRequestUrl());
-
-        return request;
-    }
-
-    @Override
-    public synchronized HttpRequest sign(Object request) throws OAuthMessageSignerException,
-            OAuthExpectationFailedException, OAuthCommunicationException {
-        return sign(wrap(request));
-    }
-
-    @Override
-    public synchronized String sign(String url) throws OAuthMessageSignerException,
-            OAuthExpectationFailedException, OAuthCommunicationException {
-        HttpRequest request = new UrlStringRequestAdapter(url);
-
-        // switch to URL signing
-        SigningStrategy oldStrategy = this.signingStrategy;
-        this.signingStrategy = new QueryStringSigningStrategy();
-
-        sign(request);
-
-        // revert to old strategy
-        this.signingStrategy = oldStrategy;
-
-        return request.getRequestUrl();
-    }
-
-    /**
-     * Adapts the given request object to a Signpost {@link HttpRequest}. How
-     * this is done depends on the consumer implementation.
-     *
-     * @param request
-     *        the native HTTP request instance
-     * @return the adapted request
-     */
-    protected abstract HttpRequest wrap(Object request);
-
-    @Override
-    public void setTokenWithSecret(String token, String tokenSecret) {
-        this.token = token;
-        messageSigner.setTokenSecret(tokenSecret);
-    }
-
-    @Override
-    public String getToken() {
-        return token;
-    }
-
-    @Override
-    public String getTokenSecret() {
-        return messageSigner.getTokenSecret();
-    }
-
-    @Override
-    public String getConsumerKey() {
-        return this.consumerKey;
-    }
-
-    @Override
-    public String getConsumerSecret() {
-        return this.consumerSecret;
-    }
-
-    /**
-     * <p>
-     * Helper method that adds any OAuth parameters to the given request
-     * parameters which are missing from the current request but required for
-     * signing. A good example is the oauth_nonce parameter, which is typically
-     * not provided by the client in advance.
-     * </p>
-     * <p>
-     * It's probably not a very good idea to override this method. If you want
-     * to generate different nonces or timestamps, override
-     * {@link #generateNonce()} or {@link #generateTimestamp()} instead.
-     * </p>
-     *
-     * @param out
-     *        the request parameter which should be completed
-     */
-    protected void completeOAuthParameters(HttpParameters out) {
-        if (!out.containsKey(OAuth.OAUTH_CONSUMER_KEY)) {
-            out.put(OAuth.OAUTH_CONSUMER_KEY, consumerKey, true);
-        }
-        if (!out.containsKey(OAuth.OAUTH_SIGNATURE_METHOD)) {
-            out.put(OAuth.OAUTH_SIGNATURE_METHOD, messageSigner.getSignatureMethod(), true);
-        }
-        if (!out.containsKey(OAuth.OAUTH_TIMESTAMP)) {
-            out.put(OAuth.OAUTH_TIMESTAMP, generateTimestamp(), true);
-        }
-        if (!out.containsKey(OAuth.OAUTH_NONCE)) {
-            out.put(OAuth.OAUTH_NONCE, generateNonce(), true);
-        }
-        if (!out.containsKey(OAuth.OAUTH_VERSION)) {
-            out.put(OAuth.OAUTH_VERSION, OAuth.VERSION_1_0, true);
-        }
-        if (!out.containsKey(OAuth.OAUTH_TOKEN)) {
-            if (token != null && !token.equals("") || sendEmptyTokens) {
-                out.put(OAuth.OAUTH_TOKEN, token, true);
-            }
-        }
-    }
-
-    @Override
-    public HttpParameters getRequestParameters() {
-        return requestParameters;
-    }
-
-    @Override
-    public void setSendEmptyTokens(boolean enable) {
-        this.sendEmptyTokens = enable;
-    }
-
-    /**
-     * Collects OAuth Authorization header parameters as per OAuth Core 1.0 spec
-     * section 9.1.1
-     */
-    protected void collectHeaderParameters(HttpRequest request, HttpParameters out) {
-        HttpParameters headerParams = OAuth.oauthHeaderToParamsMap(request.getHeader(OAuth.HTTP_AUTHORIZATION_HEADER));
-        out.putAll(headerParams, false);
-    }
-
-    /**
-     * Collects x-www-form-urlencoded body parameters as per OAuth Core 1.0 spec
-     * section 9.1.1
-     */
-    protected void collectBodyParameters(HttpRequest request, HttpParameters out)
-            throws IOException {
-
-        // collect x-www-form-urlencoded body params
-        String contentType = request.getContentType();
-        if (contentType != null && contentType.startsWith(OAuth.FORM_ENCODED)) {
-            InputStream payload = request.getMessagePayload();
-            out.putAll(OAuth.decodeForm(payload), true);
-        }
-    }
-
-    /**
-     * Collects HTTP GET query string parameters as per OAuth Core 1.0 spec
-     * section 9.1.1
-     */
-    protected void collectQueryParameters(HttpRequest request, HttpParameters out) {
-
-        String url = request.getRequestUrl();
-        int q = url.indexOf('?');
-        if (q >= 0) {
-            // Combine the URL query string with the other parameters:
-            out.putAll(OAuth.decodeForm(url.substring(q + 1)), true);
-        }
-    }
-
-    protected String generateTimestamp() {
-        return Long.toString(System.currentTimeMillis() / TimeUnit.SECONDS.toMillis(1));
-    }
-
-    protected String generateNonce() {
-        return Long.toString(random.nextLong());
-    }
-}
Index: trunk/src/oauth/signpost/AbstractOAuthProvider.java
===================================================================
--- trunk/src/oauth/signpost/AbstractOAuthProvider.java	(revision 16402)
+++ 	(revision )
@@ -1,362 +1,0 @@
-/*
- * Copyright (c) 2009 Matthias Kaeppler Licensed under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
- * or agreed to in writing, software distributed under the License is
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-package oauth.signpost;
-
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.Map;
-
-import oauth.signpost.exception.OAuthCommunicationException;
-import oauth.signpost.exception.OAuthExpectationFailedException;
-import oauth.signpost.exception.OAuthMessageSignerException;
-import oauth.signpost.exception.OAuthNotAuthorizedException;
-import oauth.signpost.http.HttpParameters;
-import oauth.signpost.http.HttpRequest;
-import oauth.signpost.http.HttpResponse;
-
-/**
- * ABC for all provider implementations. If you're writing a custom provider,
- * you will probably inherit from this class, since it takes a lot of work from
- * you.
- *
- * @author Matthias Kaeppler
- */
-public abstract class AbstractOAuthProvider implements OAuthProvider {
-
-    private static final long serialVersionUID = 1L;
-
-    private String requestTokenEndpointUrl;
-
-    private String accessTokenEndpointUrl;
-
-    private String authorizationWebsiteUrl;
-
-    private HttpParameters responseParameters;
-
-    private Map<String, String> defaultHeaders;
-
-    private boolean isOAuth10a;
-
-    private transient OAuthProviderListener listener;
-
-    public AbstractOAuthProvider(String requestTokenEndpointUrl, String accessTokenEndpointUrl,
-            String authorizationWebsiteUrl) {
-        this.requestTokenEndpointUrl = requestTokenEndpointUrl;
-        this.accessTokenEndpointUrl = accessTokenEndpointUrl;
-        this.authorizationWebsiteUrl = authorizationWebsiteUrl;
-        this.responseParameters = new HttpParameters();
-        this.defaultHeaders = new HashMap<String, String>();
-    }
-
-    @Override
-    public synchronized String retrieveRequestToken(OAuthConsumer consumer, String callbackUrl,
-            String... customOAuthParams) throws OAuthMessageSignerException,
-            OAuthNotAuthorizedException, OAuthExpectationFailedException,
-            OAuthCommunicationException {
-
-        // invalidate current credentials, if any
-        consumer.setTokenWithSecret(null, null);
-
-        // 1.0a expects the callback to be sent while getting the request token.
-        // 1.0 service providers would simply ignore this parameter.
-        HttpParameters params = new HttpParameters();
-        params.putAll(customOAuthParams, true);
-        params.put(OAuth.OAUTH_CALLBACK, callbackUrl, true);
-
-        retrieveToken(consumer, requestTokenEndpointUrl, params);
-
-        String callbackConfirmed = responseParameters.getFirst(OAuth.OAUTH_CALLBACK_CONFIRMED);
-        responseParameters.remove(OAuth.OAUTH_CALLBACK_CONFIRMED);
-        isOAuth10a = Boolean.TRUE.toString().equals(callbackConfirmed);
-
-        // 1.0 service providers expect the callback as part of the auth URL,
-        // Do not send when 1.0a.
-        if (isOAuth10a) {
-            return OAuth.addQueryParameters(authorizationWebsiteUrl, OAuth.OAUTH_TOKEN,
-                consumer.getToken());
-        } else {
-            return OAuth.addQueryParameters(authorizationWebsiteUrl, OAuth.OAUTH_TOKEN,
-                consumer.getToken(), OAuth.OAUTH_CALLBACK, callbackUrl);
-        }
-    }
-
-    @Override
-    public synchronized void retrieveAccessToken(OAuthConsumer consumer, String oauthVerifier,
-            String... customOAuthParams) throws OAuthMessageSignerException,
-            OAuthNotAuthorizedException, OAuthExpectationFailedException,
-            OAuthCommunicationException {
-
-        if (consumer.getToken() == null || consumer.getTokenSecret() == null) {
-            throw new OAuthExpectationFailedException(
-                    "Authorized request token or token secret not set. "
-                            + "Did you retrieve an authorized request token before?");
-        }
-
-        HttpParameters params = new HttpParameters();
-        params.putAll(customOAuthParams, true);
-
-        if (isOAuth10a && oauthVerifier != null) {
-            params.put(OAuth.OAUTH_VERIFIER, oauthVerifier, true);
-        }
-        retrieveToken(consumer, accessTokenEndpointUrl, params);
-    }
-
-    /**
-     * <p>
-     * Implemented by subclasses. The responsibility of this method is to
-     * contact the service provider at the given endpoint URL and fetch a
-     * request or access token. What kind of token is retrieved solely depends
-     * on the URL being used.
-     * </p>
-     * <p>
-     * Correct implementations of this method must guarantee the following
-     * post-conditions:
-     * <ul>
-     * <li>the {@link OAuthConsumer} passed to this method must have a valid
-     * {@link OAuth#OAUTH_TOKEN} and {@link OAuth#OAUTH_TOKEN_SECRET} set by
-     * calling {@link OAuthConsumer#setTokenWithSecret(String, String)}</li>
-     * <li>{@link #getResponseParameters()} must return the set of query
-     * parameters served by the service provider in the token response, with all
-     * OAuth specific parameters being removed</li>
-     * </ul>
-     * </p>
-     *
-     * @param consumer
-     *        the {@link OAuthConsumer} that should be used to sign the request
-     * @param endpointUrl
-     *        the URL at which the service provider serves the OAuth token that
-     *        is to be fetched
-     * @param customOAuthParams
-     *        you can pass custom OAuth parameters here (such as oauth_callback
-     *        or oauth_verifier) which will go directly into the signer, i.e.
-     *        you don't have to put them into the request first.
-     * @throws OAuthMessageSignerException
-     *         if signing the token request fails
-     * @throws OAuthCommunicationException
-     *         if a network communication error occurs
-     * @throws OAuthNotAuthorizedException
-     *         if the server replies 401 - Unauthorized
-     * @throws OAuthExpectationFailedException
-     *         if an expectation has failed, e.g. because the server didn't
-     *         reply in the expected format
-     */
-    protected void retrieveToken(OAuthConsumer consumer, String endpointUrl,
-            HttpParameters customOAuthParams) throws OAuthMessageSignerException,
-            OAuthCommunicationException, OAuthNotAuthorizedException,
-            OAuthExpectationFailedException {
-        Map<String, String> defaultHeaders = getRequestHeaders();
-
-        if (consumer.getConsumerKey() == null || consumer.getConsumerSecret() == null) {
-            throw new OAuthExpectationFailedException("Consumer key or secret not set");
-        }
-
-        HttpRequest request = null;
-        HttpResponse response = null;
-        try {
-            request = createRequest(endpointUrl);
-            for (String header : defaultHeaders.keySet()) {
-                request.setHeader(header, defaultHeaders.get(header));
-            }
-            if (customOAuthParams != null && !customOAuthParams.isEmpty()) {
-                consumer.setAdditionalParameters(customOAuthParams);
-            }
-
-            if (this.listener != null) {
-                this.listener.prepareRequest(request);
-            }
-
-            consumer.sign(request);
-
-            if (this.listener != null) {
-                this.listener.prepareSubmission(request);
-            }
-
-            response = sendRequest(request);
-            int statusCode = response.getStatusCode();
-
-            boolean requestHandled = false;
-            if (this.listener != null) {
-                requestHandled = this.listener.onResponseReceived(request, response);
-            }
-            if (requestHandled) {
-                return;
-            }
-
-            if (statusCode >= 300) {
-                handleUnexpectedResponse(statusCode, response);
-            }
-
-            HttpParameters responseParams = OAuth.decodeForm(response.getContent());
-
-            String token = responseParams.getFirst(OAuth.OAUTH_TOKEN);
-            String secret = responseParams.getFirst(OAuth.OAUTH_TOKEN_SECRET);
-            responseParams.remove(OAuth.OAUTH_TOKEN);
-            responseParams.remove(OAuth.OAUTH_TOKEN_SECRET);
-
-            setResponseParameters(responseParams);
-
-            if (token == null || secret == null) {
-                throw new OAuthExpectationFailedException(
-                        "Request token or token secret not set in server reply. "
-                                + "The service provider you use is probably buggy.");
-            }
-
-            consumer.setTokenWithSecret(token, secret);
-
-        } catch (OAuthNotAuthorizedException e) {
-            throw e;
-        } catch (OAuthExpectationFailedException e) {
-            throw e;
-        } catch (Exception e) {
-            throw new OAuthCommunicationException(e);
-        } finally {
-            try {
-                closeConnection(request, response);
-            } catch (Exception e) {
-                throw new OAuthCommunicationException(e);
-            }
-        }
-    }
-
-    protected void handleUnexpectedResponse(int statusCode, HttpResponse response) throws Exception {
-        if (response == null) {
-            return;
-        }
-        StringBuilder responseBody = new StringBuilder();
-        InputStream content = response.getContent();
-        if (content != null) {
-            BufferedReader reader = new BufferedReader(new InputStreamReader(content));
-
-            String line = reader.readLine();
-            while (line != null) {
-                responseBody.append(line);
-                line = reader.readLine();
-            }
-        }
-
-        switch (statusCode) {
-        case 401:
-            throw new OAuthNotAuthorizedException(responseBody.toString());
-        default:
-            throw new OAuthCommunicationException("Service provider responded in error: "
-                    + statusCode + " (" + response.getReasonPhrase() + ")", responseBody.toString());
-        }
-    }
-
-    /**
-     * Overrride this method if you want to customize the logic for building a
-     * request object for the given endpoint URL.
-     *
-     * @param endpointUrl
-     *        the URL to which the request will go
-     * @return the request object
-     * @throws Exception
-     *         if something breaks
-     */
-    protected abstract HttpRequest createRequest(String endpointUrl) throws Exception;
-
-    /**
-     * Override this method if you want to customize the logic for how the given
-     * request is sent to the server.
-     *
-     * @param request
-     *        the request to send
-     * @return the response to the request
-     * @throws Exception
-     *         if something breaks
-     */
-    protected abstract HttpResponse sendRequest(HttpRequest request) throws Exception;
-
-    /**
-     * Called when the connection is being finalized after receiving the
-     * response. Use this to do any cleanup / resource freeing.
-     *
-     * @param request
-     *        the request that has been sent
-     * @param response
-     *        the response that has been received
-     * @throws Exception
-     *         if something breaks
-     */
-    protected void closeConnection(HttpRequest request, HttpResponse response) throws Exception {
-        // NOP
-    }
-
-    @Override
-    public HttpParameters getResponseParameters() {
-        return responseParameters;
-    }
-
-    /**
-     * Returns a single query parameter as served by the service provider in a
-     * token reply. You must call {@link #setResponseParameters} with the set of
-     * parameters before using this method.
-     *
-     * @param key
-     *        the parameter name
-     * @return the parameter value
-     */
-    protected String getResponseParameter(String key) {
-        return responseParameters.getFirst(key);
-    }
-
-    @Override
-    public void setResponseParameters(HttpParameters parameters) {
-        this.responseParameters = parameters;
-    }
-
-    @Override
-    public void setOAuth10a(boolean isOAuth10aProvider) {
-        this.isOAuth10a = isOAuth10aProvider;
-    }
-
-    @Override
-    public boolean isOAuth10a() {
-        return isOAuth10a;
-    }
-
-    @Override
-    public String getRequestTokenEndpointUrl() {
-        return this.requestTokenEndpointUrl;
-    }
-
-    @Override
-    public String getAccessTokenEndpointUrl() {
-        return this.accessTokenEndpointUrl;
-    }
-
-    @Override
-    public String getAuthorizationWebsiteUrl() {
-        return this.authorizationWebsiteUrl;
-    }
-
-    @Override
-    public void setRequestHeader(String header, String value) {
-        defaultHeaders.put(header, value);
-    }
-
-    @Override
-    public Map<String, String> getRequestHeaders() {
-        return defaultHeaders;
-    }
-
-    @Override
-    public void setListener(OAuthProviderListener listener) {
-        this.listener = listener;
-    }
-
-    @Override
-    public void removeListener(OAuthProviderListener listener) {
-        this.listener = null;
-    }
-}
Index: trunk/src/oauth/signpost/OAuth.java
===================================================================
--- trunk/src/oauth/signpost/OAuth.java	(revision 16402)
+++ 	(revision )
@@ -1,315 +1,0 @@
-/* Copyright (c) 2008, 2009 Netflix, Matthias Kaeppler
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package oauth.signpost;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.URLDecoder;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import oauth.signpost.http.HttpParameters;
-
-import com.google.gdata.util.common.base.PercentEscaper;
-
-public class OAuth {
-
-    public static final String VERSION_1_0 = "1.0";
-
-    public static final String ENCODING = "UTF-8";
-
-    public static final String FORM_ENCODED = "application/x-www-form-urlencoded";
-
-    public static final String HTTP_AUTHORIZATION_HEADER = "Authorization";
-
-    public static final String OAUTH_CONSUMER_KEY = "oauth_consumer_key";
-
-    public static final String OAUTH_TOKEN = "oauth_token";
-
-    public static final String OAUTH_TOKEN_SECRET = "oauth_token_secret";
-
-    public static final String OAUTH_SIGNATURE_METHOD = "oauth_signature_method";
-
-    public static final String OAUTH_SIGNATURE = "oauth_signature";
-
-    public static final String OAUTH_TIMESTAMP = "oauth_timestamp";
-
-    public static final String OAUTH_NONCE = "oauth_nonce";
-
-    public static final String OAUTH_VERSION = "oauth_version";
-
-    public static final String OAUTH_CALLBACK = "oauth_callback";
-
-    public static final String OAUTH_CALLBACK_CONFIRMED = "oauth_callback_confirmed";
-
-    public static final String OAUTH_VERIFIER = "oauth_verifier";
-
-    /**
-     * Pass this value as the callback "url" upon retrieving a request token if
-     * your application cannot receive callbacks (e.g. because it's a desktop
-     * app). This will tell the service provider that verification happens
-     * out-of-band, which basically means that it will generate a PIN code (the
-     * OAuth verifier) and display that to your user. You must obtain this code
-     * from your user and pass it to
-     * {@link OAuthProvider#retrieveAccessToken(OAuthConsumer, String)} in order
-     * to complete the token handshake.
-     */
-    public static final String OUT_OF_BAND = "oob";
-
-    private static final PercentEscaper percentEncoder = new PercentEscaper(
-            "-._~", false);
-
-    public static String percentEncode(String s) {
-        if (s == null) {
-            return "";
-        }
-        return percentEncoder.escape(s);
-    }
-
-    public static String percentDecode(String s) {
-        try {
-            if (s == null) {
-                return "";
-            }
-            return URLDecoder.decode(s, ENCODING);
-            // This implements http://oauth.pbwiki.com/FlexibleDecoding
-        } catch (java.io.UnsupportedEncodingException wow) {
-            throw new RuntimeException(wow.getMessage(), wow);
-        }
-    }
-
-    /**
-     * Construct a x-www-form-urlencoded document containing the given sequence
-     * of name/value pairs. Use OAuth percent encoding (not exactly the encoding
-     * mandated by x-www-form-urlencoded).
-     */
-    public static <T extends Map.Entry<String, String>> void formEncode(Collection<T> parameters,
-            OutputStream into) throws IOException {
-        if (parameters != null) {
-            boolean first = true;
-            for (Map.Entry<String, String> entry : parameters) {
-                if (first) {
-                    first = false;
-                } else {
-                    into.write('&');
-                }
-                into.write(percentEncode(safeToString(entry.getKey())).getBytes());
-                into.write('=');
-                into.write(percentEncode(safeToString(entry.getValue())).getBytes());
-            }
-        }
-    }
-
-    /**
-     * Construct a x-www-form-urlencoded document containing the given sequence
-     * of name/value pairs. Use OAuth percent encoding (not exactly the encoding
-     * mandated by x-www-form-urlencoded).
-     */
-    public static <T extends Map.Entry<String, String>> String formEncode(Collection<T> parameters)
-            throws IOException {
-        ByteArrayOutputStream b = new ByteArrayOutputStream();
-        formEncode(parameters, b);
-        return new String(b.toByteArray());
-    }
-
-    /** Parse a form-urlencoded document. */
-    public static HttpParameters decodeForm(String form) {
-        HttpParameters params = new HttpParameters();
-        if (isEmpty(form)) {
-            return params;
-        }
-        for (String nvp : form.split("\\&")) {
-            int equals = nvp.indexOf('=');
-            String name;
-            String value;
-            if (equals < 0) {
-                name = percentDecode(nvp);
-                value = null;
-            } else {
-                name = percentDecode(nvp.substring(0, equals));
-                value = percentDecode(nvp.substring(equals + 1));
-            }
-
-            params.put(name, value);
-        }
-        return params;
-    }
-
-    public static HttpParameters decodeForm(InputStream content)
-            throws IOException {
-        BufferedReader reader = new BufferedReader(new InputStreamReader(
-                content));
-        StringBuilder sb = new StringBuilder();
-        String line = reader.readLine();
-        while (line != null) {
-            sb.append(line);
-            line = reader.readLine();
-        }
-
-        return decodeForm(sb.toString());
-    }
-
-    /**
-     * Construct a Map containing a copy of the given parameters. If several
-     * parameters have the same name, the Map will contain the first value,
-     * only.
-     */
-    public static <T extends Map.Entry<String, String>> Map<String, String> toMap(Collection<T> from) {
-        HashMap<String, String> map = new HashMap<String, String>();
-        if (from != null) {
-            for (Map.Entry<String, String> entry : from) {
-                String key = entry.getKey();
-                if (!map.containsKey(key)) {
-                    map.put(key, entry.getValue());
-                }
-            }
-        }
-        return map;
-    }
-
-    public static final String safeToString(Object from) {
-        return (from == null) ? null : from.toString();
-    }
-
-    public static boolean isEmpty(String str) {
-        return (str == null) || (str.length() == 0);
-    }
-
-    /**
-     * Appends a list of key/value pairs to the given URL, e.g.:
-     * 
-     * <pre>
-     * String url = OAuth.addQueryParameters(&quot;http://example.com?a=1&quot;, b, 2, c, 3);
-     * </pre>
-     * 
-     * which yields:
-     * 
-     * <pre>
-     * http://example.com?a=1&b=2&c=3
-     * </pre>
-     * 
-     * All parameters will be encoded according to OAuth's percent encoding
-     * rules.
-     * 
-     * @param url
-     *        the URL
-     * @param kvPairs
-     *        the list of key/value pairs
-     * @return
-     */
-    public static String addQueryParameters(String url, String... kvPairs) {
-        String queryDelim = url.contains("?") ? "&" : "?";
-        StringBuilder sb = new StringBuilder(url + queryDelim);
-        for (int i = 0; i < kvPairs.length; i += 2) {
-            if (i > 0) {
-                sb.append("&");
-            }
-            sb.append(OAuth.percentEncode(kvPairs[i]) + "="
-                    + OAuth.percentEncode(kvPairs[i + 1]));
-        }
-        return sb.toString();
-    }
-
-    public static String addQueryParameters(String url, Map<String, String> params) {
-        String[] kvPairs = new String[params.size() * 2];
-        int idx = 0;
-        for (String key : params.keySet()) {
-            kvPairs[idx] = key;
-            kvPairs[idx + 1] = params.get(key);
-            idx += 2;
-        }
-        return addQueryParameters(url, kvPairs);
-    }
-
-    public static String addQueryString(String url, String queryString) {
-        String queryDelim = url.contains("?") ? "&" : "?";
-        StringBuilder sb = new StringBuilder(url + queryDelim);
-        sb.append(queryString);
-        return sb.toString();
-    }
-
-    /**
-     * Builds an OAuth header from the given list of header fields. All
-     * parameters starting in 'oauth_*' will be percent encoded.
-     * 
-     * <pre>
-     * String authHeader = OAuth.prepareOAuthHeader(&quot;realm&quot;, &quot;http://example.com&quot;, &quot;oauth_token&quot;, &quot;x%y&quot;);
-     * </pre>
-     * 
-     * which yields:
-     * 
-     * <pre>
-     * OAuth realm=&quot;http://example.com&quot;, oauth_token=&quot;x%25y&quot;
-     * </pre>
-     * 
-     * @param kvPairs
-     *        the list of key/value pairs
-     * @return a string eligible to be used as an OAuth HTTP Authorization
-     *         header.
-     */
-    public static String prepareOAuthHeader(String... kvPairs) {
-        StringBuilder sb = new StringBuilder("OAuth ");
-        for (int i = 0; i < kvPairs.length; i += 2) {
-            if (i > 0) {
-                sb.append(", ");
-            }
-            boolean isOAuthElem = kvPairs[i].startsWith("oauth_")
-                    || kvPairs[i].startsWith("x_oauth_");
-            String value = isOAuthElem ? OAuth.percentEncode(kvPairs[i + 1]) : kvPairs[i + 1];
-            sb.append(OAuth.percentEncode(kvPairs[i]) + "=\"" + value + "\"");
-        }
-        return sb.toString();
-    }
-
-    public static HttpParameters oauthHeaderToParamsMap(String oauthHeader) {
-        HttpParameters params = new HttpParameters();
-        if (oauthHeader == null || !oauthHeader.startsWith("OAuth ")) {
-            return params;
-        }
-        oauthHeader = oauthHeader.substring("OAuth ".length());
-        String[] elements = oauthHeader.split(",");
-        for (String keyValuePair : elements) {
-            String[] keyValue = keyValuePair.split("=");
-            params.put(keyValue[0].trim(), keyValue[1].replace("\"", "").trim());
-        }
-        return params;
-    }
-
-    /**
-     * Helper method to concatenate a parameter and its value to a pair that can
-     * be used in an HTTP header. This method percent encodes both parts before
-     * joining them.
-     * 
-     * @param name
-     *        the OAuth parameter name, e.g. oauth_token
-     * @param value
-     *        the OAuth parameter value, e.g. 'hello oauth'
-     * @return a name/value pair, e.g. oauth_token="hello%20oauth"
-     */
-    public static String toHeaderElement(String name, String value) {
-        return OAuth.percentEncode(name) + "=\"" + OAuth.percentEncode(value) + "\"";
-    }
-
-    public static void debugOut(String key, String value) {
-        if (System.getProperty("debug") != null) {
-            System.out.println("[SIGNPOST] " + key + ": " + value);
-        }
-    }
-}
Index: trunk/src/oauth/signpost/OAuthConsumer.java
===================================================================
--- trunk/src/oauth/signpost/OAuthConsumer.java	(revision 16402)
+++ 	(revision )
@@ -1,193 +1,0 @@
-/* Copyright (c) 2009 Matthias Kaeppler
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package oauth.signpost;
-
-import java.io.Serializable;
-
-import oauth.signpost.exception.OAuthCommunicationException;
-import oauth.signpost.exception.OAuthExpectationFailedException;
-import oauth.signpost.exception.OAuthMessageSignerException;
-import oauth.signpost.http.HttpParameters;
-import oauth.signpost.http.HttpRequest;
-import oauth.signpost.signature.AuthorizationHeaderSigningStrategy;
-import oauth.signpost.signature.HmacSha1MessageSigner;
-import oauth.signpost.signature.OAuthMessageSigner;
-import oauth.signpost.signature.QueryStringSigningStrategy;
-import oauth.signpost.signature.SigningStrategy;
-
-/**
- * <p>
- * Exposes a simple interface to sign HTTP requests using a given OAuth token
- * and secret. Refer to {@link OAuthProvider} how to retrieve a valid token and
- * token secret.
- * </p>
- * <p>
- * HTTP messages are signed as follows:
- * <p>
- *
- * <pre>
- * // exchange the arguments with the actual token/secret pair
- * OAuthConsumer consumer = new DefaultOAuthConsumer(&quot;1234&quot;, &quot;5678&quot;);
- *
- * URL url = new URL(&quot;http://example.com/protected.xml&quot;);
- * HttpURLConnection request = (HttpURLConnection) url.openConnection();
- *
- * consumer.sign(request);
- *
- * request.connect();
- * </pre>
- *
- * </p>
- * </p>
- *
- * @author Matthias Kaeppler
- */
-public interface OAuthConsumer extends Serializable {
-
-    /**
-     * Sets the message signer that should be used to generate the OAuth
-     * signature.
-     *
-     * @param messageSigner
-     *        the signer
-     * @see HmacSha1MessageSigner
-     */
-    public void setMessageSigner(OAuthMessageSigner messageSigner);
-
-    /**
-     * Allows you to add parameters (typically OAuth parameters such as
-     * oauth_callback or oauth_verifier) which will go directly into the signer,
-     * i.e. you don't have to put them into the request first. The consumer's
-     * {@link SigningStrategy} will then take care of writing them to the
-     * correct part of the request before it is sent. This is useful if you want
-     * to pre-set custom OAuth parameters. Note that these parameters are
-     * expected to already be percent encoded -- they will be simply merged
-     * as-is. <b>BE CAREFUL WITH THIS METHOD! Your service provider may decide
-     * to ignore any non-standard OAuth params when computing the signature.</b>
-     *
-     * @param additionalParameters
-     *        the parameters
-     */
-    public void setAdditionalParameters(HttpParameters additionalParameters);
-
-    /**
-     * Defines which strategy should be used to write a signature to an HTTP
-     * request.
-     *
-     * @param signingStrategy
-     *        the strategy
-     * @see AuthorizationHeaderSigningStrategy
-     * @see QueryStringSigningStrategy
-     */
-    public void setSigningStrategy(SigningStrategy signingStrategy);
-
-    /**
-     * <p>
-     * Causes the consumer to always include the oauth_token parameter to be
-     * sent, even if blank. If you're seeing 401s during calls to
-     * {@link OAuthProvider#retrieveRequestToken}, try setting this to true.
-     * </p>
-     *
-     * @param enable
-     *        true or false
-     */
-    public void setSendEmptyTokens(boolean enable);
-
-    /**
-     * Signs the given HTTP request by writing an OAuth signature (and other
-     * required OAuth parameters) to it. Where these parameters are written
-     * depends on the current {@link SigningStrategy}.
-     *
-     * @param request
-     *        the request to sign
-     * @return the request object passed as an argument
-     * @throws OAuthMessageSignerException
-     * @throws OAuthExpectationFailedException
-     * @throws OAuthCommunicationException
-     */
-    public HttpRequest sign(HttpRequest request) throws OAuthMessageSignerException,
-            OAuthExpectationFailedException, OAuthCommunicationException;
-
-    /**
-     * <p>
-     * Signs the given HTTP request by writing an OAuth signature (and other
-     * required OAuth parameters) to it. Where these parameters are written
-     * depends on the current {@link SigningStrategy}.
-     * </p>
-     * This method accepts HTTP library specific request objects; the consumer
-     * implementation must ensure that only those request types are passed which
-     * it supports.
-     *
-     * @param request
-     *        the request to sign
-     * @return the request object passed as an argument
-     * @throws OAuthMessageSignerException
-     * @throws OAuthExpectationFailedException
-     * @throws OAuthCommunicationException
-     */
-    public HttpRequest sign(Object request) throws OAuthMessageSignerException,
-            OAuthExpectationFailedException, OAuthCommunicationException;
-
-    /**
-     * <p>
-     * "Signs" the given URL by appending all OAuth parameters to it which are
-     * required for message signing. The assumed HTTP method is GET.
-     * Essentially, this is equivalent to signing an HTTP GET request, but it
-     * can be useful if your application requires clickable links to protected
-     * resources, i.e. when your application does not have access to the actual
-     * request that is being sent.
-     * </p>
-     *
-     * @param url
-     *        the input URL. May have query parameters.
-     * @return the input URL, with all necessary OAuth parameters attached as a
-     *         query string. Existing query parameters are preserved.
-     * @throws OAuthMessageSignerException
-     * @throws OAuthExpectationFailedException
-     * @throws OAuthCommunicationException
-     */
-    public String sign(String url) throws OAuthMessageSignerException,
-            OAuthExpectationFailedException, OAuthCommunicationException;
-
-    /**
-     * Sets the OAuth token and token secret used for message signing.
-     *
-     * @param token
-     *        the token
-     * @param tokenSecret
-     *        the token secret
-     */
-    public void setTokenWithSecret(String token, String tokenSecret);
-
-    public String getToken();
-
-    public String getTokenSecret();
-
-    public String getConsumerKey();
-
-    public String getConsumerSecret();
-
-    /**
-     * Returns all parameters collected from the HTTP request during message
-     * signing (this means the return value may be NULL before a call to
-     * {@link #sign}), plus all required OAuth parameters that were added
-     * because the request didn't contain them beforehand. In other words, this
-     * is the exact set of parameters that were used for creating the message
-     * signature.
-     *
-     * @return the request parameters used for message signing
-     */
-    public HttpParameters getRequestParameters();
-}
Index: trunk/src/oauth/signpost/OAuthProvider.java
===================================================================
--- trunk/src/oauth/signpost/OAuthProvider.java	(revision 16402)
+++ 	(revision )
@@ -1,244 +1,0 @@
-/*
- * Copyright (c) 2009 Matthias Kaeppler Licensed under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
- * or agreed to in writing, software distributed under the License is
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-package oauth.signpost;
-
-import java.io.Serializable;
-import java.util.Map;
-
-import oauth.signpost.exception.OAuthCommunicationException;
-import oauth.signpost.exception.OAuthExpectationFailedException;
-import oauth.signpost.exception.OAuthMessageSignerException;
-import oauth.signpost.exception.OAuthNotAuthorizedException;
-import oauth.signpost.http.HttpParameters;
-
-/**
- * <p>
- * Supplies an interface that can be used to retrieve request and access tokens
- * from an OAuth 1.0(a) service provider. A provider object requires an
- * {@link OAuthConsumer} to sign the token request message; after a token has
- * been retrieved, the consumer is automatically updated with the token and the
- * corresponding secret.
- * </p>
- * <p>
- * To initiate the token exchange, create a new provider instance and configure
- * it with the URLs the service provider exposes for requesting tokens and
- * resource authorization, e.g.:
- * </p>
- *
- * <pre>
- * OAuthProvider provider = new DefaultOAuthProvider(&quot;http://twitter.com/oauth/request_token&quot;,
- *         &quot;http://twitter.com/oauth/access_token&quot;, &quot;http://twitter.com/oauth/authorize&quot;);
- * </pre>
- * <p>
- * Depending on the HTTP library you use, you may need a different provider
- * type, refer to the website documentation for how to do that.
- * </p>
- * <p>
- * To receive a request token which the user must authorize, you invoke it using
- * a consumer instance and a callback URL:
- * </p>
- * <p>
- *
- * <pre>
- * String url = provider.retrieveRequestToken(consumer, &quot;http://www.example.com/callback&quot;);
- * </pre>
- *
- * </p>
- * <p>
- * That url must be opened in a Web browser, where the user can grant access to
- * the resources in question. If that succeeds, the service provider will
- * redirect to the callback URL and append the blessed request token.
- * </p>
- * <p>
- * That token must now be exchanged for an access token, as such:
- * </p>
- * <p>
- *
- * <pre>
- * provider.retrieveAccessToken(consumer, nullOrVerifierCode);
- * </pre>
- *
- * </p>
- * <p>
- * where nullOrVerifierCode is either null if your provided a callback URL in
- * the previous step, or the pin code issued by the service provider to the user
- * if the request was out-of-band (cf. {@link OAuth#OUT_OF_BAND}.
- * </p>
- * <p>
- * The consumer used during token handshakes is now ready for signing.
- * </p>
- *
- * @see OAuthProviderListener
- */
-public interface OAuthProvider extends Serializable {
-
-    /**
-     * Queries the service provider for a request token.
-     * <p>
-     * <b>Pre-conditions:</b> the given {@link OAuthConsumer} must have a valid
-     * consumer key and consumer secret already set.
-     * </p>
-     * <p>
-     * <b>Post-conditions:</b> the given {@link OAuthConsumer} will have an
-     * unauthorized request token and token secret set.
-     * </p>
-     *
-     * @param consumer
-     *        the {@link OAuthConsumer} that should be used to sign the request
-     * @param callbackUrl
-     *        Pass an actual URL if your app can receive callbacks and you want
-     *        to get informed about the result of the authorization process.
-     *        Pass {@link OAuth.OUT_OF_BAND} if the service provider implements
-     *        OAuth 1.0a and your app cannot receive callbacks. Pass null if the
-     *        service provider implements OAuth 1.0 and your app cannot receive
-     *        callbacks. Please note that some services (among them Twitter)
-     *        will fail authorization if you pass a callback URL but register
-     *        your application as a desktop app (which would only be able to
-     *        handle OOB requests).
-     * @param customOAuthParams
-     *        you can pass custom OAuth parameters here which will go directly
-     *        into the signer, i.e. you don't have to put them into the request
-     *        first. This is useful for pre-setting OAuth params for signing.
-     *        Pass them sequentially in key/value order.
-     * @return The URL to which the user must be sent in order to authorize the
-     *         consumer. It includes the unauthorized request token (and in the
-     *         case of OAuth 1.0, the callback URL -- 1.0a clients send along
-     *         with the token request).
-     * @throws OAuthMessageSignerException
-     *         if signing the request failed
-     * @throws OAuthNotAuthorizedException
-     *         if the service provider rejected the consumer
-     * @throws OAuthExpectationFailedException
-     *         if required parameters were not correctly set by the consumer or
-     *         service provider
-     * @throws OAuthCommunicationException
-     *         if server communication failed
-     */
-    public String retrieveRequestToken(OAuthConsumer consumer, String callbackUrl,
-            String... customOAuthParams) throws OAuthMessageSignerException,
-            OAuthNotAuthorizedException, OAuthExpectationFailedException,
-            OAuthCommunicationException;
-
-    /**
-     * Queries the service provider for an access token.
-     * <p>
-     * <b>Pre-conditions:</b> the given {@link OAuthConsumer} must have a valid
-     * consumer key, consumer secret, authorized request token and token secret
-     * already set.
-     * </p>
-     * <p>
-     * <b>Post-conditions:</b> the given {@link OAuthConsumer} will have an
-     * access token and token secret set.
-     * </p>
-     *
-     * @param consumer
-     *        the {@link OAuthConsumer} that should be used to sign the request
-     * @param oauthVerifier
-     *        <b>NOTE: Only applies to service providers implementing OAuth
-     *        1.0a. Set to null if the service provider is still using OAuth
-     *        1.0.</b> The verification code issued by the service provider
-     *        after the the user has granted the consumer authorization. If the
-     *        callback method provided in the previous step was
-     *        {@link OAuth.OUT_OF_BAND}, then you must ask the user for this
-     *        value. If your app has received a callback, the verfication code
-     *        was passed as part of that request instead.
-     * @param customOAuthParams
-     *        you can pass custom OAuth parameters here which will go directly
-     *        into the signer, i.e. you don't have to put them into the request
-     *        first. This is useful for pre-setting OAuth params for signing.
-     *        Pass them sequentially in key/value order.
-     * @throws OAuthMessageSignerException
-     *         if signing the request failed
-     * @throws OAuthNotAuthorizedException
-     *         if the service provider rejected the consumer
-     * @throws OAuthExpectationFailedException
-     *         if required parameters were not correctly set by the consumer or
-     *         service provider
-     * @throws OAuthCommunicationException
-     *         if server communication failed
-     */
-    public void retrieveAccessToken(OAuthConsumer consumer, String oauthVerifier,
-            String... customOAuthParams) throws OAuthMessageSignerException,
-            OAuthNotAuthorizedException, OAuthExpectationFailedException,
-            OAuthCommunicationException;
-
-    /**
-     * Any additional non-OAuth parameters returned in the response body of a
-     * token request can be obtained through this method. These parameters will
-     * be preserved until the next token request is issued. The return value is
-     * never null.
-     */
-    public HttpParameters getResponseParameters();
-
-    /**
-     * Subclasses must use this setter to preserve any non-OAuth query
-     * parameters contained in the server response. It's the caller's
-     * responsibility that any OAuth parameters be removed beforehand.
-     *
-     * @param parameters
-     *        the map of query parameters served by the service provider in the
-     *        token response
-     */
-    public void setResponseParameters(HttpParameters parameters);
-
-    /**
-     * Use this method to set custom HTTP headers to be used for the requests
-     * which are sent to retrieve tokens. @deprecated THIS METHOD HAS BEEN
-     * DEPRECATED. Use {@link OAuthProviderListener} to customize requests.
-     *
-     * @param header
-     *        The header name (e.g. 'WWW-Authenticate')
-     * @param value
-     *        The header value (e.g. 'realm=www.example.com')
-     */
-    @Deprecated
-    public void setRequestHeader(String header, String value);
-
-    /**
-     * @deprecated THIS METHOD HAS BEEN DEPRECATED. Use
-     *             {@link OAuthProviderListener} to customize requests.
-     * @return all request headers set via {@link #setRequestHeader}
-     */
-    @Deprecated
-    public Map<String, String> getRequestHeaders();
-
-    /**
-     * @param isOAuth10aProvider
-     *        set to true if the service provider supports OAuth 1.0a. Note that
-     *        you need only call this method if you reconstruct a provider
-     *        object in between calls to retrieveRequestToken() and
-     *        retrieveAccessToken() (i.e. if the object state isn't preserved).
-     *        If instead those two methods are called on the same provider
-     *        instance, this flag will be deducted automatically based on the
-     *        server response during retrieveRequestToken(), so you can simply
-     *        ignore this method.
-     */
-    public void setOAuth10a(boolean isOAuth10aProvider);
-
-    /**
-     * @return true if the service provider supports OAuth 1.0a. Note that the
-     *         value returned here is only meaningful after you have already
-     *         performed the token handshake, otherwise there is no way to
-     *         determine what version of the OAuth protocol the service provider
-     *         implements.
-     */
-    public boolean isOAuth10a();
-
-    public String getRequestTokenEndpointUrl();
-
-    public String getAccessTokenEndpointUrl();
-
-    public String getAuthorizationWebsiteUrl();
-
-    public void setListener(OAuthProviderListener listener);
-
-    public void removeListener(OAuthProviderListener listener);
-}
Index: trunk/src/oauth/signpost/OAuthProviderListener.java
===================================================================
--- trunk/src/oauth/signpost/OAuthProviderListener.java	(revision 16402)
+++ 	(revision )
@@ -1,48 +1,0 @@
-package oauth.signpost;
-
-import oauth.signpost.http.HttpRequest;
-import oauth.signpost.http.HttpResponse;
-
-/**
- * Provides hooks into the token request handling procedure executed by
- * {@link OAuthProvider}.
- * 
- * @author Matthias Kaeppler
- */
-public interface OAuthProviderListener {
-
-    /**
-     * Called after the request has been created and default headers added, but
-     * before the request has been signed.
-     * 
-     * @param request
-     *        the request to be sent
-     * @throws Exception
-     */
-    void prepareRequest(HttpRequest request) throws Exception;
-
-    /**
-     * Called after the request has been signed, but before it's being sent.
-     * 
-     * @param request
-     *        the request to be sent
-     * @throws Exception
-     */
-    void prepareSubmission(HttpRequest request) throws Exception;
-
-    /**
-     * Called when the server response has been received. You can implement this
-     * to manually handle the response data.
-     * 
-     * @param request
-     *        the request that was sent
-     * @param response
-     *        the response that was received
-     * @return returning true means you have handled the response, and the
-     *         provider will return immediately. Return false to let the event
-     *         propagate and let the provider execute its default response
-     *         handling.
-     * @throws Exception
-     */
-    boolean onResponseReceived(HttpRequest request, HttpResponse response) throws Exception;
-}
Index: trunk/src/oauth/signpost/basic/UrlStringRequestAdapter.java
===================================================================
--- trunk/src/oauth/signpost/basic/UrlStringRequestAdapter.java	(revision 16402)
+++ 	(revision )
@@ -1,61 +1,0 @@
-package oauth.signpost.basic;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.Map;
-
-import oauth.signpost.http.HttpRequest;
-
-public class UrlStringRequestAdapter implements HttpRequest {
-
-    private String url;
-
-    public UrlStringRequestAdapter(String url) {
-        this.url = url;
-    }
-
-    @Override
-    public String getMethod() {
-        return "GET";
-    }
-
-    @Override
-    public String getRequestUrl() {
-        return url;
-    }
-
-    @Override
-    public void setRequestUrl(String url) {
-        this.url = url;
-    }
-
-    @Override
-    public void setHeader(String name, String value) {
-    }
-
-    @Override
-    public String getHeader(String name) {
-        return null;
-    }
-
-    @Override
-    public Map<String, String> getAllHeaders() {
-        return Collections.emptyMap();
-    }
-
-    @Override
-    public InputStream getMessagePayload() throws IOException {
-        return null;
-    }
-
-    @Override
-    public String getContentType() {
-        return null;
-    }
-
-    @Override
-    public Object unwrap() {
-        return url;
-    }
-}
Index: trunk/src/oauth/signpost/exception/OAuthCommunicationException.java
===================================================================
--- trunk/src/oauth/signpost/exception/OAuthCommunicationException.java	(revision 16402)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/* Copyright (c) 2009 Matthias Kaeppler
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package oauth.signpost.exception;
-
-@SuppressWarnings("serial")
-public class OAuthCommunicationException extends OAuthException {
-
-    private String responseBody;
-    
-    public OAuthCommunicationException(Exception cause) {
-        super("Communication with the service provider failed: "
-                + cause.getLocalizedMessage(), cause);
-    }
-    
-    public OAuthCommunicationException(String message, String responseBody) {
-        super(message);
-        this.responseBody = responseBody;
-    }
-    
-    public String getResponseBody() {
-        return responseBody;
-    }
-}
Index: trunk/src/oauth/signpost/exception/OAuthException.java
===================================================================
--- trunk/src/oauth/signpost/exception/OAuthException.java	(revision 16402)
+++ 	(revision )
@@ -1,17 +1,0 @@
-package oauth.signpost.exception;
-
-@SuppressWarnings("serial")
-public abstract class OAuthException extends Exception {
-
-    public OAuthException(String message) {
-        super(message);
-    }
-
-    public OAuthException(Throwable cause) {
-        super(cause);
-    }
-
-    public OAuthException(String message, Throwable cause) {
-        super(message, cause);
-    }
-}
Index: trunk/src/oauth/signpost/exception/OAuthExpectationFailedException.java
===================================================================
--- trunk/src/oauth/signpost/exception/OAuthExpectationFailedException.java	(revision 16402)
+++ 	(revision )
@@ -1,23 +1,0 @@
-/* Copyright (c) 2009 Matthias Kaeppler
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package oauth.signpost.exception;
-
-@SuppressWarnings("serial")
-public class OAuthExpectationFailedException extends OAuthException {
-
-    public OAuthExpectationFailedException(String message) {
-        super(message);
-    }
-}
Index: trunk/src/oauth/signpost/exception/OAuthMessageSignerException.java
===================================================================
--- trunk/src/oauth/signpost/exception/OAuthMessageSignerException.java	(revision 16402)
+++ 	(revision )
@@ -1,28 +1,0 @@
-/* Copyright (c) 2009 Matthias Kaeppler
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package oauth.signpost.exception;
-
-@SuppressWarnings("serial")
-public class OAuthMessageSignerException extends OAuthException {
-
-    public OAuthMessageSignerException(String message) {
-        super(message);
-    }
-
-    public OAuthMessageSignerException(Exception cause) {
-        super(cause);
-    }
-
-}
Index: trunk/src/oauth/signpost/exception/OAuthNotAuthorizedException.java
===================================================================
--- trunk/src/oauth/signpost/exception/OAuthNotAuthorizedException.java	(revision 16402)
+++ 	(revision )
@@ -1,38 +1,0 @@
-/* Copyright (c) 2009 Matthias Kaeppler
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package oauth.signpost.exception;
-
-@SuppressWarnings("serial")
-public class OAuthNotAuthorizedException extends OAuthException {
-
-    private static final String ERROR = "Authorization failed (server replied with a 401). "
-        + "This can happen if the consumer key was not correct or "
-        + "the signatures did not match.";
-    
-    private String responseBody;
-    
-    public OAuthNotAuthorizedException() {
-        super(ERROR);
-    }
-    
-    public OAuthNotAuthorizedException(String responseBody) {
-        super(ERROR);
-        this.responseBody = responseBody;
-    }
-    
-    public String getResponseBody() {
-        return responseBody;
-    }
-}
Index: trunk/src/oauth/signpost/http/HttpParameters.java
===================================================================
--- trunk/src/oauth/signpost/http/HttpParameters.java	(revision 16402)
+++ 	(revision )
@@ -1,316 +1,0 @@
-/* Copyright (c) 2008, 2009 Netflix, Matthias Kaeppler
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package oauth.signpost.http;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import oauth.signpost.OAuth;
-
-/**
- * A multi-map of HTTP request parameters. Each key references a
- * {@link SortedSet} of parameters collected from the request during message
- * signing. Parameter values are sorted as per {@linkplain http://oauth.net/core/1.0a/#anchor13}.
- * Every key/value pair will be percent-encoded upon insertion.
- * This class has special semantics tailored to being useful for message signing;
- * it's not a general purpose collection class to handle request parameters.
- *
- * @author Matthias Kaeppler
- */
-@SuppressWarnings("serial")
-public class HttpParameters implements Map<String, SortedSet<String>>, Serializable {
-
-    private TreeMap<String, SortedSet<String>> wrappedMap = new TreeMap<>();
-
-    @Override
-    public SortedSet<String> put(String key, SortedSet<String> value) {
-        return wrappedMap.put(key, value);
-    }
-
-    public SortedSet<String> put(String key, SortedSet<String> values, boolean percentEncode) {
-        if (percentEncode) {
-            remove(key);
-            for (String v : values) {
-                put(key, v, true);
-            }
-            return get(key);
-        } else {
-            return wrappedMap.put(key, values);
-        }
-    }
-
-    /**
-     * Convenience method to add a single value for the parameter specified by
-     * 'key'.
-     *
-     * @param key
-     *        the parameter name
-     * @param value
-     *        the parameter value
-     * @return the value
-     */
-    public String put(String key, String value) {
-        return put(key, value, false);
-    }
-
-    /**
-     * Convenience method to add a single value for the parameter specified by
-     * 'key'.
-     *
-     * @param key
-     *        the parameter name
-     * @param value
-     *        the parameter value
-     * @param percentEncode
-     *        whether key and value should be percent encoded before being
-     *        inserted into the map
-     * @return the value
-     */
-    public String put(String key, String value, boolean percentEncode) {
-         // fix contributed by Bjorn Roche - key should be encoded before wrappedMap.get
-         key = percentEncode ? OAuth.percentEncode(key) : key;
-         SortedSet<String> values = wrappedMap.get(key);
-         if (values == null) {
-             values = new TreeSet<>();
-             wrappedMap.put( key, values);
-         }
-         if (value != null) {
-             value = percentEncode ? OAuth.percentEncode(value) : value;
-             values.add(value);
-         }
-
-         return value;
-     }
-
-    /**
-     * Convenience method to allow for storing null values. {@link #put} doesn't
-     * allow null values, because that would be ambiguous.
-     *
-     * @param key
-     *        the parameter name
-     * @param nullString
-     *        can be anything, but probably... null?
-     * @return null
-     */
-    public String putNull(String key, String nullString) {
-        return put(key, nullString);
-    }
-
-    @Override
-    public void putAll(Map<? extends String, ? extends SortedSet<String>> m) {
-        wrappedMap.putAll(m);
-    }
-
-    public void putAll(Map<? extends String, ? extends SortedSet<String>> m, boolean percentEncode) {
-        if (percentEncode) {
-            for (String key : m.keySet()) {
-                put(key, m.get(key), true);
-            }
-        } else {
-            wrappedMap.putAll(m);
-        }
-    }
-
-    public void putAll(String[] keyValuePairs, boolean percentEncode) {
-        for (int i = 0; i < keyValuePairs.length - 1; i += 2) {
-            this.put(keyValuePairs[i], keyValuePairs[i + 1], percentEncode);
-        }
-    }
-
-    /**
-     * Convenience method to merge a Map<String, List<String>>.
-     *
-     * @param m
-     *        the map
-     */
-    public void putMap(Map<String, List<String>> m) {
-        for (String key : m.keySet()) {
-            SortedSet<String> vals = get(key);
-            if (vals == null) {
-                vals = new TreeSet<>();
-                put(key, vals);
-            }
-            vals.addAll(m.get(key));
-        }
-    }
-
-    @Override
-    public SortedSet<String> get(Object key) {
-        return wrappedMap.get(key);
-    }
-
-    /**
-     * Convenience method for {@link #getFirst(key, false)}.
-     *
-     * @param key
-     *        the parameter name (must be percent encoded if it contains unsafe
-     *        characters!)
-     * @return the first value found for this parameter
-     */
-    public String getFirst(Object key) {
-        return getFirst(key, false);
-    }
-
-    /**
-     * Returns the first value from the set of all values for the given
-     * parameter name. If the key passed to this method contains special
-     * characters, you MUST first percent encode it using
-     * {@link OAuth#percentEncode(String)}, otherwise the lookup will fail
-     * (that's because upon storing values in this map, keys get
-     * percent-encoded).
-     *
-     * @param key
-     *        the parameter name (must be percent encoded if it contains unsafe
-     *        characters!)
-     * @param percentDecode
-     *        whether the value being retrieved should be percent decoded
-     * @return the first value found for this parameter
-     */
-    public String getFirst(Object key, boolean percentDecode) {
-        SortedSet<String> values = wrappedMap.get(key);
-        if (values == null || values.isEmpty()) {
-            return null;
-        }
-        String value = values.first();
-        return percentDecode ? OAuth.percentDecode(value) : value;
-    }
-
-    /**
-     * Concatenates all values for the given key to a list of key/value pairs
-     * suitable for use in a URL query string.
-     *
-     * @param key
-     *        the parameter name
-     * @return the query string
-     */
-    public String getAsQueryString(Object key) {
-    	return getAsQueryString(key, true);
-    }
-
-    /**
-     * Concatenates all values for the given key to a list of key/value pairs
-     * suitable for use in a URL query string.
-     *
-     * @param key
-     *        the parameter name
-     * @param percentEncode
-     *        whether key should be percent encoded before being
-     *        used with the map
-     * @return the query string
-     */
-     public String getAsQueryString(Object key, boolean percentEncode) {
-        // fix contributed by Stjepan Rajko - we need the percentEncode parameter
-        // because some places (like SignatureBaseString.normalizeRequestParameters)
-        // need to supply the parameter percent encoded
-
-        StringBuilder sb = new StringBuilder();
-        if(percentEncode)
-        	key = OAuth.percentEncode((String) key);
-        Set<String> values = wrappedMap.get(key);
-        if (values == null) {
-            return key + "=";
-        }
-        Iterator<String> iter = values.iterator();
-        while (iter.hasNext()) {
-            sb.append(key + "=" + iter.next());
-            if (iter.hasNext()) {
-                sb.append("&");
-            }
-        }
-        return sb.toString();
-    }
-
-    public String getAsHeaderElement(String key) {
-        String value = getFirst(key);
-        if (value == null) {
-            return null;
-        }
-        return key + "=\"" + value + "\"";
-    }
-
-    @Override
-    public boolean containsKey(Object key) {
-        return wrappedMap.containsKey(key);
-    }
-
-    @Override
-    public boolean containsValue(Object value) {
-        for (Set<String> values : wrappedMap.values()) {
-            if (values.contains(value)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public int size() {
-        int count = 0;
-        for (String key : wrappedMap.keySet()) {
-            count += wrappedMap.get(key).size();
-        }
-        return count;
-    }
-
-    @Override
-    public boolean isEmpty() {
-        return wrappedMap.isEmpty();
-    }
-
-    @Override
-    public void clear() {
-        wrappedMap.clear();
-    }
-
-    @Override
-    public SortedSet<String> remove(Object key) {
-        return wrappedMap.remove(key);
-    }
-
-    @Override
-    public Set<String> keySet() {
-        return wrappedMap.keySet();
-    }
-
-    @Override
-    public Collection<SortedSet<String>> values() {
-        return wrappedMap.values();
-    }
-
-    @Override
-    public Set<Entry<String, SortedSet<String>>> entrySet() {
-        return wrappedMap.entrySet();
-    }
-
-    public HttpParameters getOAuthParameters() {
-        HttpParameters oauthParams = new HttpParameters();
-
-        for (Entry<String, SortedSet<String>> param : this.entrySet()) {
-            String key = param.getKey();
-            if (key.startsWith("oauth_") || key.startsWith("x_oauth_")) {
-                oauthParams.put(key, param.getValue());
-            }
-        }
-
-        return oauthParams;
-    }
-}
Index: trunk/src/oauth/signpost/http/HttpRequest.java
===================================================================
--- trunk/src/oauth/signpost/http/HttpRequest.java	(revision 16402)
+++ 	(revision )
@@ -1,42 +1,0 @@
-package oauth.signpost.http;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-
-import oauth.signpost.OAuthConsumer;
-
-/**
- * A concise description of an HTTP request. Contains methods to access all
- * those parts of an HTTP request which Signpost needs to sign a message. If you
- * want to extend Signpost to sign a different kind of HTTP request than those
- * currently supported, you'll have to write an adapter which implements this
- * interface and a custom {@link OAuthConsumer} which performs the wrapping.
- *
- * @author Matthias Kaeppler
- */
-public interface HttpRequest {
-
-    String getMethod();
-
-    String getRequestUrl();
-
-    void setRequestUrl(String url);
-
-    void setHeader(String name, String value);
-
-    String getHeader(String name);
-
-    Map<String, String> getAllHeaders();
-
-    InputStream getMessagePayload() throws IOException;
-
-    String getContentType();
-
-    /**
-     * Returns the wrapped request object, in case you must work directly on it.
-     *
-     * @return the wrapped request object
-     */
-    Object unwrap();
-}
Index: trunk/src/oauth/signpost/http/HttpResponse.java
===================================================================
--- trunk/src/oauth/signpost/http/HttpResponse.java	(revision 16402)
+++ 	(revision )
@@ -1,21 +1,0 @@
-package oauth.signpost.http;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-public interface HttpResponse {
-
-    int getStatusCode() throws IOException;
-
-    String getReasonPhrase() throws Exception;
-
-    InputStream getContent() throws IOException;
-
-    /**
-     * Returns the underlying response object, in case you need to work on it
-     * directly.
-     * 
-     * @return the wrapped response object
-     */
-    Object unwrap();
-}
Index: trunk/src/oauth/signpost/signature/AuthorizationHeaderSigningStrategy.java
===================================================================
--- trunk/src/oauth/signpost/signature/AuthorizationHeaderSigningStrategy.java	(revision 16402)
+++ 	(revision )
@@ -1,51 +1,0 @@
-package oauth.signpost.signature;
-
-import java.util.Iterator;
-
-import oauth.signpost.OAuth;
-import oauth.signpost.http.HttpParameters;
-import oauth.signpost.http.HttpRequest;
-
-/**
- * Writes to the HTTP Authorization header field.
- *
- * @author Matthias Kaeppler
- */
-public class AuthorizationHeaderSigningStrategy implements SigningStrategy {
-
-    private static final long serialVersionUID = 1L;
-
-    @Override
-    public String writeSignature(String signature, HttpRequest request,
-            HttpParameters requestParameters) {
-        StringBuilder sb = new StringBuilder();
-
-        sb.append("OAuth ");
-
-        // add the realm parameter, if any
-        if (requestParameters.containsKey("realm")) {
-            sb.append(requestParameters.getAsHeaderElement("realm"));
-            sb.append(", ");
-        }
-
-        // add all (x_)oauth parameters
-        HttpParameters oauthParams = requestParameters.getOAuthParameters();
-        oauthParams.put(OAuth.OAUTH_SIGNATURE, signature, true);
-
-        Iterator<String> iter = oauthParams.keySet().iterator();
-        while (iter.hasNext()) {
-            String key = iter.next();
-            sb.append(oauthParams.getAsHeaderElement(key));
-            if (iter.hasNext()) {
-                sb.append(", ");
-            }
-        }
-
-        String header = sb.toString();
-        OAuth.debugOut("Auth Header", header);
-        request.setHeader(OAuth.HTTP_AUTHORIZATION_HEADER, header);
-
-        return header;
-    }
-
-}
Index: trunk/src/oauth/signpost/signature/HmacSha1MessageSigner.java
===================================================================
--- trunk/src/oauth/signpost/signature/HmacSha1MessageSigner.java	(revision 16402)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/* Copyright (c) 2009 Matthias Kaeppler
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package oauth.signpost.signature;
-
-import java.io.UnsupportedEncodingException;
-import java.security.GeneralSecurityException;
-
-import javax.crypto.Mac;
-import javax.crypto.SecretKey;
-import javax.crypto.spec.SecretKeySpec;
-
-import oauth.signpost.OAuth;
-import oauth.signpost.exception.OAuthMessageSignerException;
-import oauth.signpost.http.HttpRequest;
-import oauth.signpost.http.HttpParameters;
-
-@SuppressWarnings("serial")
-public class HmacSha1MessageSigner extends OAuthMessageSigner {
-
-	private static final String MAC_NAME = "HmacSHA1";
-
-	@Override
-    public String getSignatureMethod() {
-        return "HMAC-SHA1";
-    }
-
-    @Override
-    public String sign(HttpRequest request, HttpParameters requestParams)
-            throws OAuthMessageSignerException {
-        try {
-            String keyString = OAuth.percentEncode(getConsumerSecret()) + '&'
-                    + OAuth.percentEncode(getTokenSecret());
-            byte[] keyBytes = keyString.getBytes(OAuth.ENCODING);
-
-            SecretKey key = new SecretKeySpec(keyBytes, MAC_NAME);
-            Mac mac = Mac.getInstance(MAC_NAME);
-            mac.init(key);
-
-            String sbs = new SignatureBaseString(request, requestParams).generate();
-            OAuth.debugOut("SBS", sbs);
-            byte[] text = sbs.getBytes(OAuth.ENCODING);
-
-            return base64Encode(mac.doFinal(text)).trim();
-        } catch (GeneralSecurityException e) {
-            throw new OAuthMessageSignerException(e);
-        } catch (UnsupportedEncodingException e) {
-            throw new OAuthMessageSignerException(e);
-        }
-    }
-}
Index: trunk/src/oauth/signpost/signature/OAuthMessageSigner.java
===================================================================
--- trunk/src/oauth/signpost/signature/OAuthMessageSigner.java	(revision 16402)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/* Copyright (c) 2009 Matthias Kaeppler
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package oauth.signpost.signature;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Base64;
-
-import oauth.signpost.exception.OAuthMessageSignerException;
-import oauth.signpost.http.HttpRequest;
-import oauth.signpost.http.HttpParameters;
-
-public abstract class OAuthMessageSigner implements Serializable {
-
-    private static final long serialVersionUID = 4445779788786131202L;
-
-    private String consumerSecret;
-
-    private String tokenSecret;
-
-
-    public abstract String sign(HttpRequest request, HttpParameters requestParameters)
-            throws OAuthMessageSignerException;
-
-    public abstract String getSignatureMethod();
-
-    public String getConsumerSecret() {
-        return consumerSecret;
-    }
-
-    public String getTokenSecret() {
-        return tokenSecret;
-    }
-
-    public void setConsumerSecret(String consumerSecret) {
-        this.consumerSecret = consumerSecret;
-    }
-
-    public void setTokenSecret(String tokenSecret) {
-        this.tokenSecret = tokenSecret;
-    }
-
-    protected byte[] decodeBase64(String s) {
-        return Base64.getDecoder().decode(s);
-    }
-
-    protected String base64Encode(byte[] b) {
-        return Base64.getEncoder().encodeToString(b);
-    }
-
-    private void readObject(java.io.ObjectInputStream stream)
-            throws IOException, ClassNotFoundException {
-        stream.defaultReadObject();
-    }
-}
Index: trunk/src/oauth/signpost/signature/QueryStringSigningStrategy.java
===================================================================
--- trunk/src/oauth/signpost/signature/QueryStringSigningStrategy.java	(revision 16402)
+++ 	(revision )
@@ -1,50 +1,0 @@
-package oauth.signpost.signature;
-
-import java.util.Iterator;
-
-import oauth.signpost.OAuth;
-import oauth.signpost.http.HttpParameters;
-import oauth.signpost.http.HttpRequest;
-
-/**
- * Writes to a URL query string. <strong>Note that this currently ONLY works
- * when signing a URL directly, not with HTTP request objects.</strong> That's
- * because most HTTP request implementations do not allow the client to change
- * the URL once the request has been instantiated, so there is no way to append
- * parameters to it.
- *
- * @author Matthias Kaeppler
- */
-public class QueryStringSigningStrategy implements SigningStrategy {
-
-    private static final long serialVersionUID = 1L;
-
-    @Override
-    public String writeSignature(String signature, HttpRequest request,
-            HttpParameters requestParameters) {
-
-        // add all (x_)oauth parameters
-        HttpParameters oauthParams = requestParameters.getOAuthParameters();
-        oauthParams.put(OAuth.OAUTH_SIGNATURE, signature, true);
-
-        Iterator<String> iter = oauthParams.keySet().iterator();
-
-        // add the first query parameter (we always have at least the signature)
-        String firstKey = iter.next();
-        StringBuilder sb = new StringBuilder(OAuth.addQueryString(request.getRequestUrl(),
-            oauthParams.getAsQueryString(firstKey)));
-
-        while (iter.hasNext()) {
-            sb.append("&");
-            String key = iter.next();
-            sb.append(oauthParams.getAsQueryString(key));
-        }
-
-        String signedUrl = sb.toString();
-
-        request.setRequestUrl(signedUrl);
-
-        return signedUrl;
-    }
-
-}
Index: trunk/src/oauth/signpost/signature/SignatureBaseString.java
===================================================================
--- trunk/src/oauth/signpost/signature/SignatureBaseString.java	(revision 16402)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/*
- * Copyright (c) 2009 Matthias Kaeppler Licensed under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
- * or agreed to in writing, software distributed under the License is
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-package oauth.signpost.signature;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Iterator;
-
-import oauth.signpost.OAuth;
-import oauth.signpost.exception.OAuthMessageSignerException;
-import oauth.signpost.http.HttpRequest;
-import oauth.signpost.http.HttpParameters;
-
-public class SignatureBaseString {
-
-    private HttpRequest request;
-
-    private HttpParameters requestParameters;
-
-    /**
-     * Constructs a new SBS instance that will operate on the given request
-     * object and parameter set.
-     * 
-     * @param request
-     *        the HTTP request
-     * @param requestParameters
-     *        the set of request parameters from the Authorization header, query
-     *        string and form body
-     */
-    public SignatureBaseString(HttpRequest request, HttpParameters requestParameters) {
-        this.request = request;
-        this.requestParameters = requestParameters;
-    }
-
-    /**
-     * Builds the signature base string from the data this instance was
-     * configured with.
-     * 
-     * @return the signature base string
-     * @throws OAuthMessageSignerException
-     */
-    public String generate() throws OAuthMessageSignerException {
-
-        try {
-            String normalizedUrl = normalizeRequestUrl();
-            String normalizedParams = normalizeRequestParameters();
-
-            return request.getMethod() + '&' + OAuth.percentEncode(normalizedUrl) + '&'
-                    + OAuth.percentEncode(normalizedParams);
-        } catch (Exception e) {
-            throw new OAuthMessageSignerException(e);
-        }
-    }
-
-    public String normalizeRequestUrl() throws URISyntaxException {
-        URI uri = new URI(request.getRequestUrl());
-        String scheme = uri.getScheme().toLowerCase();
-        String authority = uri.getAuthority().toLowerCase();
-        boolean dropPort = (scheme.equals("http") && uri.getPort() == 80)
-                || (scheme.equals("https") && uri.getPort() == 443);
-        if (dropPort) {
-            // find the last : in the authority
-            int index = authority.lastIndexOf(":");
-            if (index >= 0) {
-                authority = authority.substring(0, index);
-            }
-        }
-        String path = uri.getRawPath();
-        if (path == null || path.length() <= 0) {
-            path = "/"; // conforms to RFC 2616 section 3.2.2
-        }
-        // we know that there is no query and no fragment here.
-        return scheme + "://" + authority + path;
-    }
-
-    /**
-     * Normalizes the set of request parameters this instance was configured
-     * with, as per OAuth spec section 9.1.1.
-     * 
-     * @param parameters
-     *        the set of request parameters
-     * @return the normalized params string
-     * @throws IOException
-     */
-    public String normalizeRequestParameters() throws IOException {
-        if (requestParameters == null) {
-            return "";
-        }
-
-        StringBuilder sb = new StringBuilder();
-        Iterator<String> iter = requestParameters.keySet().iterator();
-
-        for (int i = 0; iter.hasNext(); i++) {
-            String param = iter.next();
-
-            if (OAuth.OAUTH_SIGNATURE.equals(param) || "realm".equals(param)) {
-                continue;
-            }
-
-            if (i > 0) {
-                sb.append("&");
-            }
-
-            // fix contributed by Stjepan Rajko
-            // since param should already be encoded, we supply false for percentEncode
-            sb.append(requestParameters.getAsQueryString(param, false));  
-        }
-        return sb.toString();
-    }
-}
Index: trunk/src/oauth/signpost/signature/SigningStrategy.java
===================================================================
--- trunk/src/oauth/signpost/signature/SigningStrategy.java	(revision 16402)
+++ 	(revision )
@@ -1,37 +1,0 @@
-package oauth.signpost.signature;
-
-import java.io.Serializable;
-
-import oauth.signpost.http.HttpRequest;
-import oauth.signpost.http.HttpParameters;
-
-/**
- * <p>
- * Defines how an OAuth signature string is written to a request.
- * </p>
- * <p>
- * Unlike {@link OAuthMessageSigner}, which is concerned with <i>how</i> to
- * generate a signature, this class is concered with <i>where</i> to write it
- * (e.g. HTTP header or query string).
- * </p>
- * 
- * @author Matthias Kaeppler
- */
-public interface SigningStrategy extends Serializable {
-
-    /**
-     * Writes an OAuth signature and all remaining required parameters to an
-     * HTTP message.
-     * 
-     * @param signature
-     *        the signature to write
-     * @param request
-     *        the request to sign
-     * @param requestParameters
-     *        the request parameters
-     * @return whatever has been written to the request, e.g. an Authorization
-     *         header field
-     */
-    String writeSignature(String signature, HttpRequest request, HttpParameters requestParameters);
-    
-}
