source: josm/trunk/src/oauth/signpost/basic/DefaultOAuthConsumer.java@ 4231

Last change on this file since 4231 was 4231, checked in by stoecker, 13 years ago

add signpost and metadata extractor code to repository directly

File size: 1.5 KB
Line 
1/* Copyright (c) 2009 Matthias Kaeppler
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15package oauth.signpost.basic;
16
17import java.net.HttpURLConnection;
18
19import oauth.signpost.AbstractOAuthConsumer;
20import oauth.signpost.http.HttpRequest;
21
22/**
23 * The default implementation for an OAuth consumer. Only supports signing
24 * {@link java.net.HttpURLConnection} type requests.
25 *
26 * @author Matthias Kaeppler
27 */
28public class DefaultOAuthConsumer extends AbstractOAuthConsumer {
29
30 private static final long serialVersionUID = 1L;
31
32 public DefaultOAuthConsumer(String consumerKey, String consumerSecret) {
33 super(consumerKey, consumerSecret);
34 }
35
36 @Override
37 protected HttpRequest wrap(Object request) {
38 if (!(request instanceof HttpURLConnection)) {
39 throw new IllegalArgumentException(
40 "The default consumer expects requests of type java.net.HttpURLConnection");
41 }
42 return new HttpURLConnectionRequestAdapter((HttpURLConnection) request);
43 }
44
45}
Note: See TracBrowser for help on using the repository browser.