@Override protected Response sendJsonRequest( URL url, RequestMethod method, String json ) throws IOException, OAuthException { return _sendRequest( url, method, json, JSON_CONTENT_TYPE ); }
/** * Use a default {@link HttpClient} for HTTP traffic. */ public void setDefaultHttpClient() { setDefaultHttpClient(30000); }
ContentType type = ContentType.create(contentType, getEncoding()); getAuthConsumer().sign(request); return createResponse(response);
"auth", auth, ContentType.create("text/plain", getEncoding())); return createResponse(response);
/** * Use a specific {@link HttpClient} for HTTP traffic. * * @param httpClient {@link HttpClient}, that is used for HTTP communication */ public synchronized void setHttpClient(HttpClient httpClient) { this.httpClient = httpClient; // register HTTP client in the OAuth provider try { OAuthProvider p = getAuthProvider(); if (p instanceof CommonsHttpOAuthProvider) { ((CommonsHttpOAuthProvider) p).setHttpClient(httpClient); } } catch (OAuthNotAuthorizedException ex) { } } }
String charset = (contentType != null && contentType.getCharset() != null) ? contentType.getCharset().name() : null; if (charset == null) charset = getEncoding();
ContentType type = ContentType.create( contentType, getEncoding() ); getAuthConsumer().sign( request ); return createResponse( response );
"auth", auth, ContentType.create( "text/plain", getEncoding() ) ); return createResponse( response );
/** * Use a specific {@link HttpClient} for HTTP traffic. * * @param httpClient * {@link HttpClient}, that is used for HTTP communication */ public synchronized void setHttpClient( HttpClient httpClient ) { this.httpClient = httpClient; // register HTTP client in the OAuth provider try { OAuthProvider p = getAuthProvider(); if (p instanceof CommonsHttpOAuthProvider) { ((CommonsHttpOAuthProvider) p).setHttpClient( httpClient ); } } catch (OAuthNotAuthorizedException ex) { } } }
String charset = (contentType!=null && contentType.getCharset()!=null)? contentType.getCharset().name(): null; if (charset==null) charset = getEncoding();
"metadata", xml, ContentType.create("application/xml", getEncoding())); getAuthConsumer().sign(request); return createResponse(response);
@Override protected Response sendXmlRequest( URL url, RequestMethod method, String xml ) throws IOException, OAuthException { return _sendRequest( url, method, xml, XML_CONTENT_TYPE ); }
/** * Use a default {@link HttpClient} for HTTP traffic. */ public void setDefaultHttpClient() { setDefaultHttpClient( 30000 ); }
"metadata", xml, ContentType.create( "application/xml", getEncoding() ) ); getAuthConsumer().sign( request ); return createResponse( response );
@Override protected Response sendJsonRequest(URL url, RequestMethod method, String json) throws IOException, OAuthException { return _sendRequest(url, method, json, JSON_CONTENT_TYPE); }
@Override protected OAuthProvider buildOAuthProvider( String apiBaseUrl ) { if (httpClient==null) setDefaultHttpClient(); return new CommonsHttpOAuthProvider( apiBaseUrl + "/security/oauth/request_token", apiBaseUrl + "/security/oauth/access_token", apiBaseUrl + "/security/oauth/confirm_access", httpClient ); }
@Override protected Response sendXmlRequest(URL url, RequestMethod method, String xml) throws IOException, OAuthException { return _sendRequest(url, method, xml, XML_CONTENT_TYPE); }
@Override protected OAuthProvider buildOAuthProvider(String apiBaseUrl) { if (httpClient == null) setDefaultHttpClient(); return new CommonsHttpOAuthProvider( apiBaseUrl + "/security/oauth/request_token", apiBaseUrl + "/security/oauth/access_token", apiBaseUrl + "/security/oauth/confirm_access", httpClient); }