Skip to content

Instantly share code, notes, and snippets.

@isapir
Created February 3, 2012 23:49
Show Gist options
  • Save isapir/1733819 to your computer and use it in GitHub Desktop.
Save isapir/1733819 to your computer and use it in GitHub Desktop.
this class extends OAuthRequest to provide a public send() method in the class itself for compatibility with ColdFusion and other languages that interact with Java via reflection
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package s21.net.scribe;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.scribe.model.OAuthRequest;
import org.scribe.model.Response;
import org.scribe.model.Verb;
/**
*
* @author Admin
*
* this class extends OAuthRequest to provide a public send() method in the class itself;
* ACF8 throws an error that send() does not exist, probably because OAuthRequest extends Request which is
* confused somewhere with the servlet's Request object when ACF tries to use it via Reflection
*
* all public methods here do is simply call super class with the same method signature
*/
public class OAuthRequestExt extends OAuthRequest {
public OAuthRequestExt( String verb, String url ) {
super( Verb.valueOf( verb.toUpperCase() ), url );
}
/** methods below delegate calls to respective methods in org.scribe.model.Request **/
@Override
public Response send() {
return super.send();
}
@Override
public void addHeader(String key, String value) {
super.addHeader(key, value);
}
@Override
public void addBodyParameter(String key, String value) {
super.addBodyParameter(key, value);
}
@Override
public void addQuerystringParameter(String key, String value) {
super.addQuerystringParameter(key, value);
}
@Override
public void addPayload(String payload) {
super.addPayload(payload);
}
@Override
public void addPayload(byte[] payload) {
super.addPayload(payload);
}
@Override
public Map<String, String> getQueryStringParams() {
return super.getQueryStringParams();
}
@Override
public Map<String, String> getBodyParams() {
return super.getBodyParams();
}
@Override
public String getUrl() {
return super.getUrl();
}
@Override
public String getSanitizedUrl() {
return super.getSanitizedUrl();
}
@Override
public String getBodyContents() {
return super.getBodyContents();
}
@Override
public Verb getVerb() {
return super.getVerb();
}
@Override
public Map<String, String> getHeaders() {
return super.getHeaders();
}
@Override
public String getCharset() {
return super.getCharset();
}
@Override
public void setConnectTimeout(int duration, TimeUnit unit) {
super.setConnectTimeout(duration, unit);
}
@Override
public void setReadTimeout(int duration, TimeUnit unit) {
super.setReadTimeout(duration, unit);
}
@Override
public void setCharset(String charsetName) {
super.setCharset(charsetName);
}
@Override
public void setConnectionKeepAlive(boolean connectionKeepAlive) {
super.setConnectionKeepAlive(connectionKeepAlive);
}
@Override
public String toString() {
return super.toString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment